static binary, dlopen, and ifunc

Samuel Thibault samuel.thibault@gnu.org
Fri Nov 13 14:05:17 GMT 2020


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

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


More information about the Libc-alpha mailing list