This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] ld.so: Support moving versioned symbols between sonames [BZ #24741]
Hi,
Le jeudi 27 juin 2019 à 19:13 +0200, Florian Weimer a écrit :
> * Yann Droneaud:
>
> > > diff --git a/elf/Makefile b/elf/Makefile
> > > index 27a2fa8c14..76b0565054 100644
> > > --- a/elf/Makefile
> > > +++ b/elf/Makefile
> > > @@ -191,7 +191,8 @@ tests += restest1 preloadtest loadfail multiload origtest resolvfail \
> > > tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error tst-noload \
> > > tst-latepthread tst-tls-manydynamic tst-nodelete-dlclose \
> > > tst-debug1 tst-main1 tst-absolute-sym tst-absolute-zero tst-big-note \
> > > - tst-unwind-ctor tst-unwind-main tst-audit13
> > > + tst-unwind-ctor tst-unwind-main tst-audit13 \
> > > + tst-sonamemove tst-sonamemove-dlopen
> >
> > tst-sonamemove could be name tst-sonamemove-link to make obvious the
> > difference with -dlopen.
>
> Good idea.
>
> > > +$(objpfx)tst-sonamemove-dlopen: $(libdl)
> > > +$(objpfx)tst-sonamemove.out: \
> > > + $(objpfx)tst-sonamemove-runmod1.so \
> > > + $(objpfx)tst-sonamemove-runmod2.so
> > > +
> >
> > The last three lines duplicate those above.
>
> Fixed.
>
> > > +/* moved_function is linked against tst-sonamemove-runmod1.so, but the
> > > + actual implementation is in tst-sonamemove-runmod1.so. */
> >
> > I found this comment unclear. tst-sonamemove is linked against tst-
> > sonamemove-linkmod1.so, which has tst-sonamemove-runmod1.so soname.
> > When tst-sonamemove is run, tst-sonamemove-runmod1.so is loaded, which
> > imply loading tst-sonamemove-runmod2.so as a dependency. tst-
> > sonamemove-runmod2.so is where move_function's implementation is.
>
> I tried to explain this more explictly:
>
> /* At link time, moved_function is bound to the symbol version
> SONAME_MOVE in tst-sonamemove-runmod1.so, using the
> tst-sonamemove-linkmod1.so stub object.
>
> At run time, the process loads the real tst-sonamemove-runmod1.so,
> which depends on tst-sonamemove-runmod2.so.
> tst-sonamemove-runmod1.so does not define moved_function, but
> tst-sonamemove-runmod2.so does.
>
> The net effect is that the versioned symbol
> moved_function@SONAME_MOVE moved from the soname
> tst-sonamemove-linkmod1.so at link time to the soname
> tst-sonamemove-linkmod2.so at run time. */
>
Thanks.
LGTM.
Reviewed-by: Yann Droneaud <ydroneaud@opteya.com>
Regards.
--
Yann Droneaud
OPTEYA