static binary, dlopen, and ifunc

H.J. Lu hjl.tools@gmail.com
Fri Nov 13 14:07:51 GMT 2020


On Fri, Nov 13, 2020 at 6:05 AM Samuel Thibault <samuel.thibault@gnu.org> wrote:
>
> H.J. Lu via Libc-alpha, le ven. 13 nov. 2020 05:55:30 -0800, a ecrit:
> > [hjl@gnu-clx-1 lib]$ readelf -d libmachuser.so.1 | head -8
> >
> > Dynamic section at offset 0x15f1c contains 22 entries:
> >   Tag        Type                         Name/Value
> >  0x00000001 (NEEDED)                     Shared library: [libc.so.0.3]
> >
> > libmachuser.so.1 and libhurduser.so.0.3 should have ld.so.1 in DT_NEEDED
> > so that ld.so.1 will always be loaded first.
>
> Ok.
>
> > Please fix your build system.
>
> The build system does pass
>
> -Wl,--as-needed /usr/src/glibc-upstream/build/elf/ld.so -Wl,--no-as-needed
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This is your problem.  Please use

-Wl,--no-as-needed /usr/src/glibc-upstream/build/elf/ld.so

> but since libmachuser itself does not use a symbol from ld.so, that
> doesn't get as a NEEDED, since there the linker doesn't know that
> _rtld_global_ro will actually be needed in order to call the stpncpy
> ifunc selector. I guess I can try to stuff -u _rtld_global_ro in to get
> ld.so really added.
>
> Samuel



-- 
H.J.


More information about the Libc-alpha mailing list