We can trust the use of _dl_lookup_symbol_x
during elf_machine_runtime_setup
in SHARED
is safe
These discussions are based on recent glibc commit a4c414796a.
I know it's hard to prove _dl_lookup_symbol_x
being called at elf_machine_runtime_setup
without l_relocated == 1
when we have #ifdef SHARED
is safe. But if we trust another place it is being called is safe, and there is no change for the requested data structure between these 2 times , then it's natural to trust we call it here is safe.
We can prove this by debugging lib/ld-linux-riscv64-lp64d.so.1
in gdb. First, compile glibc commit a4c414796a with && l->l_relocated
removed in sysdeps/riscv/dl-machines.h
.