Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[英雄贴] Binutils: Remove orphan GOT entries in relaxation #58

Open
xry111 opened this issue Jul 7, 2024 · 2 comments
Open

[英雄贴] Binutils: Remove orphan GOT entries in relaxation #58

xry111 opened this issue Jul 7, 2024 · 2 comments
Labels
AREA: Toolchain 英雄帖 Volunteers welcome!

Comments

@xry111
Copy link
Member

xry111 commented Jul 7, 2024

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.

Note that x86 BFD linker is able to remove the orphan GOT entry when relaxing movq to leaq in this example:

.data
x: .4byte 114514

.text
f:
movq x@GOTPCREL(%rip), %rax
ret
@xry111
Copy link
Member Author

xry111 commented Jul 8, 2024

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.

@xen0n xen0n added 英雄帖 Volunteers welcome! AREA: Toolchain labels Jul 16, 2024
@xen0n
Copy link
Member

xen0n commented Nov 16, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AREA: Toolchain 英雄帖 Volunteers welcome!
Projects
None yet
Development

No branches or pull requests

2 participants