elf: Add _dl_find_object function

System Internals / glibc - Florian Weimer [redhat.com] - 28 December 2021 21:52 UTC

It can be used to speed up the libgcc unwinder, and the internal _dl_find_dso_for_object function (which is used for caller identification in dlopen and related functions, and in dladdr).

_dl_find_object is in the internal namespace due to bug 28503. If libgcc switches to _dl_find_object, this namespace issue will be fixed. It is located in libc for two reasons: it is necessary to forward the call to the static libc after static dlopen, and there is a link ordering issue with -static-libgcc and libgcc_eh.a because libc.so is not a linker script that includes ld.so in the glibc build tree (so that GCC's internal -lc after libgcc_eh.a does not pick up ld.so).

It is necessary to do the i386 customization in the sysdeps/x86/bits/dl_find_object.h header shared with x86-64 because otherwise, multilib installations are broken.

The implementation uses software transactional memory, as suggested by Torvald Riegel. Two copies of the supporting data structures are used, also achieving full async-signal-safety.

5d28a8962d elf: Add _dl_find_object function
NEWS | 4 +
bits/dl_find_object.h | 32 +
dlfcn/Makefile | 2 +-
dlfcn/dlfcn.h | 27 +
elf/Makefile | 55 +-
elf/Versions | 3 +
elf/dl-close.c | 4 +
elf/dl-find_object.c | 842 +++++++++++++++++++++
elf/dl-find_object.h | 115 +++
elf/dl-libc_freeres.c | 2 +
elf/dl-open.c | 5 +
elf/dl-support.c | 3 +
elf/libc-dl_find_object.c | 26 +
elf/rtld.c | 11 +
elf/rtld_static_init.c | 1 +
elf/tst-dl_find_object-mod1.c | 10 +
elf/tst-dl_find_object-mod2.c | 15 +
elf/tst-dl_find_object-mod3.c | 10 +
elf/tst-dl_find_object-mod4.c | 10 +
elf/tst-dl_find_object-mod5.c | 11 +
elf/tst-dl_find_object-mod6.c | 11 +
elf/tst-dl_find_object-mod7.c | 10 +
elf/tst-dl_find_object-mod8.c | 10 +
elf/tst-dl_find_object-mod9.c | 10 +
elf/tst-dl_find_object-static.c | 22 +
elf/tst-dl_find_object-threads.c | 275 +++++++
elf/tst-dl_find_object.c | 240 ++++++
include/atomic_wide_counter.h | 14 +
include/bits/dl_find_object.h | 1 +
include/dlfcn.h | 2 +
include/link.h | 3 +
manual/Makefile | 2 +-
manual/dynlink.texi | 137 ++++
manual/libdl.texi | 10 -
manual/probes.texi | 2 +-
manual/threads.texi | 2 +-
sysdeps/arm/bits/dl_find_object.h | 25 +
sysdeps/generic/ldsodefs.h | 5 +
sysdeps/mach/hurd/i386/libc.abilist | 1 +
sysdeps/nios2/bits/dl_find_object.h | 25 +
sysdeps/unix/sysv/linux/aarch64/libc.abilist | 1 +
sysdeps/unix/sysv/linux/alpha/libc.abilist | 1 +
sysdeps/unix/sysv/linux/arc/libc.abilist | 1 +
sysdeps/unix/sysv/linux/arm/be/libc.abilist | 1 +
sysdeps/unix/sysv/linux/arm/le/libc.abilist | 1 +
sysdeps/unix/sysv/linux/csky/libc.abilist | 1 +
sysdeps/unix/sysv/linux/hppa/libc.abilist | 1 +
sysdeps/unix/sysv/linux/i386/libc.abilist | 1 +
sysdeps/unix/sysv/linux/ia64/libc.abilist | 1 +
sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist | 1 +
sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist | 1 +
sysdeps/unix/sysv/linux/microblaze/be/libc.abilist | 1 +
sysdeps/unix/sysv/linux/microblaze/le/libc.abilist | 1 +
.../unix/sysv/linux/mips/mips32/fpu/libc.abilist | 1 +
.../unix/sysv/linux/mips/mips32/nofpu/libc.abilist | 1 +
.../unix/sysv/linux/mips/mips64/n32/libc.abilist | 1 +
.../unix/sysv/linux/mips/mips64/n64/libc.abilist | 1 +
sysdeps/unix/sysv/linux/nios2/libc.abilist | 1 +
.../sysv/linux/powerpc/powerpc32/fpu/libc.abilist | 1 +
.../linux/powerpc/powerpc32/nofpu/libc.abilist | 1 +
.../sysv/linux/powerpc/powerpc64/be/libc.abilist | 1 +
.../sysv/linux/powerpc/powerpc64/le/libc.abilist | 1 +
sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist | 1 +
sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist | 1 +
sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist | 1 +
sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist | 1 +
sysdeps/unix/sysv/linux/sh/be/libc.abilist | 1 +
sysdeps/unix/sysv/linux/sh/le/libc.abilist | 1 +
sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist | 1 +
sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist | 1 +
sysdeps/unix/sysv/linux/x86_64/64/libc.abilist | 1 +
sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist | 1 +
sysdeps/x86/bits/dl_find_object.h | 29 +
73 files changed, 2038 insertions(+), 18 deletions(-)

Upstream: sourceware.org


  • Share