glibc/sysdeps/unix/sysv/linux/arm
Florian Weimer 706209867f elf: Second ld.so relocation only if libc.so has been loaded
Commit 8f8dd904c4 (“elf:
rtld_multiple_ref is always true”) removed some code that happened
to enable compatibility with programs that do not link against
libc.so.  Such programs cannot call dlopen or any dynamic linker
functions (except __tls_get_addr), so this is not really useful.
Still ld.so should not crash with a null-pointer dereference
or undefined symbol reference in these cases.

In the main relocation loop, call _dl_relocate_object unconditionally
because it already checks if the object has been relocated.

If libc.so was loaded, self-relocate ld.so against it and call
__rtld_mutex_init and __rtld_malloc_init_real to activate the full
implementations.  Those are available only if libc.so is there,
so skip these initialization steps if libc.so is absent.  Without
libc.so, the global scope can be completely empty.  This can cause
ld.so self-relocation to fail because if it uses symbol-based
relocations, which is why the second ld.so self-relocation is not
performed if libc.so is missing.

The previous concern regarding GOT updates through self-relocation
no longer applies because function pointers are updated
explicitly through __rtld_mutex_init and __rtld_malloc_init_real,
and not through relocation.  However, the second ld.so self-relocation
is still delayed, in case there are other symbols being used.

Fixes commit 8f8dd904c4 (“elf:
rtld_multiple_ref is always true”).

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-01-07 09:19:01 +01:00
..
be Implement C23 atan2pi 2024-12-12 20:57:44 +00:00
bits Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
le Implement C23 atan2pi 2024-12-12 20:57:44 +00:00
sys Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
Implies
Makefile elf: Second ld.so relocation only if libc.so has been loaded 2025-01-07 09:19:01 +01:00
Versions Linux: Move wordsize-32 Version to default 2023-02-20 10:19:25 -03:00
____longjmp_chk.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
aeabi_read_tp.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
arch-syscall.h Update syscall lists for Linux 6.10 2024-07-30 08:48:51 -03:00
arm-features.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
atomic-machine.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
c++-types.data
clone.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
clone3.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
dl-cache.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
dl-machine.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
dl-procinfo.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
dl-procinfo.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
fixup-asm-unistd.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
getcontext.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
ioperm.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
kernel-features.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
kernel_stat.h linux: Set default kernel_stat.h to LFS 2021-02-11 07:58:05 -03:00
ldsodefs.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
libc-do-syscall.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
libc_sigaction.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
localplt.data arm: Remove ld.so __tls_get_addr plt usage 2024-04-04 17:03:32 -03:00
makecontext.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
profil-counter.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
readelflib.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
setcontext.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
shlib-versions
sigcontextinfo.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
sigrestorer.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
single-thread.h Replace __libc_multiple_threads with __libc_single_threaded 2022-07-05 10:14:47 -03:00
swapcontext.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
syscall.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
syscall_cancel.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
syscalls.list linux: Add prlimit64 C implementation 2021-11-30 13:13:03 -03:00
sysdep.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
sysdep.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
time64-compat.h y2038: Add support for 64-bit time on legacy ABIs 2021-06-15 10:42:11 -03:00
tls.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
ucontext_i.sym
vfork.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
xstatver.h Linux: make generic xstatver.h the default one 2022-12-07 14:40:36 -03:00