[PATCH] D112843: [aarch64/mac] Correctly disassemble @TLVPPAGE(OFF) relocs
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 9 13:52:04 PST 2021
thakis updated this revision to Diff 385965.
thakis marked an inline comment as done.
thakis added a comment.
tweak test
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112843/new/
https://reviews.llvm.org/D112843
Files:
llvm/lib/Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp
llvm/test/MC/AArch64/arm64-tls-modifiers-darwin.s
llvm/test/tools/llvm-objdump/MachO/Inputs/macho-tlv.o
llvm/test/tools/llvm-objdump/MachO/disassemble-arm64-tlv-modifers.s
Index: llvm/test/tools/llvm-objdump/MachO/disassemble-arm64-tlv-modifers.s
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-objdump/MachO/disassemble-arm64-tlv-modifers.s
@@ -0,0 +1,20 @@
+; RUN: llvm-mc -triple=arm64-apple-ios7.0 -filetype=obj %s -o %t.o
+
+adrp x2, _var at TLVPPAGE
+ldr x0, [x15, _var at TLVPPAGEOFF]
+add x30, x0, _var at TLVPPAGEOFF
+
+; RUN: llvm-objdump -rd %t.o | FileCheck %s --check-prefix=CHECK-OBJDUMP
+; RUN: llvm-objdump --macho -d --full-leading-addr --no-show-raw-insn %t.o \
+; RUN: | FileCheck %s --check-prefix=CHECK-MACHO
+
+; CHECK-OBJDUMP: adrp x2, 0x0
+; CHECK-OBJDUMP-NEXT: 0: ARM64_RELOC_TLVP_LOAD_PAGE21 _var
+; CHECK-OBJDUMP-NEXT: ldr x0, [x15]
+; CHECK-OBJDUMP-NEXT: 4: ARM64_RELOC_TLVP_LOAD_PAGEOFF12 _var
+; CHECK-OBJDUMP-NEXT: add x30, x0, #0
+; CHECK-OBJDUMP-NEXT: 8: ARM64_RELOC_TLVP_LOAD_PAGEOFF12 _var
+
+; CHECK-MACHO: 0000000000000000 adrp x2, _var at TLVPPAGE
+; CHECK-MACHO-NEXT: 0000000000000004 ldr x0, [x15, _var at TLVPPAGEOFF]
+; CHECK-MACHO-NEXT: 0000000000000008 add x30, x0, _var at TLVPPAGEOFF
Index: llvm/test/MC/AArch64/arm64-tls-modifiers-darwin.s
===================================================================
--- llvm/test/MC/AArch64/arm64-tls-modifiers-darwin.s
+++ llvm/test/MC/AArch64/arm64-tls-modifiers-darwin.s
@@ -1,5 +1,4 @@
; RUN: llvm-mc -triple=arm64-apple-ios7.0 %s -o - | FileCheck %s
-; RUN: llvm-mc -triple=arm64-apple-ios7.0 -filetype=obj %s -o - | llvm-objdump -r - | FileCheck %s --check-prefix=CHECK-OBJ
adrp x2, _var at TLVPPAGE
ldr x0, [x15, _var at TLVPPAGEOFF]
@@ -7,7 +6,3 @@
; CHECK: adrp x2, _var at TLVPPAG
; CHECK: ldr x0, [x15, _var at TLVPPAGEOFF]
; CHECK: add x30, x0, _var at TLVPPAGEOFF
-
-; CHECK-OBJ: 8 ARM64_RELOC_TLVP_LOAD_PAGEOFF12 _var
-; CHECK-OBJ: 4 ARM64_RELOC_TLVP_LOAD_PAGEOFF12 _var
-; CHECK-OBJ: 0 ARM64_RELOC_TLVP_LOAD_PAGE21 _var
Index: llvm/lib/Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp
===================================================================
--- llvm/lib/Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp
+++ llvm/lib/Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp
@@ -34,7 +34,9 @@
case LLVMDisassembler_VariantKind_ARM64_GOTPAGEOFF:
return MCSymbolRefExpr::VK_GOTPAGEOFF;
case LLVMDisassembler_VariantKind_ARM64_TLVP:
+ return MCSymbolRefExpr::VK_TLVPPAGE;
case LLVMDisassembler_VariantKind_ARM64_TLVOFF:
+ return MCSymbolRefExpr::VK_TLVPPAGEOFF;
default:
llvm_unreachable("bad LLVMDisassembler_VariantKind");
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112843.385965.patch
Type: text/x-patch
Size: 2592 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211109/dc11c446/attachment.bin>
More information about the llvm-commits
mailing list