V2 [PATCH] rtld: Get architecture specific initializer in rtld_global

H.J. Lu hjl.tools@gmail.com
Sat May 16 18:24:13 GMT 2020


On Sat, May 16, 2020 at 11:07 AM Florian Weimer <fw@deneb.enyo.de> wrote:
>
> * H. J. Lu:
>
> > On Sat, May 16, 2020 at 10:52 AM Florian Weimer <fw@deneb.enyo.de> wrote:
> >>
> >> * H. J. Lu via Libc-alpha:
> >>
> >> > Include <dl-procruntime.c> to get architecture specific initializer in
> >> > rtld_global.
> >> > ---
> >> >  elf/rtld.c | 2 ++
> >> >  1 file changed, 2 insertions(+)
> >> >
> >> > diff --git a/elf/rtld.c b/elf/rtld.c
> >> > index 0016db86a7..44b9fb0b3c 100644
> >> > --- a/elf/rtld.c
> >> > +++ b/elf/rtld.c
> >> > @@ -315,6 +315,8 @@ rtld_hidden_def (_dl_starting_up)
> >> >     (except those which cannot be added for some reason).  */
> >> >  struct rtld_global _rtld_global =
> >> >    {
> >> > +    /* Get architecture specific initializer.  */
> >> > +#include <dl-procruntime.c>
> >> >      /* Generally the default presumption without further information is an
> >> >       * executable stack but this is not true for all platforms.  */
> >> >      ._dl_stack_flags = DEFAULT_STACK_PERMS,
> >>
> >> This patch does not build on its own.  I'm surprised that it works in
> >> combination with the third patch.
> >
> > It should build.
>
> It doesn't if I do not apply the third patch.

Fixed.

> >> Is _rtld_global really the right place for this data?  Is it even
> >> needed from outside the dynamic loader?
> >
> > Yes,  it matches:
> >
> > struct rtld_global
> > {
> > ...
> > #include <dl-procruntime.c>
> > ...
> > };
> >
> > in sysdeps/generic/ldsodefs.h.
>
> I mean conceptually—it's not clear to me why these fields have to be
> in _rtld_global.  It makes things harder to maintain.  Sorry, this is
> a more general question, it's not about the patch itself.

What is the alternative?  These fields are initialized very early
and don't change after it.

Here is the updated patch.  OK for master?

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-rtld-Get-architecture-specific-initializer-in-rtld_g.patch
Type: text/x-patch
Size: 1343 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20200516/6da179ee/attachment.bin>


More information about the Libc-alpha mailing list