CVSROOT:        /cvs
Module name:    src
Changes by:     clau...@cvs.openbsd.org 2025/09/09 02:41:48

Modified files:
        libexec/ld.so/sparc64: rtld_machine.c 

Log message:
Fix relocation handling for PLT entries with a r_addend

On sparc64 the first 32768 PLT entries use a direct form of relocation
while all other entires afterwards use a PC relative pointer that initally
points at PLT0 and is then fixed up to point at the function. These entries
use the r_addend.
This relocation mode was broken in two ways:
- kbind only modified 32bit of the 64bit pointer
- the offset calculation used the wrong base pointer. It used the address
of the PLT0 entry instead of the object base address.

Introduce a simple _dl_reloc_addend() wrapper which does the calculation
in both the _dl_bind and _dl_md_reloc_all_plt case. Adjust the kbind
calls to update two Elf_Word values so the pointer is swapped by the kernel.
There is still an issue that kbind(2) does not update this 64bit value in
an atomic operation.

This fixes the stage1 gcc15 cc1 and cc1plus binaries that have over 60'000
PLT entries.
With and OK miod@ jca@

Reply via email to