This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][1/2] Early LTO debug, simple-object part


On Mon, 14 Aug 2017, Ian Lance Taylor wrote:

> On Mon, Aug 14, 2017 at 6:17 AM, Richard Biener <rguenther@suse.de> wrote:
> > On Fri, 4 Aug 2017, Richard Biener wrote:
> >
> >> On Fri, 28 Jul 2017, Jason Merrill wrote:
> >>
> >> > On 07/28/2017 05:55 PM, Jason Merrill wrote:
> >> > > On Fri, Jul 28, 2017 at 8:54 AM, Richard Biener <rguenther@suse.de> wrote:
> >> > > > On Tue, 4 Jul 2017, Richard Biener wrote:
> >> > > >
> >> > > > > On Tue, 20 Jun 2017, Richard Biener wrote:
> >> > > > >
> >> > > > > > On Wed, 7 Jun 2017, Richard Biener wrote:
> >> > > > > >
> >> > > > > > > On Fri, 19 May 2017, Richard Biener wrote:
> >> > > > > > >
> >> > > > > > > >
> >> > > > > > > > This is a repost (unchanged) of the simple-object ELF support for
> >> > > > > > > > early LTO debug transfer from IL object to a separate debug-only
> >> > > > > > > > object
> >> > > > > > > > file.
> >> > > > > > > >
> >> > > > > > > > Bootstrapped and tested on x86_64-unknown-linux-gnu.
> >> > > > > > >
> >> > > > > > > Ping.
> >> > > > > >
> >> > > > > > Ping^2.
> >> > > > >
> >> > > > > Ping^3.
> >> > > >
> >> > > > Ping^4.  Adding some more global reviewers to CC.
> >> > >
> >> > > Looking at it now, sorry for the delay.
> >> >
> >> > Actually, the simple-object stuff is more Ian's area.  Looking at the other
> >> > part.
> >>
> >> Ian, ping -- we're through with the other part
> >> (https://gcc.gnu.org/ml/gcc-patches/2017-08/msg00374.html).  The
> >> simple-object part is unchanged at
> >>
> >> https://gcc.gnu.org/ml/gcc-patches/2017-05/msg01541.html
> >>
> >> nearly unchanged from the post last year (which also includes
> >> some description):
> >>
> >> https://gcc.gnu.org/ml/gcc-patches/2016-09/msg01292.html
> >
> > Ian, ping again!  (trying now also with the e-mail listed in
> > MAINTAINERS)
> >
> > https://gcc.gnu.org/ml/gcc-patches/2017-05/msg01541.html
> 
> Sorry about that, for some reason GMail didn't flag this message for me.
> 
> 
> > +  for (ent = buf + entsize; ent < buf + length; ent += entsize)
> > +    {
> > +      unsigned sec = type_functions->fetch_Elf_Word (ent);
> > +      if (pfnret[sec - 1] == 0)
> > +         keep = 1;
> > +    }
> > +  if (keep)
> > +    {
> > +      pfnret[sh_link - 1] = 0;
> > +      pfnret[i - 1] = 0;
> > +    }
> > + }
> 
> It seems to me that if you keep any section of an SHT_GROUP, you need
> to keep all the sections.  Otherwise the section indexes in the group
> will be left dangling.

Note that all sections are "kept", removed sections are just marked
as SHT_NULL.  Which means that indeed some group members might
be SHT_NULL.

Note that I don't remember if I actually run into any SHT_GROUP
member being necessary when another is not (IIRC this was with
debug types sections or so).  I'll double-check and add a comment
where this matters for early-debug (the simple-object code tries
to be more generic but obviously all testing was done with
early-debug section copying in mind).

> The symbol table handling is pretty awful.  Can't you just remove the
> symbols you don't want?  You will have to update the sh_info field of
> the SHT_SYMTAB section, which holds the index of the first STB_GLOBAL
> symbol in the table.

Maybe that's what I was missing, let me see if I can make it work.
It looks like if there's no STB_GLOBAL symbol the index is one after
the last symbol and it seems it is the first ! STB_LOCAL symbol
("One greater than the symbol table index of the last local symbol 
(binding STB_LOCAL)").

Ah, and implementing this now I remember why I chose the "awkward"
way.  This was to preserve symtab indices to not need to rewrite
relocation sections...  There isn't a documented way to make
an "none" symtab entry (eventually duplicating UND might work
but IIRC it messes up ordering as UND is STB_LOCAL and thus may
not appear after the first ! STB_LOCAL symbol).  As comments in
the code indicate I tried to mangle things in a way that makes
both GNU ld and gold happy...

Any suggestion how to improve things when not removing symbols?
(I could of course remove things from the end of the symtab)
Like replacing local symbols with UND and globals with
a COMMON of zero size (and no name)?

I suppose rewriting relocation sections is possible but I tried
to do as little as necessary (like not actually removing sections).

Thanks,
Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]