forked from OSchip/llvm-project
[llvm-libtool-darwin] Add constant CPU_SUBTYPE_ARM64_V8
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. Reviewed by jhenderson, alexshap, smeenai Differential Revision: https://reviews.llvm.org/D85041
This commit is contained in:
parent
7547508b7a
commit
645de3664a
|
@ -1492,6 +1492,7 @@ enum CPUSubTypeARM {
|
|||
|
||||
enum CPUSubTypeARM64 {
|
||||
CPU_SUBTYPE_ARM64_ALL = 0,
|
||||
CPU_SUBTYPE_ARM64_V8 = 1,
|
||||
CPU_SUBTYPE_ARM64E = 2,
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
# RUN: yaml2obj %s -o %tarm64-all.o -DSUBTYPE=0x0
|
||||
# RUN: llvm-objdump -p %tarm64-all.o | FileCheck --strict-whitespace %s --check-prefixes="COMMON,ALL"
|
||||
|
||||
# RUN: yaml2obj %s -o %tarm64-v8.o -DSUBTYPE=0x1
|
||||
# RUN: llvm-objdump -p %tarm64-v8.o | FileCheck --strict-whitespace %s --check-prefixes="COMMON,V8"
|
||||
|
||||
# RUN: yaml2obj %s -o %tarm64e.o -DSUBTYPE=0x2
|
||||
# RUN: llvm-objdump -p %tarm64e.o | FileCheck --strict-whitespace %s --check-prefixes="COMMON,E"
|
||||
|
||||
# COMMON: Mach header
|
||||
# COMMON-NEXT: magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
|
||||
# ALL-NEXT: MH_MAGIC_64 ARM64 ALL 0x00 OBJECT 0 0 0x00000000
|
||||
# V8-NEXT: MH_MAGIC_64 ARM64 V8 0x00 OBJECT 0 0 0x00000000
|
||||
# E-NEXT: MH_MAGIC_64 ARM64 E 0x00 OBJECT 0 0 0x00000000
|
||||
|
||||
--- !mach-o
|
||||
FileHeader:
|
||||
magic: 0xFEEDFACF
|
||||
cputype: 0x0100000C
|
||||
cpusubtype: [[SUBTYPE]]
|
||||
filetype: 0x00000001
|
||||
ncmds: 0
|
||||
sizeofcmds: 0
|
||||
flags: 0x00000000
|
||||
reserved: 0x00000000
|
||||
...
|
|
@ -1,6 +0,0 @@
|
|||
// 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
|
|
@ -0,0 +1,85 @@
|
|||
## This test checks that the CPUTypes are printed correctly for the subtypes of
|
||||
## ARM64.
|
||||
|
||||
# RUN: yaml2obj %s -o %tarm.o
|
||||
# RUN: llvm-objdump %tarm.o --universal-headers --macho | \
|
||||
# RUN: FileCheck %s --match-full-lines
|
||||
|
||||
# CHECK: Fat headers
|
||||
# CHECK-NEXT: fat_magic FAT_MAGIC
|
||||
# CHECK-NEXT: nfat_arch 3
|
||||
# CHECK-NEXT: architecture arm64
|
||||
# CHECK-NEXT: cputype CPU_TYPE_ARM64
|
||||
# CHECK-NEXT: cpusubtype CPU_SUBTYPE_ARM64_ALL
|
||||
# CHECK-NEXT: capabilities 0x0
|
||||
# CHECK-NEXT: offset 4096
|
||||
# CHECK-NEXT: size 352
|
||||
# CHECK-NEXT: align 2^12 (4096)
|
||||
# CHECK-NEXT: architecture
|
||||
# CHECK-NEXT: cputype CPU_TYPE_ARM64
|
||||
# CHECK-NEXT: cpusubtype CPU_SUBTYPE_ARM64_V8
|
||||
# CHECK-NEXT: capabilities 0x0
|
||||
# CHECK-NEXT: offset 16384
|
||||
# CHECK-NEXT: size 384
|
||||
# CHECK-NEXT: align 2^14 (16384)
|
||||
# CHECK-NEXT: architecture
|
||||
# CHECK-NEXT: cputype CPU_TYPE_ARM64
|
||||
# CHECK-NEXT: cpusubtype CPU_SUBTYPE_ARM64E
|
||||
# CHECK-NEXT: capabilities 0x0
|
||||
# CHECK-NEXT: offset 28672
|
||||
# CHECK-NEXT: size 384
|
||||
# CHECK-NEXT: align 2^12 (4096)
|
||||
# CHECK-NOT:{{.}}
|
||||
|
||||
--- !fat-mach-o
|
||||
FatHeader:
|
||||
magic: 0xCAFEBABE
|
||||
nfat_arch: 3
|
||||
FatArchs:
|
||||
- cputype: 0x0100000C
|
||||
cpusubtype: 0x00000000
|
||||
offset: 0x0000000000001000
|
||||
size: 352
|
||||
align: 12
|
||||
- cputype: 0x0100000C
|
||||
cpusubtype: 0x00000001
|
||||
offset: 0x0000000000004000
|
||||
size: 384
|
||||
align: 14
|
||||
- cputype: 0x0100000C
|
||||
cpusubtype: 0x00000002
|
||||
offset: 0x0000000000007000
|
||||
size: 384
|
||||
align: 12
|
||||
Slices:
|
||||
- !mach-o
|
||||
FileHeader:
|
||||
magic: 0xFEEDFACF
|
||||
cputype: 0x0100000C
|
||||
cpusubtype: 0x00000000
|
||||
filetype: 0x00000001
|
||||
ncmds: 0
|
||||
sizeofcmds: 0
|
||||
flags: 0x00000000
|
||||
reserved: 0x00000000
|
||||
- !mach-o
|
||||
FileHeader:
|
||||
magic: 0xFEEDFACF
|
||||
cputype: 0x0100000C
|
||||
cpusubtype: 0x00000001
|
||||
filetype: 0x00000001
|
||||
ncmds: 0
|
||||
sizeofcmds: 0
|
||||
flags: 0x00000000
|
||||
reserved: 0x00000000
|
||||
- !mach-o
|
||||
FileHeader:
|
||||
magic: 0xFEEDFACF
|
||||
cputype: 0x0100000C
|
||||
cpusubtype: 0x00000002
|
||||
filetype: 0x00000001
|
||||
ncmds: 0
|
||||
sizeofcmds: 0
|
||||
flags: 0x00000000
|
||||
reserved: 0x00000000
|
||||
...
|
|
@ -0,0 +1,43 @@
|
|||
## Check subtype Arm64-ALL:
|
||||
# RUN: yaml2obj %s -o %t.arm64-all -DSUBTYPE=0x0
|
||||
# RUN: llvm-readobj -h %t.arm64-all \
|
||||
# RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.arm64-all --check-prefix=ARM64 -DSUBTYPE="CPU_SUBTYPE_ARM64_ALL (0x0)"
|
||||
|
||||
## Check subtype Arm64-V8:
|
||||
# RUN: yaml2obj %s -o %t.arm64-v8 -DSUBTYPE=0x1
|
||||
# RUN: llvm-readobj -h %t.arm64-v8 \
|
||||
# RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.arm64-v8 --check-prefix=ARM64 -DSUBTYPE="CPU_SUBTYPE_ARM64_V8 (0x1)"
|
||||
|
||||
## Check subtype Arm64E:
|
||||
# RUN: yaml2obj %s -o %t.arm64e -DSUBTYPE=0x2
|
||||
# RUN: llvm-readobj -h %t.arm64e \
|
||||
# RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.arm64e --check-prefix=ARM64 -DSUBTYPE="CPU_SUBTYPE_ARM64E (0x2)"
|
||||
|
||||
# ARM64:File: [[FILE]]
|
||||
# ARM64-NEXT:Format: Mach-O arm64
|
||||
# ARM64-NEXT:Arch: aarch64
|
||||
# ARM64-NEXT:AddressSize: 64bit
|
||||
# ARM64-NEXT:MachHeader {
|
||||
# ARM64-NEXT: Magic: Magic64 (0xFEEDFACF)
|
||||
# ARM64-NEXT: CpuType: Arm64 (0x100000C)
|
||||
# ARM64-NEXT: CpuSubType: [[SUBTYPE]]
|
||||
# ARM64-NEXT: FileType: Relocatable (0x1)
|
||||
# ARM64-NEXT: NumOfLoadCommands: 0
|
||||
# ARM64-NEXT: SizeOfLoadCommands: 0
|
||||
# ARM64-NEXT: Flags [ (0x0)
|
||||
# ARM64-NEXT: ]
|
||||
# ARM64-NEXT: Reserved: 0x0
|
||||
# ARM64-NEXT:}
|
||||
# ARM64-NOT:{{.}}
|
||||
|
||||
--- !mach-o
|
||||
FileHeader:
|
||||
magic: 0xFEEDFACF
|
||||
cputype: 0x0100000C
|
||||
cpusubtype: [[SUBTYPE]]
|
||||
filetype: 0x00000001
|
||||
ncmds: 0
|
||||
sizeofcmds: 0
|
||||
flags: 0x00000000
|
||||
reserved: 0x00000000
|
||||
...
|
|
@ -2109,6 +2109,10 @@ static void printCPUType(uint32_t cputype, uint32_t cpusubtype) {
|
|||
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 @@ static void PrintMachHeader(uint32_t magic, uint32_t cputype,
|
|||
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;
|
||||
|
|
|
@ -161,8 +161,9 @@ static const EnumEntry<uint32_t> MachOHeaderCpuSubtypesARM[] = {
|
|||
};
|
||||
|
||||
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[] = {
|
||||
|
|
Loading…
Reference in New Issue