[PATCH] D58636: [BinaryFormat] Update Mach-O ARM64E CPU subtype and dumping
Shoaib Meenai via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 5 13:06:45 PST 2019
smeenai updated this revision to Diff 189391.
smeenai retitled this revision from "[BinaryFormat] Update Mach-O ARM64 CPU subtypes and dumping" to "[BinaryFormat] Update Mach-O ARM64E CPU subtype and dumping".
smeenai edited the summary of this revision.
smeenai added a comment.
Limit to arm64e, since that's all Apple tools appear to support
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58636/new/
https://reviews.llvm.org/D58636
Files:
llvm/include/llvm/BinaryFormat/MachO.h
llvm/test/tools/llvm-objdump/AArch64/Inputs/arm64e.macho.yaml
llvm/test/tools/llvm-objdump/AArch64/macho-arm64e.test
llvm/tools/llvm-objdump/MachODump.cpp
llvm/tools/llvm-readobj/MachODumper.cpp
Index: llvm/tools/llvm-readobj/MachODumper.cpp
===================================================================
--- llvm/tools/llvm-readobj/MachODumper.cpp
+++ llvm/tools/llvm-readobj/MachODumper.cpp
@@ -162,6 +162,7 @@
static const EnumEntry<uint32_t> MachOHeaderCpuSubtypesARM64[] = {
LLVM_READOBJ_ENUM_ENT(MachO, CPU_SUBTYPE_ARM64_ALL),
+ LLVM_READOBJ_ENUM_ENT(MachO, CPU_SUBTYPE_ARM64E),
};
static const EnumEntry<uint32_t> MachOHeaderCpuSubtypesSPARC[] = {
Index: llvm/tools/llvm-objdump/MachODump.cpp
===================================================================
--- llvm/tools/llvm-objdump/MachODump.cpp
+++ llvm/tools/llvm-objdump/MachODump.cpp
@@ -2031,6 +2031,10 @@
outs() << " cputype CPU_TYPE_ARM64\n";
outs() << " cpusubtype CPU_SUBTYPE_ARM64_ALL\n";
break;
+ case MachO::CPU_SUBTYPE_ARM64E:
+ outs() << " cputype CPU_TYPE_ARM64\n";
+ outs() << " cpusubtype CPU_SUBTYPE_ARM64E\n";
+ break;
default:
printUnknownCPUType(cputype, cpusubtype);
break;
@@ -8174,6 +8178,9 @@
case MachO::CPU_SUBTYPE_ARM64_ALL:
outs() << " ALL";
break;
+ case MachO::CPU_SUBTYPE_ARM64E:
+ outs() << " E";
+ break;
default:
outs() << format(" %10d", cpusubtype & ~MachO::CPU_SUBTYPE_MASK);
break;
Index: llvm/test/tools/llvm-objdump/AArch64/macho-arm64e.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-objdump/AArch64/macho-arm64e.test
@@ -0,0 +1,6 @@
+// RUN: yaml2obj %p/Inputs/arm64e.macho.yaml -o %tarm64e.o
+// RUN: llvm-objdump -p %tarm64e.o | FileCheck -strict-whitespace %s
+
+CHECK: Mach header
+CHECK-NEXT: magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
+CHECK-NEXT: MH_MAGIC_64 ARM64 E 0x00 OBJECT 0 0 0x00000000
Index: llvm/test/tools/llvm-objdump/AArch64/Inputs/arm64e.macho.yaml
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-objdump/AArch64/Inputs/arm64e.macho.yaml
@@ -0,0 +1,11 @@
+--- !mach-o
+FileHeader:
+ magic: 0xFEEDFACF
+ cputype: 0x0100000C
+ cpusubtype: 0x00000002
+ filetype: 0x00000001
+ ncmds: 0
+ sizeofcmds: 0
+ flags: 0x00000000
+ reserved: 0x00000000
+...
Index: llvm/include/llvm/BinaryFormat/MachO.h
===================================================================
--- llvm/include/llvm/BinaryFormat/MachO.h
+++ llvm/include/llvm/BinaryFormat/MachO.h
@@ -1477,7 +1477,10 @@
CPU_SUBTYPE_ARM_V7EM = 16
};
-enum CPUSubTypeARM64 { CPU_SUBTYPE_ARM64_ALL = 0 };
+enum CPUSubTypeARM64 {
+ CPU_SUBTYPE_ARM64_ALL = 0,
+ CPU_SUBTYPE_ARM64E = 2,
+};
enum CPUSubTypeSPARC { CPU_SUBTYPE_SPARC_ALL = 0 };
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58636.189391.patch
Type: text/x-patch
Size: 2865 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190305/c3ffdb11/attachment.bin>
More information about the llvm-commits
mailing list