Skip to content

Commit 953dbfa

Browse files
committed
[JITLink] Correctly generate the R_X86_64_PC8 relocation.
Previously, ELF_R_X86_64_PC8.s doesn't produce the R_X86_64_PC8 relocation. This patch helps fix it by emitting a byte `main - .` to the .rodata section. Before: ``` llvm-mc -triple=x86_64-unknown-linux -position-independent -filetype=obj -o - ELF_R_X86_64_PC8.s | llvm-readobj -r - File: <stdin> Format: elf64-x86-64 Arch: x86_64 AddressSize: 64bit LoadName: <Not found> Relocations [ ] ``` After: ``` llvm-mc -triple=x86_64-unknown-linux -position-independent -filetype=obj -o - ELF_R_X86_64_PC8.s | llvm-readobj -r - File: <stdin> Format: elf64-x86-64 Arch: x86_64 AddressSize: 64bit LoadName: <Not found> Relocations [ Section (4) .rela.rodata { 0x0 R_X86_64_PC8 main 0x0 } ] ```
1 parent f1ff3a2 commit 953dbfa

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

llvm/test/ExecutionEngine/JITLink/x86-64/ELF_R_X86_64_PC8.s

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,5 @@ main:
1212
retq
1313
.size main, .-main
1414

15-
.type P,@object
16-
.globl P
17-
P:
18-
.byte main-. # Generate R_X86_64_PC8 relocation.
19-
.size P, .-P
15+
.rodata
16+
.byte main-. # Generate R_X86_64_PC8 relocation.

0 commit comments

Comments
 (0)