On Thu, Jan 26, 2012 at 01:23:23PM -0800, Roland McGrath wrote:
> I don't fully understand why/what is happening, but I filed
a bug report
> against binutils ld with a reproducer that triggers the same thing with
> gcc < 4.7.
http://sourceware.org/bugzilla/show_bug.cgi?id=13621
The linker behavior is certainly buggy. But I also don't see off hand why
__TMC_END__ needs to be global at all. If it were just a local symbol like
__TMC_LIST__ is, then it would just be swallowed entirely when the section
is empty.
It needs to be because it is used in different .o files (crtbegin.o and
crtend.o). Both Richard and I came up with some workaround for GNU ld
(although admittedly my patch doesn't really work in the more complex
case), but we have some trouble convincing Alan Modra there is a real
issue. Feel free to join the fun :)
http://sourceware.org/ml/binutils/2012-01/msg00269.html
Cheers,
Mark