bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/19446] BFD linker discards section without alloc section a


From: nickc at redhat dot com
Subject: [Bug binutils/19446] BFD linker discards section without alloc section attribute under certain conditions
Date: Fri, 22 Jan 2016 09:44:24 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=19446

--- Comment #10 from Nick Clifton <nickc at redhat dot com> ---
Hi Xinliangli,

> However I do think ld's behavior is
> not correct here. Should linker first decide if some sections are 'root'
> sections that should not be throw away and then decide if other sections 
> should
> be GCed? Here linker first prunes the references and then is forced to discard
> section not because it should do so, but to make the link succeed.

Yes, but... the linker has not been told that the UNREF section is a root
section.  If the test had used a linker script that specified that the UNREF
section should be kept[1] then the linker would have acted differently.  It
would keep the UNREF section and g0 variable and everything would have worked
as expected.

Since however the UNREF section is an orphan section, the linker has more
latitude in what it can do.  The LD linker decides that since the section has
relocations against it, and since these relocations refers to symbols which are
otherwise unused, then it makes sense to discard the section.  You disagree
with this decision.  I don't.  But since there are several 
available workarounds, and, as far as I know, it is not breaking real programs,
I do not plan to make any changes to the linker.

Cheers
   Nick

[1] ie:

   UNREF : { KEEP (*(UNREF)) }

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]