Open xry111 opened 4 months ago
For
.p2align 2 f: la.got $a0, x ret .data .p2align 2 .globl x .hidden x x: .4byte 114514
The linker is able to relax la.got to la.pcrel or even pcaddi, but the GOT entry for x still exists.
la.got
la.pcrel
pcaddi
Note that x86 BFD linker is able to remove the orphan GOT entry when relaxing movq to leaq in this example:
movq
leaq
.data x: .4byte 114514 .text f: movq x@GOTPCREL(%rip), %rax ret
Also note that if we remove
.globl x .hidden x
from the test case, the relaxation still should happen but in reality it doesn't. It seems better to resolve both issues at once.
More info: https://sourceware.org/pipermail/binutils/2024-November/137658.html
For
The linker is able to relax
la.got
tola.pcrel
or evenpcaddi
, but the GOT entry for x still exists.Note that x86 BFD linker is able to remove the orphan GOT entry when relaxing
movq
toleaq
in this example: