Skip to content

Commit 6edc325

Browse files
committed
[Driver] Adjust Mac Catalyst deployment target to >= iOS 13 for the linker
Mac Catalyst was introduced with an iOS deployment target of 13.0. If given a deployment target before that, adjust the deployment target to 13.0 for the linker.
1 parent 336c0c2 commit 6edc325

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

lib/Driver/DarwinToolChains.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,14 @@ toolchains::Darwin::addDeploymentTargetArgs(ArgStringList &Arguments,
520520
unsigned major, minor, micro;
521521
if (tripleIsMacCatalystEnvironment(triple)) {
522522
triple.getiOSVersion(major, minor, micro);
523+
524+
// Mac Catalyst was introduced with an iOS deployment target of 13.0;
525+
// the linker doesn't want to see a deployment target before that.
526+
if (major < 13) {
527+
major = 13;
528+
minor = 0;
529+
micro = 0;
530+
}
523531
} else {
524532
switch (getDarwinPlatformKind((triple))) {
525533
case DarwinPlatformKind::MacOS:

test/Driver/macabi-environment.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,22 @@
1717
// IOS13-MACABI-DAG: -rpath [[MACOSX_SDK_STDLIB_PATH]]
1818
// IOS13-MACABI-DAG: -platform_version "mac catalyst" 13.0.0 0.0.0
1919

20+
// Adjust iOS versions < 13.0 to 13.0 for the linker's sake.
21+
22+
// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-ios12.0-macabi -sdk %S/../Inputs/clang-importer-sdk %s | %FileCheck -check-prefix=IOS12-MACABI %s
23+
// IOS12-MACABI: bin/swift
24+
// IOS12-MACABI: -target x86_64-apple-ios12.0-macabi
25+
26+
// IOS12-MACABI: bin/ld
27+
// IOS12-MACABI-DAG: -L [[MACCATALYST_STDLIB_PATH:[^ ]+/lib/swift/maccatalyst]]
28+
// IOS12-MACABI-DAG: -L [[MACOSX_STDLIB_PATH:[^ ]+/lib/swift/macosx]]
29+
// IOS12-MACABI-DAG: -L [[MACCATALYST_SDK_STDLIB_PATH:[^ ]+/clang-importer-sdk/System/iOSSupport/usr/lib/swift]]
30+
// IOS12-MACABI-DAG: -L [[MACOSX_SDK_STDLIB_PATH:[^ ]+/clang-importer-sdk/usr/lib/swift]]
31+
// IOS12-MACABI-DAG: -rpath [[MACCATALYST_STDLIB_PATH]]
32+
// IOS12-MACABI-DAG: -rpath [[MACOSX_STDLIB_PATH]]
33+
// IOS12-MACABI-DAG: -rpath [[MACCATALYST_SDK_STDLIB_PATH]]
34+
// IOS12-MACABI-DAG: -rpath [[MACOSX_SDK_STDLIB_PATH]]
35+
// IOS12-MACABI-DAG: -platform_version "mac catalyst" 13.0.0 0.0.0
2036

2137
// Test using target-variant to build zippered outputs
2238

0 commit comments

Comments
 (0)