Weak symbols not being removed

Asm Twiddler asmtwiddler@gmail.com
Thu Aug 1 01:36:00 GMT 2013

Thanks for the quick response and the suggestion.

Apparently, --gc-sections was commented out in my Makefile.
However, after enabling it, some weak symbols still aren't being removed.
I use "ld -r" to construct a combined object file in every directory.
Then, in the end I link all of those object files together.
Unfortunately, "ld -r" is removing sections created by -fdata-sections
and -ffunction-sections.
After retrying this for x86, it seems to work correctly, making me
believe the problem is with the avr linker.
I'll continue this on the binutils list, since this makes more sense there.


On Wed, Jul 31, 2013 at 4:13 AM, Andrew Haley <aph@redhat.com> wrote:
> On 07/31/2013 06:25 AM, Asm Twiddler wrote:
>> I have recently noticed that my builds haven't been removing weak
>> symbols that are overridden by strong symbols.
>> More specifically, the symbol points to the strong object/function but
>> the weak symbol's data remains in the executable.
> Where is the strong object?  In a shared library?
> BTW, this is really a question for the binutils list.  GCC doesn't
> process weak symbols.  You'll get more knowledgeable people there.
> Andrew.

More information about the Gcc-help mailing list