This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Quick --gc-sections question
- From: Octoploid <cryptooctoploid at gmail dot com>
- To: binutils at sourceware dot org
- Date: Mon, 7 Nov 2011 20:24:55 +0100
- Subject: Quick --gc-sections question
Please consider:
% cat check.c
__attribute__((visibility("default"))) void fun () {}
int main () { }
% gcc -ffunction-sections -rdynamic
-Wl,--gc-sections,--print-gc-sections check.c 2>&1 | grep .text.fun
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.0/../../../../x86_64-pc-linux-gnu/bin/ld:
removing unused section from '.text.fun' in file '/tmp/cc22IotY.o'
% gcc -rdynamic -Wl,--gc-sections,--print-gc-sections check.c 2>&1 |
grep .text.fun
%
Is this the expected behavior? And if yes, how can one tell the
compiler and linker to always keep the fun() function with
"-ffunction-sections -rdynamic -Wl,--gc-sections"?
For a real world case, see this Mozilla bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=678977
(Sorry if this is a dup post. But gmane seemed to drop my previous message)
--
controlled by gamma light