[PATCH] D85041: [llvm-libtool-darwin] Add constant CPU_TYPE_ARM64_V8
Sameer Arora via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 31 12:07:46 PDT 2020
sameerarora101 created this revision.
sameerarora101 added reviewers: jhenderson, alexshap, Ktwu, smeenai.
Herald added subscribers: llvm-commits, danielkiss, rupprecht, kristof.beyls.
Herald added a reviewer: MaskRay.
Herald added a project: LLVM.
sameerarora101 requested review of this revision.
Add support for constant MachO::CPU_SUBTYPE_ARM64_V8. This constant is
needed so as to match `llvm-libtool-darwin`'s behavior to that of
cctools' libtool when `-arch_only` flag is passed in on command line.
Here is the diff of `llvm-libtool-darwin` adding `arch_only` option for
reference: https://reviews.llvm.org/D84770.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D85041
Files:
llvm/include/llvm/BinaryFormat/MachO.h
llvm/test/tools/llvm-objdump/MachO/AArch64/Inputs/arm64_v8.macho.yaml
llvm/test/tools/llvm-objdump/MachO/AArch64/macho-arm64-v8.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
@@ -161,8 +161,9 @@
};
static const EnumEntry<uint32_t> MachOHeaderCpuSubtypesARM64[] = {
- LLVM_READOBJ_ENUM_ENT(MachO, CPU_SUBTYPE_ARM64_ALL),
- LLVM_READOBJ_ENUM_ENT(MachO, CPU_SUBTYPE_ARM64E),
+ LLVM_READOBJ_ENUM_ENT(MachO, CPU_SUBTYPE_ARM64_ALL),
+ LLVM_READOBJ_ENUM_ENT(MachO, CPU_SUBTYPE_ARM64_V8),
+ 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
@@ -2109,6 +2109,10 @@
outs() << " cputype CPU_TYPE_ARM64\n";
outs() << " cpusubtype CPU_SUBTYPE_ARM64_ALL\n";
break;
+ case MachO::CPU_SUBTYPE_ARM64_V8:
+ outs() << " cputype CPU_TYPE_ARM64\n";
+ outs() << " cpusubtype CPU_SUBTYPE_ARM64_V8\n";
+ break;
case MachO::CPU_SUBTYPE_ARM64E:
outs() << " cputype CPU_TYPE_ARM64\n";
outs() << " cpusubtype CPU_SUBTYPE_ARM64E\n";
@@ -8315,6 +8319,9 @@
case MachO::CPU_SUBTYPE_ARM64_ALL:
outs() << " ALL";
break;
+ case MachO::CPU_SUBTYPE_ARM64_V8:
+ outs() << " V8";
+ break;
case MachO::CPU_SUBTYPE_ARM64E:
outs() << " E";
break;
Index: llvm/test/tools/llvm-objdump/MachO/AArch64/macho-arm64-v8.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-objdump/MachO/AArch64/macho-arm64-v8.test
@@ -0,0 +1,6 @@
+// RUN: yaml2obj %p/Inputs/arm64_v8.macho.yaml -o %tarm-v8.o
+// RUN: llvm-objdump -p %tarm-v8.o | FileCheck --strict-whitespace %s
+
+CHECK: Mach header
+CHECK-NEXT: magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
+CHECK-NEXT: MH_MAGIC_64 ARM64 V8 0x00 OBJECT 0 0 0x00000000
Index: llvm/test/tools/llvm-objdump/MachO/AArch64/Inputs/arm64_v8.macho.yaml
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-objdump/MachO/AArch64/Inputs/arm64_v8.macho.yaml
@@ -0,0 +1,11 @@
+--- !mach-o
+FileHeader:
+ magic: 0xFEEDFACF
+ cputype: 0x0100000C
+ cpusubtype: 0x00000001
+ 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
@@ -1492,6 +1492,7 @@
enum CPUSubTypeARM64 {
CPU_SUBTYPE_ARM64_ALL = 0,
+ CPU_SUBTYPE_ARM64_V8 = 1,
CPU_SUBTYPE_ARM64E = 2,
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85041.282295.patch
Type: text/x-patch
Size: 3014 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200731/d1cea8a5/attachment.bin>
More information about the llvm-commits
mailing list