ld: --gc-sections incompatible with --emit-relocs ?

David Lamy-Charrier david.lamy@gmail.com
Thu Oct 12 01:57:00 GMT 2006


Hello,

I am working with a cross toolchain for arm-elf based on gcc 3.4.0 and
binutils 2.15.90.
Since I want to remove dead code in the produced binary I added
-ffunction-sections on the compile line and --gc-sections on the
linker line.
But I get a warning "Warning: gc-sections option ignored" and the
unused functions are not removed in the binary.

After some tests, it appears that I also specify --emit-relocs on the
linker line, and removing this --emit-relocs causes --gc-sections to
work as expected.

I also tested with GCC 4.1.0 and binutils 2.17 and it doesn't work too.

Is any of you aware of such a limitation ? I did not find any
reference in the manual.
I would appreciate any hints on how to try to remove/workaround this limitation.


Thanks in advance,
David



More information about the Binutils mailing list