Skip to content

Commit b1c3ddb

Browse files
committed
[build] Do not implicitly bump macCatalyst deployment target
This fixes linker warnings that look like this: ``` ld: warning: object file (libswiftCompatibility56.a) was built for newer 'macOS' version (XYZ) than being linked (ABC) ``` These were caused by the compatibility binary being incorrectly built with a newer `-target` than desired: the CMake logic was overriding the requested minimum macOS deployment version (10.9) with a much newer macOS SDK version. rdar://137565964
1 parent a9d5903 commit b1c3ddb

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function(_add_target_variant_c_compile_link_flags)
5555
if("${CFLAGS_SDK}" IN_LIST SWIFT_DARWIN_PLATFORMS)
5656
# Check if there's a specific OS deployment version needed for this invocation
5757
if("${CFLAGS_SDK}" STREQUAL "OSX")
58-
if(DEFINED maccatalyst_build_flavor)
58+
if(DEFINED maccatalyst_build_flavor AND DEFINED CFLAGS_DEPLOYMENT_VERSION_MACCATALYST)
5959
set(DEPLOYMENT_VERSION ${CFLAGS_DEPLOYMENT_VERSION_MACCATALYST})
6060
else()
6161
set(DEPLOYMENT_VERSION ${CFLAGS_DEPLOYMENT_VERSION_OSX})

test/Concurrency/Backdeploy/linking_maccatalyst.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-build-swift -target %target-cpu-apple-macosx12 %s -o %t/linking_direct
3-
// RUN: %target-build-swift -target %target-cpu-apple-macosx11 %s -o %t/linking_rpath
4-
// RUN: %target-build-swift -target %target-cpu-apple-macosx10.15 %s -o %t/linking_rpath_old
2+
// RUN: %target-build-swift -target %target-cpu-apple-macosx12 %s -o %t/linking_direct 2>&1 | %FileCheck -allow-empty -check-prefix CHECK-BUILD-ERRORS %s
3+
// RUN: %target-build-swift -target %target-cpu-apple-macosx11 %s -o %t/linking_rpath 2>&1 | %FileCheck -allow-empty -check-prefix CHECK-BUILD-ERRORS %s
4+
// RUN: %target-build-swift -target %target-cpu-apple-macosx10.15 %s -o %t/linking_rpath_old 2>&1 | %FileCheck -allow-empty -check-prefix CHECK-BUILD-ERRORS %s
5+
6+
// Make sure the linker didn't emit any version mismatch warnings.
7+
// CHECK-BUILD-ERRORS-NOT: was built for newer 'macOS' version
58

69
// RUN: otool -L %t/linking_direct | %FileCheck -check-prefix CHECK-DIRECT %s
710
// RUN: otool -L %t/linking_rpath | %FileCheck -check-prefix CHECK-RPATH %s

0 commit comments

Comments
 (0)