Skip to content

[Test][JITLink] Correctly generate the R_X86_64_PC8 relocation. #109283

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

Merged
merged 1 commit into from
Sep 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions llvm/test/ExecutionEngine/JITLink/x86-64/ELF_R_X86_64_PC8.s
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,5 @@ main:
retq
.size main, .-main

.type P,@object
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for spotting the issue and providing the fix. I'm not sure why loope would make llvm-mc emit relocation and .byte main-. would not. I suggest not to rely on the loope behavior and issue .byte main-. in a different section, e.g. .rodata. I.e. if you insert .rodata before .globl P, it will force llvm-mc to always emit a relocation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion! I fixed it by emitting a byte main - . to the .rodata section.

.globl P
P:
.byte main-. # Generate R_X86_64_PC8 relocation.
.size P, .-P
.rodata
.byte main-. # Generate R_X86_64_PC8 relocation.
Loading