static binary, dlopen, and ifunc

Samuel Thibault samuel.thibault@gnu.org
Fri Nov 13 14:19:34 GMT 2020


H.J. Lu via Libc-alpha, le ven. 13 nov. 2020 06:07:51 -0800, a ecrit:
> 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

This is coming from /Makerules

# Compiler arguments to use to link a shared object with libc and
# ld.so.  This is intended to be as similar as possible to a default
# link with an installed libc.
link-libc-args = -Wl,--start-group \
                 $(libc-for-link) \
                 $(common-objpfx)libc_nonshared.a \
                 -Wl,--as-needed $(elf-objpfx)ld.so -Wl,--no-as-needed \
                 -Wl,--end-group

Do we want to use no-as-needed globally there?

That being said, even with no-as-needed, and libmachuser getting a
NEEDED:

€ objdump -x mach/libmachuser.so | grep NEED
  NEEDED               libc.so.0.3
  NEEDED               ld.so.1

I am still facing exactly the same issue.

Samuel


More information about the Libc-alpha mailing list