forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[llvm][lld] Support R_AARCH64_GOTPCREL32 (llvm#72584)
This is the follopw implementation to ARM-software/abi-aa#223 that supports this relocation in llvm and lld.
- Loading branch information
1 parent
d1f01c0
commit b6d2121
Showing
5 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// REQUIRES: aarch64 | ||
// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o | ||
// RUN: ld.lld %t.o -o %t.so -shared --noinhibit-exec 2>&1 | FileCheck %s --check-prefix=WARN | ||
// RUN: llvm-readelf -S %t.so | FileCheck --check-prefix=SEC %s | ||
// RUN: llvm-objdump --no-print-imm-hex -s -d %t.so | FileCheck %s | ||
|
||
// SEC: .got PROGBITS 0000000000020390 | ||
|
||
.section .data | ||
.globl bar | ||
bar: | ||
|
||
.globl _start | ||
_start: // PC = 0x303a0 | ||
// bar@GOTPCREL = 0x20390 (got entry for `bar`) - 0x303a0 (.) = 0xf0fffeff | ||
// bar@GOTPCREL+4 = 0x20390 (got entry for `bar`) - 0x303a4 (.) + 4 = 0xf0fffeff | ||
// bar@GOTPCREL-4 = 0x20390 (got entry for `bar`) - 0x303a8 (.) - 4 = 0xe4fffeff | ||
// CHECK: Contents of section .data: | ||
// CHECK-NEXT: {{.*}} f0fffeff f0fffeff e4fffeff | ||
.word bar@GOTPCREL | ||
.word bar@GOTPCREL+4 | ||
.word bar@GOTPCREL-4 | ||
|
||
// WARN: relocation R_AARCH64_GOTPCREL32 out of range: {{.*}} is not in [-2147483648, 2147483647]; references 'baz' | ||
// WARN: relocation R_AARCH64_GOTPCREL32 out of range: {{.*}} is not in [-2147483648, 2147483647]; references 'baz' | ||
.word baz@GOTPCREL+0xffffffff | ||
.word baz@GOTPCREL-0xffffffff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// RUN: llvm-mc -triple=aarch64 -filetype=obj %s -o - | \ | ||
// RUN: llvm-readobj -r - | FileCheck %s | ||
|
||
.section .data | ||
this: | ||
.word this@GOTPCREL | ||
.word extern_sym@GOTPCREL+4 | ||
.word negative_offset@GOTPCREL-4 | ||
|
||
// CHECK: Section ({{.*}}) .rela.data | ||
// CHECK-NEXT: 0x0 R_AARCH64_GOTPCREL32 this 0x0 | ||
// CHECK-NEXT: 0x4 R_AARCH64_GOTPCREL32 extern_sym 0x4 | ||
// CHECK-NEXT: 0x8 R_AARCH64_GOTPCREL32 negative_offset 0xFFFFFFFFFFFFFFFC | ||
// CHECK-NEXT: } |