mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
Add support for the 'macCatalyst' MachO platform
Mac Catalyst is a new MachO platform in macOS Catalina. It always uses the build_version MachO load command. Differential Revision: https://reviews.llvm.org/D64107 llvm-svn: 364981
This commit is contained in:
parent
8b927e15fd
commit
c3dfdcf2f7
@ -487,6 +487,7 @@ enum PlatformType {
|
||||
PLATFORM_TVOS = 3,
|
||||
PLATFORM_WATCHOS = 4,
|
||||
PLATFORM_BRIDGEOS = 5,
|
||||
PLATFORM_MACCATALYST = 6,
|
||||
PLATFORM_IOSSIMULATOR = 7,
|
||||
PLATFORM_TVOSSIMULATOR = 8,
|
||||
PLATFORM_WATCHOSSIMULATOR = 9
|
||||
|
@ -608,6 +608,7 @@ public:
|
||||
case MachO::PLATFORM_TVOS: return "tvos";
|
||||
case MachO::PLATFORM_WATCHOS: return "watchos";
|
||||
case MachO::PLATFORM_BRIDGEOS: return "bridgeos";
|
||||
case MachO::PLATFORM_MACCATALYST: return "maccatalyst";
|
||||
case MachO::PLATFORM_IOSSIMULATOR: return "iossimulator";
|
||||
case MachO::PLATFORM_TVOSSIMULATOR: return "tvossimulator";
|
||||
case MachO::PLATFORM_WATCHOSSIMULATOR: return "watchossimulator";
|
||||
|
@ -541,6 +541,7 @@ static const char *getPlatformName(MachO::PlatformType Type) {
|
||||
case MachO::PLATFORM_TVOS: return "tvos";
|
||||
case MachO::PLATFORM_WATCHOS: return "watchos";
|
||||
case MachO::PLATFORM_BRIDGEOS: return "bridgeos";
|
||||
case MachO::PLATFORM_MACCATALYST: return "maccatalyst";
|
||||
case MachO::PLATFORM_IOSSIMULATOR: return "iossimulator";
|
||||
case MachO::PLATFORM_TVOSSIMULATOR: return "tvossimulator";
|
||||
case MachO::PLATFORM_WATCHOSSIMULATOR: return "watchossimulator";
|
||||
|
@ -1148,6 +1148,7 @@ static Triple::OSType getOSTypeFromPlatform(MachO::PlatformType Type) {
|
||||
case MachO::PLATFORM_TVOS: return Triple::TvOS;
|
||||
case MachO::PLATFORM_WATCHOS: return Triple::WatchOS;
|
||||
case MachO::PLATFORM_BRIDGEOS: /* silence warning */ break;
|
||||
case MachO::PLATFORM_MACCATALYST: return Triple::IOS;
|
||||
case MachO::PLATFORM_IOSSIMULATOR: /* silence warning */ break;
|
||||
case MachO::PLATFORM_TVOSSIMULATOR: /* silence warning */ break;
|
||||
case MachO::PLATFORM_WATCHOSSIMULATOR: /* silence warning */ break;
|
||||
@ -1168,6 +1169,7 @@ bool DarwinAsmParser::parseBuildVersion(StringRef Directive, SMLoc Loc) {
|
||||
.Case("ios", MachO::PLATFORM_IOS)
|
||||
.Case("tvos", MachO::PLATFORM_TVOS)
|
||||
.Case("watchos", MachO::PLATFORM_WATCHOS)
|
||||
.Case("maccatalyst", MachO::PLATFORM_MACCATALYST)
|
||||
.Default(0);
|
||||
if (Platform == 0)
|
||||
return Error(PlatformLoc, "unknown platform name");
|
||||
|
@ -1077,6 +1077,15 @@ void MCStreamer::EmitVersionForTarget(const Triple &Target,
|
||||
unsigned Major;
|
||||
unsigned Minor;
|
||||
unsigned Update;
|
||||
if (Target.isMacCatalystEnvironment()) {
|
||||
// Mac Catalyst always uses the build version load command.
|
||||
Target.getiOSVersion(Major, Minor, Update);
|
||||
assert(Major && "A non-zero major version is expected");
|
||||
EmitBuildVersion(MachO::PLATFORM_MACCATALYST, Major, Minor, Update,
|
||||
SDKVersion);
|
||||
return;
|
||||
}
|
||||
|
||||
MCVersionMinType VersionType;
|
||||
if (Target.isWatchOS()) {
|
||||
VersionType = MCVM_WatchOSVersionMin;
|
||||
|
3
test/CodeGen/X86/macCatalyst.ll
Normal file
3
test/CodeGen/X86/macCatalyst.ll
Normal file
@ -0,0 +1,3 @@
|
||||
; RUN: llc %s -o - | FileCheck %s
|
||||
target triple="x86_64-apple-ios13.0-maccatalyst"
|
||||
; CHECK: .build_version maccatalyst, 13, 0
|
4
test/MC/MachO/build-version-maccatalyst.s
Normal file
4
test/MC/MachO/build-version-maccatalyst.s
Normal file
@ -0,0 +1,4 @@
|
||||
// RUN: llvm-mc -triple x86_64-apple-ios %s | FileCheck %s
|
||||
|
||||
.build_version maccatalyst,13,0
|
||||
// CHECK: .build_version maccatalyst, 13, 0
|
@ -1,6 +1,7 @@
|
||||
// RUN: llvm-mc -triple x86_64-apple-macosx10.10.0 %s -filetype=obj -o - | llvm-objdump -macho -private-headers - | FileCheck %s
|
||||
// RUN: llvm-mc -triple x86_64-apple-ios8.0.0 %s -filetype=obj -o - | llvm-objdump -macho -private-headers - | FileCheck %s --check-prefix=CHECK-IOS
|
||||
// RUN: llvm-mc -triple x86_64-apple-darwin %s -filetype=obj -o - | llvm-objdump -macho -private-headers - | FileCheck %s --check-prefix=CHECK-DARWIN
|
||||
// RUN: llvm-mc -triple x86_64-apple-ios13.0-maccatalyst %s -filetype=obj -o - | llvm-objdump -macho -private-headers - | FileCheck %s --check-prefix=CHECK-MACCATALYST
|
||||
|
||||
// Test version-min load command should be inferred from triple and should always be generated on Darwin
|
||||
// CHECK: Load command
|
||||
@ -33,3 +34,10 @@
|
||||
// CHECK-BRIDGEOS-NEXT: sdk n/a
|
||||
// CHECK-BRIDGEOS-NEXT: minos 2.0
|
||||
// CHECK-BRIDGEOS-NEXT: ntools 0
|
||||
|
||||
// CHECK-MACCATALYST: cmd LC_BUILD_VERSION
|
||||
// CHECK-MACCATALYST-NEXT: cmdsize 24
|
||||
// CHECK-MACCATALYST-NEXT: platform maccatalyst
|
||||
// CHECK-MACCATALYST-NEXT: sdk n/a
|
||||
// CHECK-MACCATALYST-NEXT: minos 13.0
|
||||
// CHECK-MACCATALYST-NEXT: ntools 0
|
||||
|
@ -0,0 +1,54 @@
|
||||
# RUN: yaml2obj %s | llvm-objdump -macho -private-headers - | FileCheck %s
|
||||
|
||||
--- !mach-o
|
||||
FileHeader:
|
||||
magic: 0xFEEDFACF
|
||||
cputype: 0x01000007
|
||||
cpusubtype: 0x00000003
|
||||
filetype: 0x00000004
|
||||
ncmds: 2
|
||||
sizeofcmds: 192
|
||||
flags: 0x00000000
|
||||
reserved: 0
|
||||
LoadCommands:
|
||||
- cmd: LC_SEGMENT_64
|
||||
cmdsize: 152
|
||||
segname: __TEXT
|
||||
vmaddr: 4294967296
|
||||
vmsize: 8192
|
||||
fileoff: 0
|
||||
filesize: 3099
|
||||
maxprot: 7
|
||||
initprot: 5
|
||||
nsects: 1
|
||||
flags: 0
|
||||
Sections:
|
||||
- sectname: __text
|
||||
segname: __TEXT
|
||||
addr: 0x0000000100001160
|
||||
size: 3099
|
||||
offset: 0x00001160
|
||||
align: 4
|
||||
reloff: 0x00000000
|
||||
nreloc: 0
|
||||
flags: 0x80000400
|
||||
reserved1: 0x00000000
|
||||
reserved2: 0x00000000
|
||||
reserved3: 0x00000000
|
||||
- cmd: LC_BUILD_VERSION
|
||||
cmdsize: 32
|
||||
platform: 6
|
||||
minos: 0x000D0000
|
||||
sdk: 0x00090000
|
||||
ntools: 1
|
||||
Tools:
|
||||
- tool: 1
|
||||
version: 0x00000000
|
||||
...
|
||||
|
||||
CHECK: Load command 1
|
||||
CHECK-NEXT: cmd LC_BUILD_VERSION
|
||||
CHECK-NEXT: cmdsize 32
|
||||
CHECK-NEXT: platform maccatalyst
|
||||
CHECK-NEXT: sdk 9.0
|
||||
CHECK-NEXT: minos 13.0
|
Loading…
x
Reference in New Issue
Block a user