[llvm] db259fe - [llvm-readobj] Fix arm64 unwind opcode disassembly printing
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 25 23:38:33 PDT 2020
Author: Martin Storsjö
Date: 2020-08-26T09:38:11+03:00
New Revision: db259fe38b89b6987c9c4ec61a7cd7d8a0429b85
URL: https://github.com/llvm/llvm-project/commit/db259fe38b89b6987c9c4ec61a7cd7d8a0429b85
DIFF: https://github.com/llvm/llvm-project/commit/db259fe38b89b6987c9c4ec61a7cd7d8a0429b85.diff
LOG: [llvm-readobj] Fix arm64 unwind opcode disassembly printing
Add a missing minus, fix vertical alignment of instructions for one opcode.
Differential Revision: https://reviews.llvm.org/D86523
Added:
llvm/test/tools/llvm-readobj/COFF/arm64-unwind-opcodes.s
Modified:
llvm/test/CodeGen/AArch64/wineh5.mir
llvm/tools/llvm-readobj/ARMWinEHPrinter.cpp
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/AArch64/wineh5.mir b/llvm/test/CodeGen/AArch64/wineh5.mir
index 1280997fbb3c..6fe6b66fc2e5 100644
--- a/llvm/test/CodeGen/AArch64/wineh5.mir
+++ b/llvm/test/CodeGen/AArch64/wineh5.mir
@@ -15,7 +15,7 @@
# CHECK-NEXT: 0xe3 ; nop
# CHECK-NEXT: 0xe3 ; nop
# CHECK-NEXT: 0x42 ; stp x29, x30, [sp, #16]
-# CHECK-NEXT: 0xd53f ; str x28, [sp, #256]!
+# CHECK-NEXT: 0xd53f ; str x28, [sp, #-256]!
# CHECK-NEXT: 0xe4 ; end
# CHECK-NEXT: ]
# CHECK-NEXT: EpilogueScopes [
diff --git a/llvm/test/tools/llvm-readobj/COFF/arm64-unwind-opcodes.s b/llvm/test/tools/llvm-readobj/COFF/arm64-unwind-opcodes.s
new file mode 100644
index 000000000000..98e2da8fb226
--- /dev/null
+++ b/llvm/test/tools/llvm-readobj/COFF/arm64-unwind-opcodes.s
@@ -0,0 +1,24 @@
+// REQUIRES: aarch64-registered-target
+// RUN: llvm-mc -filetype=obj -triple aarch64-windows %s -o - \
+// RUN: | llvm-readobj --unwind - | FileCheck %s
+
+// CHECK: Prologue [
+// CHECK-NEXT: 0xdc01 ; str d8, [sp, #8]
+// CHECK-NEXT: 0xd400 ; str x19, [sp, #-8]!
+// CHECK-NEXT: 0xe4 ; end
+// CHECK-NEXT: ]
+
+.section .pdata,"dr"
+ .long func at IMGREL
+ .long "$unwind$func"@IMGREL
+
+ .text
+ .globl func
+func:
+ str x19, [sp, #-8]!
+ str d8, [sp, #8]
+ ret
+
+.section .xdata,"dr"
+"$unwind$func":
+.long 0x10000002, 0x00d401dc, 0xe3e3e3e4
diff --git a/llvm/tools/llvm-readobj/ARMWinEHPrinter.cpp b/llvm/tools/llvm-readobj/ARMWinEHPrinter.cpp
index 8f365c5ad082..b7811171081a 100644
--- a/llvm/tools/llvm-readobj/ARMWinEHPrinter.cpp
+++ b/llvm/tools/llvm-readobj/ARMWinEHPrinter.cpp
@@ -637,7 +637,7 @@ bool Decoder::opcode_save_reg_x(const uint8_t *OC, unsigned &Offset,
Reg += 19;
uint32_t Off = ((OC[Offset + 1] & 0x1F) + 1) << 3;
if (Prologue)
- SW.startLine() << format("0x%02x%02x ; str x%u, [sp, #%u]!\n",
+ SW.startLine() << format("0x%02x%02x ; str x%u, [sp, #-%u]!\n",
OC[Offset], OC[Offset + 1], Reg, Off);
else
SW.startLine() << format("0x%02x%02x ; ldr x%u, [sp], #%u\n",
@@ -703,7 +703,7 @@ bool Decoder::opcode_save_freg(const uint8_t *OC, unsigned &Offset,
Reg >>= 6;
Reg += 8;
uint32_t Off = (OC[Offset + 1] & 0x3F) << 3;
- SW.startLine() << format("0x%02x%02x ; %s d%u, [sp, #%u]\n",
+ SW.startLine() << format("0x%02x%02x ; %s d%u, [sp, #%u]\n",
OC[Offset], OC[Offset + 1],
static_cast<const char *>(Prologue ? "str" : "ldr"),
Reg, Off);
More information about the llvm-commits
mailing list