This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Gold complains about relocations from note sections to discarded sections
- From: Alan Modra <amodra at gmail dot com>
- To: Cary Coutant <ccoutant at gmail dot com>
- Cc: Nick Clifton <nickc at redhat dot com>, Ian Lance Taylor <iant at google dot com>, Binutils <binutils at sourceware dot org>
- Date: Wed, 18 Jul 2018 13:25:01 +0930
- Subject: Re: Gold complains about relocations from note sections to discarded sections
- References: <87601j8op5.fsf@redhat.com> <CAJimCsFJ3ObLQiPqbNMYkO9pskA694m4=OtNoX-zAzytz2gXUw@mail.gmail.com>
On Fri, Jul 13, 2018 at 03:15:46PM -0700, Cary Coutant wrote:
> I wonder if we shouldn't handle these relocations the same as for
> debug info -- with CB_PRETEND, which tries to map the reference to the
> corresponding kept section (in the case of a COMDAT group). For gc'ed
> sections, it would be equivalent to CB_IGNORE.
>
> We've got a few options: (1) look for specific section names (ick, but
> that's what we're doing currently), (2) look for SHT_NOTE sections, or
> (3) look for !SHF_ALLOC sections. The third choice would take care of
> both debug and note sections with a single condition.
>
> There are also SHT_NOTE + SHF_ALLOC sections. I'm not sure if any of
> them would be expected to have such relocations in them, and if so,
> what we should do about them.
>
> What does ld.bfd do?
I'd say ld.bfd --gc-sections is broken. The .gnu.build.attributes
relocs cause the otherwise unused section to be kept.
--
Alan Modra
Australia Development Lab, IBM