https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122516

--- Comment #10 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
(In reply to H.J. Lu from comment #5)
> (In reply to Georg-Johann Lay from comment #4)
> > (In reply to H.J. Lu from comment #2)
> > > Dup.
> > > 
> > > *** This bug has been marked as a duplicate of bug 98146 ***
> > 
> > ??? Confused.
> > 
> > Attribute retain is still ignored on functions, even though supported by 
> > gas.
> > 
> > I gave a test case above, and it still doesn't add the "R" flag.  Can you
> > please explain.
> 
> As explained in PR 98146, .init_array/.fini_array support is needed for
> SHF_GNU_RETAIN.  Does your target support .init_array/.fini_array section?

No.  But I don't see how that relates to "retain" support for functions.
.init/fini_array support is for data, no?

The point is that attribute "used" is pretty much useless without a means to
keep an object in Binutils.  That is, the user is adding a "used" attribute but
the linker is removing the thing nonetheless.

One final question: How can a function be kept on targets like avr?  Must there
be global asm that adds the "R" flag?

IMO PR98146 is a Binutils issue.  When the "used" attribute (or "R" flag for
that matter) makes the linker put objects in /different/ sections for the same
"section" attribute, that's the problem.  The binutils should set the "R" flag
(keep the section) for an input section if at least one object in that section
has an "R" flag.

Reply via email to