HomeFreeBSD

rtld-elf: Fix dlsym(3) for TLS symbols on PowerPC and RISC-V

Description

rtld-elf: Fix dlsym(3) for TLS symbols on PowerPC and RISC-V

The implementation here is meant to mirror what a GOT entry for the
given symbol would use for ti_offset. However, on PowerPC and RISC-V,
TLS_DTV_OFFSET is non-zero, and so the GOT entries are normally biased
by this, but we fail to do so here. As a result we end up getting a
pointer TLS_DTV_OFFSET past where the variable actually is.

(Note this also applies to MIPS on stable/13)

Reviewed by: kib
Fixes: 5ceeeba90c6c ("Import DragonFly BSD commit")
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D50183

Details

Provenance
jrtc27Authored on May 6 2025, 10:14 PM
Reviewer
kib
Differential Revision
D50183: rtld-elf: Fix dlsym(3) for TLS symbols on PowerPC and RISC-V
Parents
rG78b99f369f75: libc: Fix dl_iterate_phdr's dlpi_tls_data for PowerPC and RISC-V
Branches
Unknown
Tags
Unknown