[PATCH v2] elf: Handle .gnu.debuglto_.debug_* sections

Alan Modra amodra@gmail.com
Fri Mar 19 01:48:34 GMT 2021


On Thu, Mar 18, 2021 at 07:08:19AM -0700, H.J. Lu wrote:
> On Thu, Mar 18, 2021 at 2:21 AM Alan Modra <amodra@gmail.com> wrote:
> >
> > On Wed, Mar 17, 2021 at 03:43:57PM -0700, H.J. Lu via Binutils wrote:
> > > commit 994b25132814f4c2be93ce53a616a74139c4cf3c
> > > Author: H.J. Lu <hjl.tools@gmail.com>
> > > Date:   Sun Jan 17 20:01:16 2021 -0800
> > >
> > >     ld/elf: Ignore section symbols when matching linkonce with comdat
> > >
> > > ignored section symbols when comparing symbols in 2 sections.  Since all
> > > references to debugging sections are done with section symbols, symbols
> > > in debugging sections are ignored and we fail to match symbols in comdat
> > > debugging sections.  Also .gnu.debuglto_.debug_* sections aren't treated
> > > as debugging sections.
> > >
> > > 1. Treate .gnu.debuglto_.debug_ section as debugging section unless it
> > > is marked with SHF_EXCLUDE.
> >
> > This part is OK.
> >
> > > 2. Ignore section symbols only when matching non-debugging sections or
> > > linkonce section with comdat section.
> >
> > This part has a problem.  elf_create_symbuf stashes away symbols of
> > interest for an object file, and that set of symbols might be used for
> > multiple invocations of bfd_elf_match_symbols_in_sections.  You can't
> > vary the set of symbols stashed based on section, since that would
> > give the right answer for the first section but possibly wrong answers
> > for subsequent sections.  Any per-section logic must go in
> > bfd_elf_match_symbols_in_sections.
> 
> Here is the v2 patch to revert commit 994b2513281 in elf_create_symbuf
> and put per-section logic in bfd_elf_match_symbols_in_sections.
> 
> OK for master?

Did you test with --reduce-memory-overheads?  I don't see any changes
to bfd_elf_match_symbols_in_sections in code handling that case..

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list