[llvm] 3073a3a - [RelocationResolver] Support R_AARCH64_PREL32
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 17 23:49:59 PDT 2020
Author: Fangrui Song
Date: 2020-07-17T23:49:15-07:00
New Revision: 3073a3aa1ef1ce8c9cac9b97a8e5905dd8779e16
URL: https://github.com/llvm/llvm-project/commit/3073a3aa1ef1ce8c9cac9b97a8e5905dd8779e16
DIFF: https://github.com/llvm/llvm-project/commit/3073a3aa1ef1ce8c9cac9b97a8e5905dd8779e16.diff
LOG: [RelocationResolver] Support R_AARCH64_PREL32
Code from D83800 by Yichao Yu
Added:
llvm/test/DebugInfo/AArch64/eh-frame.ll
Modified:
llvm/lib/Object/RelocationResolver.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Object/RelocationResolver.cpp b/llvm/lib/Object/RelocationResolver.cpp
index 77df7fd0aad9..919799a25c6f 100644
--- a/llvm/lib/Object/RelocationResolver.cpp
+++ b/llvm/lib/Object/RelocationResolver.cpp
@@ -62,6 +62,8 @@ static bool supportsAArch64(uint64_t Type) {
switch (Type) {
case ELF::R_AARCH64_ABS32:
case ELF::R_AARCH64_ABS64:
+ case ELF::R_AARCH64_PREL32:
+ case ELF::R_AARCH64_PREL64:
return true;
default:
return false;
@@ -74,6 +76,10 @@ static uint64_t resolveAArch64(RelocationRef R, uint64_t S, uint64_t A) {
return (S + getELFAddend(R)) & 0xFFFFFFFF;
case ELF::R_AARCH64_ABS64:
return S + getELFAddend(R);
+ case ELF::R_AARCH64_PREL32:
+ return (S + getELFAddend(R) - R.getOffset()) & 0xFFFFFFFF;
+ case ELF::R_AARCH64_PREL64:
+ return S + getELFAddend(R) - R.getOffset();
default:
llvm_unreachable("Invalid relocation type");
}
diff --git a/llvm/test/DebugInfo/AArch64/eh-frame.ll b/llvm/test/DebugInfo/AArch64/eh-frame.ll
new file mode 100644
index 000000000000..9651159271e5
--- /dev/null
+++ b/llvm/test/DebugInfo/AArch64/eh-frame.ll
@@ -0,0 +1,21 @@
+; RUN: llc -filetype=obj -mtriple=aarch64 %s -o %t.o
+; RUN: llvm-readobj -r %t.o | FileCheck %s --check-prefix=REL32
+; RUN: llvm-dwarfdump --eh-frame %t.o 2>&1 | FileCheck %s
+
+; REL32: R_AARCH64_PREL32 .text 0x0
+; REL32-NEXT: R_AARCH64_PREL32 .text 0x4
+
+; CHECK-NOT: warning:
+; CHECK: FDE cie=00000000 pc=00000000...00000004
+;; TODO Take relocation into consideration
+; CHECK: FDE cie=00000000 pc=00000000...00000004
+
+define void @foo() {
+entry:
+ ret void
+}
+
+define void @bar() {
+entry:
+ ret void
+}
More information about the llvm-commits
mailing list