Author: Fangrui Song Date: 2020-07-18T15:22:02-07:00 New Revision: a1f2fd11bde3efe2dd145163be1a7df15d0800d1
URL: https://github.com/llvm/llvm-project/commit/a1f2fd11bde3efe2dd145163be1a7df15d0800d1 DIFF: https://github.com/llvm/llvm-project/commit/a1f2fd11bde3efe2dd145163be1a7df15d0800d1.diff LOG: [RelocationResolver] Support R_AARCH64_PREL32 Code from D83800 by Yichao Yu (cherry picked from commit 3073a3aa1ef1ce8c9cac9b97a8e5905dd8779e16) 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 0058d12dcc87..ad7a50d13bb7 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 +} _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits