[PATCH] D78032: Default to the "apple-latest" mcpu when disassembling arm64 Mach-O binaries.
Michael Trent via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 13 10:12:16 PDT 2020
mtrent created this revision.
mtrent added reviewers: pete, ab.
Herald added subscribers: rupprecht, MaskRay, kristof.beyls.
Herald added a reviewer: jhenderson.
Herald added a project: LLVM.
This changes the Mach-O dumper to use the "apple-latest" Mcpu value
if one isn't specified by the command-line arguments or by the arch
triple.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D78032
Files:
llvm/test/tools/llvm-objdump/MachO/AArch64/macho-print-mrs.test
llvm/test/tools/llvm-objdump/MachO/apple-latest-default.s
llvm/tools/llvm-objdump/MachODump.cpp
Index: llvm/tools/llvm-objdump/MachODump.cpp
===================================================================
--- llvm/tools/llvm-objdump/MachODump.cpp
+++ llvm/tools/llvm-objdump/MachODump.cpp
@@ -191,7 +191,8 @@
TripleName = TT.str();
}
- if (TT.getArch() == Triple::arm) {
+ Triple::ArchType arch = TT.getArch();
+ if (arch == Triple::arm) {
// We've inferred a 32-bit ARM target from the object file. All MachO CPUs
// that support ARM are also capable of Thumb mode.
Triple ThumbTriple = TT;
@@ -199,6 +200,13 @@
ThumbTriple.setArchName(ThumbName);
ThumbTripleName = ThumbTriple.str();
}
+ else if (arch == Triple::aarch64 ||
+ arch == Triple::aarch64_32) {
+ // We've inferred a 64-bit ARM target. Return "apple-latest" for the
+ // McpuDefault.
+ if (*McpuDefault)
+ *McpuDefault = "apple-latest";
+ }
// Get the target specific parser.
std::string Error;
Index: llvm/test/tools/llvm-objdump/MachO/apple-latest-default.s
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-objdump/MachO/apple-latest-default.s
@@ -0,0 +1,7 @@
+// RUN: llvm-mc -triple arm64-apple-ios -mattr=+apple-a13 -show-encoding \
+// RUN: -filetype=obj %s -o - 2> %t | llvm-objdump -m -d - | FileCheck %s
+
+fmlal V0.2s, v1.2h, v2.h[0]
+
+// CHECK: (__TEXT,__text) section
+// CHECK: 0: 20 00 82 0f fmlal v0, v1, v2[0]
Index: llvm/test/tools/llvm-objdump/MachO/AArch64/macho-print-mrs.test
===================================================================
--- llvm/test/tools/llvm-objdump/MachO/AArch64/macho-print-mrs.test
+++ llvm/test/tools/llvm-objdump/MachO/AArch64/macho-print-mrs.test
@@ -1,3 +1,3 @@
-RUN: llvm-objdump -d -m --no-show-raw-insn %p/Inputs/print-mrs.obj.macho-aarch64 | FileCheck %s
+RUN: llvm-objdump -d -m --no-show-raw-insn --mcpu=cyclone %p/Inputs/print-mrs.obj.macho-aarch64 | FileCheck %s
CHECK: 0: mrs x0, CPM_IOACC_CTL_EL3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78032.257008.patch
Type: text/x-patch
Size: 1979 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200413/c874a153/attachment.bin>
More information about the llvm-commits
mailing list