V2 [PATCH] gold: Get linkonce/comdate sections for debugging sections

H.J. Lu hjl.tools@gmail.com
Sun Nov 29 13:50:05 GMT 2020


On Thu, Nov 26, 2020 at 6:14 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Wed, Nov 25, 2020 at 7:11 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > Sized_relobj_file::map_to_kept_section is used only for relocations in
> > debugging sections.  Get the section index for linkonce section and also
> > check the single comdat section.
> >
> >         PR gold/26937
> >         * object.cc (Sized_relobj_file::map_to_kept_section): Get the
> >         section index for linkonce section.  Also check the single
> >         comdat section.
> > ---
> >  gold/object.cc | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/gold/object.cc b/gold/object.cc
> > index 498e58e2b0..61aed805c2 100644
> > --- a/gold/object.cc
> > +++ b/gold/object.cc
> > @@ -2998,17 +2998,20 @@ Sized_relobj_file<size, big_endian>::map_to_kept_section(
> >          {
> >           // The kept section is a linkonce section.
> >           if (sh_size == kept_section->linkonce_size())
> > -           found = true;
> > +           {
> > +             kept_shndx = kept_section->shndx();
> > +             found = true;
> > +           }
> >          }
> >        else
> >         {
> > +         uint64_t kept_size = 0;
> >           if (is_comdat)
> >             {
> >               // Find the corresponding kept section.
> >               // Since we're using this mapping for relocation processing,
> >               // we don't want to match sections unless they have the same
> >               // size.
> > -             uint64_t kept_size = 0;
> >               if (kept_section->find_comdat_section(section_name, &kept_shndx,
> >                                                     &kept_size))
> >                 {
> > @@ -3016,9 +3019,8 @@ Sized_relobj_file<size, big_endian>::map_to_kept_section(
> >                     found = true;
> >                 }
> >             }
> > -         else
> > +         if (!found)
> >             {
> > -             uint64_t kept_size = 0;
> >               if (kept_section->find_single_comdat_section(&kept_shndx,
> >                                                            &kept_size)
> >                   && sh_size == kept_size)
> > --
> > 2.28.0
> >
>
> Here is the updated patch with 2 tests.  Gold generates incorrect
> debug info.  I will check it in next Monday if there are no objections.
>

I will check it in today.


-- 
H.J.


More information about the Binutils mailing list