[PATCH] Always define referenced __start_SECNAME/__stop_SECNAME

Alan Modra amodra@gmail.com
Tue Jun 13 01:54:00 GMT 2017


On Mon, Jun 12, 2017 at 05:18:58PM -0700, H.J. Lu wrote:
> On Mon, Jun 12, 2017 at 4:32 PM, Alan Modra <amodra@gmail.com> wrote:
> > On Sat, Jun 10, 2017 at 03:46:49PM -0700, H.J. Lu wrote:
> >> This patch changes linker to always define referenced __start_SECNAME and
> >> __stop_SECNAME if the input section name is the same output section name,
> >> which is always true for orphaned sections, and SECNAME is a C identifier.
> >
> > I think this change is reasonable.
> >
> >> Also __start_SECNAME and __stop_SECNAME symbols are marked as hidden by
> >> ELF linker.
> >
> > Why is this necessary?  Also, you make another change in behaviour
> 
> It is to make sure that  __start_SECNAME and __stop_SECNAME
> symbols     for section SECNAME in different modules are unique.

I understand, and it would have been good if these symbols were
defined that way in the beginning, but they weren't.  I'm concerned
that if you make this change as well we will find some code that
relies on the symbols being dynamic.

> 
> > that you don't mention:  __start and __stop symbols were previously
> > defined by ld -Ur, not just at final link.  You'll need to modify
> 
> Is there a testcase for this behavior?

Not that I'm aware of.  

> > lang_set_startof to keep this behaviour (and be careful to not change
> > .startof. and .sizeof. syms).
> >
> 
> I have an updated patch to address:
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=21571
> 
> -- 
> H.J.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list