This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]