You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
elf: absolute symbols in a shared object get R_*_RELATIVE GOT relocations, so they're rebased at load #200
In a -shared output, a GOT slot for an absolute symbol (SHN_ABS) gets an R_*_RELATIVE dynamic relocation. RELATIVE adds the load base, so at runtime the code reads load_base + value instead of value.
Found by the new aarch64 acceptance leg (#194). It's architecture-general, not aarch64-specific.
Reproduction
Take crates/reld/tests/sources/elf/linker-script-provide/, whose script defines absolute symbols such as PROVIDE(provided_absolute = 0x1000), and link it as a shared object:
x86_64 does the same (-m elf_x86_64): R_X86_64_RELATIVE 1000 / 2000 / 3000 / ffffffff81000000.
Why the x86_64 leg never caught it
linker-script-provide is RunEnabled:false, and it already ignores .dynamic.*, section.got and section.rela.dyn under #13. On x86_64, GOTPCRELX relaxation also turns some of these accesses into lea, which moves the problem off the GOT.
Expected
A GOT slot for an absolute symbol needs no load-relative relocation. Either write the constant with no dynamic relocation (for a non-preemptible absolute symbol), or use a symbol-based GLOB_DAT as lld does (for a preemptible one).
A related question worth settling at the same time: reld binds these PROVIDEd default-visibility symbols locally in a shared object, while lld keeps them preemptible (GLOB_DAT). Decide which is right under -shared without -Bsymbolic.
Acceptance
The reproduction above emits no RELATIVE relocation for any ABS symbol.
A fixture that runs, and reads an absolute PROVIDE symbol through the GOT from a shared object, returns the exact constant.
Activity
test(acceptance): make the aarch64 leg green honestly (#194)
ci(phase1): run wild's ELF suite on x86_64 and aarch64; mark riscv/lo…