|
| 1 | +From 4d0bc720421901407bab80d1e104220ddb145564 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Yuta Saito <kateinoigakukun@gmail.com> |
| 3 | +Date: Thu, 10 Oct 2024 04:29:54 +0000 |
| 4 | +Subject: [PATCH] Revert "[6.0] [CMake] [Darwin] Don't build the SDK overlays |
| 5 | + by default on Apple platforms" |
| 6 | + |
| 7 | +This reverts commit c6666f766022012b0406893f1b51ab227f7d89d6. |
| 8 | +--- |
| 9 | + CMakeLists.txt | 9 +-------- |
| 10 | + .../cmake/modules/AddSwiftBenchmarkSuite.cmake | 2 +- |
| 11 | + cmake/modules/DarwinSDKs.cmake | 6 +----- |
| 12 | + stdlib/private/CMakeLists.txt | 16 +++++++--------- |
| 13 | + stdlib/public/CMakeLists.txt | 7 ++++--- |
| 14 | + test/Driver/loaded_module_trace_foundation.swift | 4 ++-- |
| 15 | + test/Driver/loaded_module_trace_header.swift | 2 +- |
| 16 | + test/SIL/Serialization/deserialize_darwin.sil | 7 +++++++ |
| 17 | + test/embedded/concurrency-actors.swift | 4 ---- |
| 18 | + test/embedded/concurrency-async-let.swift | 4 ---- |
| 19 | + test/embedded/concurrency-simple.swift | 4 ---- |
| 20 | + test/embedded/darwin-bridging-header.swift | 4 ---- |
| 21 | + test/embedded/darwin.swift | 4 ---- |
| 22 | + test/lit.cfg | 4 ++-- |
| 23 | + .../build_swift/build_swift/driver_arguments.py | 3 +-- |
| 24 | + utils/build_swift/tests/expected_options.py | 3 +-- |
| 25 | + 16 files changed, 28 insertions(+), 55 deletions(-) |
| 26 | + create mode 100644 test/SIL/Serialization/deserialize_darwin.sil |
| 27 | + |
| 28 | +diff --git a/CMakeLists.txt b/CMakeLists.txt |
| 29 | +index b69c79736e0..6ae6f27330b 100644 |
| 30 | +--- a/CMakeLists.txt |
| 31 | ++++ b/CMakeLists.txt |
| 32 | +@@ -247,16 +247,9 @@ option(SWIFT_BUILD_CLANG_OVERLAYS |
| 33 | + "Build Swift overlays for the clang builtin modules" |
| 34 | + TRUE) |
| 35 | + |
| 36 | +-# The SDK overlay is provided by the SDK itself on Darwin platforms. |
| 37 | +-if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS) |
| 38 | +- set(SWIFT_BUILD_DYNAMIC_SDK_OVERLAY_default FALSE) |
| 39 | +-else() |
| 40 | +- set(SWIFT_BUILD_DYNAMIC_SDK_OVERLAY_default TRUE) |
| 41 | +-endif() |
| 42 | +- |
| 43 | + option(SWIFT_BUILD_DYNAMIC_SDK_OVERLAY |
| 44 | + "Build dynamic variants of the Swift SDK overlay" |
| 45 | +- "${SWIFT_BUILD_DYNAMIC_SDK_OVERLAY_default}") |
| 46 | ++ TRUE) |
| 47 | + |
| 48 | + option(SWIFT_BUILD_STATIC_SDK_OVERLAY |
| 49 | + "Build static variants of the Swift SDK overlay" |
| 50 | +diff --git a/benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake b/benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake |
| 51 | +index 25c04a59483..b96723f16ba 100644 |
| 52 | +--- a/benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake |
| 53 | ++++ b/benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake |
| 54 | +@@ -714,7 +714,7 @@ function(swift_benchmark_compile) |
| 55 | + |
| 56 | + if(NOT SWIFT_BENCHMARK_BUILT_STANDALONE) |
| 57 | + set(stdlib_dependencies "swift-frontend" "swiftCore-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}") |
| 58 | +- if((SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS) AND SWIFT_BUILD_SDK_OVERLAY) |
| 59 | ++ if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS) |
| 60 | + list(APPEND stdlib_dependencies "swiftDarwin-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}") |
| 61 | + endif() |
| 62 | + foreach(stdlib_dependency ${UNIVERSAL_LIBRARY_NAMES_${SWIFT_BENCHMARK_COMPILE_PLATFORM}}) |
| 63 | +diff --git a/cmake/modules/DarwinSDKs.cmake b/cmake/modules/DarwinSDKs.cmake |
| 64 | +index 32e1e4bface..558771b1516 100644 |
| 65 | +--- a/cmake/modules/DarwinSDKs.cmake |
| 66 | ++++ b/cmake/modules/DarwinSDKs.cmake |
| 67 | +@@ -48,11 +48,7 @@ if(swift_build_freestanding AND (SWIFT_FREESTANDING_FLAVOR STREQUAL "apple")) |
| 68 | + configure_target_variant(FREESTANDING-R "FREESTANDING Release" FREESTANDING R "Release") |
| 69 | + configure_target_variant(FREESTANDING-S "FREESTANDING MinSizeRelease" FREESTANDING S "MinSizeRelease") |
| 70 | + |
| 71 | +- if(SWIFT_BUILD_SDK_OVERLAY) |
| 72 | +- set(SWIFT_FREESTANDING_TEST_DEPENDENCIES "Darwin") |
| 73 | +- else() |
| 74 | +- set(SWIFT_FREESTANDING_TEST_DEPENDENCIES "") |
| 75 | +- endif() |
| 76 | ++ set(SWIFT_FREESTANDING_TEST_DEPENDENCIES "Darwin") |
| 77 | + endif() |
| 78 | + |
| 79 | + # Compatible cross-compile SDKS for Darwin OSes: IOS, IOS_SIMULATOR, TVOS, |
| 80 | +diff --git a/stdlib/private/CMakeLists.txt b/stdlib/private/CMakeLists.txt |
| 81 | +index 5bb77689950..05ef455b755 100644 |
| 82 | +--- a/stdlib/private/CMakeLists.txt |
| 83 | ++++ b/stdlib/private/CMakeLists.txt |
| 84 | +@@ -1,16 +1,12 @@ |
| 85 | +-if(SWIFT_BUILD_SDK_OVERLAY |
| 86 | +- OR (SWIFT_BUILD_TEST_SUPPORT_MODULES |
| 87 | +- AND NOT SWIFT_BUILD_DYNAMIC_SDK_OVERLAY_default |
| 88 | +- AND (SWIFT_ENABLE_REFLECTION |
| 89 | +- OR NOT SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS))) |
| 90 | ++if(SWIFT_BUILD_SDK_OVERLAY) |
| 91 | + # SwiftPrivateThreadExtras makes use of Darwin/Glibc, which is part of the |
| 92 | +- # SDK overlay. If the SDK overlay doesn't build by default, then it should |
| 93 | +- # be available in the SDK and DifferentiationUnittest can still be built. |
| 94 | +- # However, the overlay in the Apple SDKs requires the standard library to |
| 95 | +- # have reflection enabled. |
| 96 | ++ # SDK overlay. It can't be built separately from the SDK overlay. |
| 97 | + if(SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING) |
| 98 | + add_subdirectory(DifferentiationUnittest) |
| 99 | + endif() |
| 100 | ++endif() |
| 101 | ++ |
| 102 | ++if(SWIFT_BUILD_SDK_OVERLAY OR SWIFT_BUILD_TEST_SUPPORT_MODULES) |
| 103 | + add_subdirectory(SwiftPrivate) |
| 104 | + add_subdirectory(RuntimeUnittest) |
| 105 | + add_subdirectory(StdlibUnicodeUnittest) |
| 106 | +@@ -22,7 +18,9 @@ if(SWIFT_BUILD_SDK_OVERLAY |
| 107 | + # SwiftPrivateThreadExtras to ensure that the dependency targets are setup in |
| 108 | + # the correct order for Windows. |
| 109 | + add_subdirectory(StdlibUnittest) |
| 110 | ++endif() |
| 111 | + |
| 112 | ++if(SWIFT_BUILD_SDK_OVERLAY) |
| 113 | + add_subdirectory(OSLog) |
| 114 | + |
| 115 | + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") |
| 116 | +diff --git a/stdlib/public/CMakeLists.txt b/stdlib/public/CMakeLists.txt |
| 117 | +index eff3c646ce5..2883fd057c1 100644 |
| 118 | +--- a/stdlib/public/CMakeLists.txt |
| 119 | ++++ b/stdlib/public/CMakeLists.txt |
| 120 | +@@ -242,7 +242,7 @@ if(SWIFT_BUILD_STDLIB) |
| 121 | + add_subdirectory(core) |
| 122 | + add_subdirectory(SwiftOnoneSupport) |
| 123 | + |
| 124 | +- if(SWIFT_BUILD_CLANG_OVERLAYS OR SWIFT_BUILD_TEST_SUPPORT_MODULES) |
| 125 | ++ if(SWIFT_BUILD_CLANG_OVERLAYS) |
| 126 | + add_subdirectory(ClangOverlays) |
| 127 | + endif() |
| 128 | + endif() |
| 129 | +@@ -287,12 +287,13 @@ if(SWIFT_BUILD_REMOTE_MIRROR) |
| 130 | + add_subdirectory(SwiftRemoteMirror) |
| 131 | + endif() |
| 132 | + |
| 133 | +-if(SWIFT_BUILD_SDK_OVERLAY OR (SWIFT_BUILD_TEST_SUPPORT_MODULES AND SWIFT_BUILD_DYNAMIC_SDK_OVERLAY_default)) |
| 134 | ++if(SWIFT_BUILD_SDK_OVERLAY OR SWIFT_BUILD_TEST_SUPPORT_MODULES) |
| 135 | + add_subdirectory(Platform) |
| 136 | + endif() |
| 137 | + |
| 138 | + if(SWIFT_BUILD_SDK_OVERLAY) |
| 139 | +- # On Apple platforms, we aren't building any overlays. Instead, we're picking them up from the SDK. |
| 140 | ++ # On Apple platforms, we aren't building any overlays (other than Darwin in |
| 141 | ++ # Platform above). Instead, we're picking them up from the SDK. |
| 142 | + |
| 143 | + if(WINDOWS IN_LIST SWIFT_SDKS) |
| 144 | + add_subdirectory(Windows) |
| 145 | +diff --git a/test/Driver/loaded_module_trace_foundation.swift b/test/Driver/loaded_module_trace_foundation.swift |
| 146 | +index 3a66f173361..a2f3de1da5f 100644 |
| 147 | +--- a/test/Driver/loaded_module_trace_foundation.swift |
| 148 | ++++ b/test/Driver/loaded_module_trace_foundation.swift |
| 149 | +@@ -9,12 +9,12 @@ |
| 150 | + // CHECK: "arch":"{{[^"]*}}" |
| 151 | + // CHECK: "swiftmodules":[ |
| 152 | + |
| 153 | +-// Swift and SwiftOnoneSupport is expected to be locally built; |
| 154 | ++// Darwin, Swift and SwiftOnoneSupport is expected to be locally built; |
| 155 | + // everything else comes from the SDK, built from swiftinterface. |
| 156 | + |
| 157 | + // CHECK-DAG: "{{[^"]*}}/ObjectiveC.swiftmodule{{(\\/[^"]+[.]swift(module|interface))?}}" |
| 158 | + // CHECK-DAG: "{{[^"]*}}/Dispatch.swiftmodule{{(\\/[^"]+[.]swift(module|interface))?}}" |
| 159 | +-// CHECK-DAG: "{{[^"]*}}/Darwin.swiftmodule{{(\\/[^"]+[.]swift(module|interface))?}}" |
| 160 | ++// CHECK-DAG: "{{[^"]*}}/Darwin.swiftmodule{{(\\/[^"]+[.]swiftmodule)?}}" |
| 161 | + // CHECK-DAG: "{{[^"]*}}/Foundation.swiftmodule{{(\\/[^"]+[.]swift(module|interface))?}}" |
| 162 | + // CHECK-DAG: "{{[^"]*}}/Swift.swiftmodule{{(\\/[^"]+[.]swiftmodule)?}}" |
| 163 | + // CHECK-DAG: "{{[^"]*}}/SwiftOnoneSupport.swiftmodule{{(\\/[^"]+[.]swiftmodule)?}}" |
| 164 | +diff --git a/test/Driver/loaded_module_trace_header.swift b/test/Driver/loaded_module_trace_header.swift |
| 165 | +index 14181b134d7..8ce2e3c9219 100644 |
| 166 | +--- a/test/Driver/loaded_module_trace_header.swift |
| 167 | ++++ b/test/Driver/loaded_module_trace_header.swift |
| 168 | +@@ -11,7 +11,7 @@ |
| 169 | + // CHECK: "swiftmodules":[ |
| 170 | + // CHECK-DAG: "{{[^"]*}}/ObjectiveC.swiftmodule{{(\\/[^"]+[.]swift(module|interface))?}}" |
| 171 | + // CHECK-DAG: "{{[^"]*}}/Dispatch.swiftmodule{{(\\/[^"]+[.]swift(module|interface))?}}" |
| 172 | +-// CHECK-DAG: "{{[^"]*}}/Darwin.swiftmodule{{(\\/[^"]+[.]swift(module|interface))?}}" |
| 173 | ++// CHECK-DAG: "{{[^"]*}}/Darwin.swiftmodule{{(\\/[^"]+[.]swiftmodule)?}}" |
| 174 | + // CHECK-DAG: "{{[^"]*}}/Foundation.swiftmodule{{(\\/[^"]+[.]swift(module|interface))?}}" |
| 175 | + // CHECK-DAG: "{{[^"]*}}/Swift.swiftmodule{{(\\/[^"]+[.]swiftmodule)?}}" |
| 176 | + // CHECK-DAG: "{{[^"]*}}/SwiftOnoneSupport.swiftmodule{{(\\/[^"]+[.]swiftmodule)?}}" |
| 177 | +diff --git a/test/SIL/Serialization/deserialize_darwin.sil b/test/SIL/Serialization/deserialize_darwin.sil |
| 178 | +new file mode 100644 |
| 179 | +index 00000000000..cb3429291d5 |
| 180 | +--- /dev/null |
| 181 | ++++ b/test/SIL/Serialization/deserialize_darwin.sil |
| 182 | +@@ -0,0 +1,7 @@ |
| 183 | ++// Make sure that we can deserialize darwin. |
| 184 | ++// RUN: %target-sil-opt %platform-sdk-overlay-dir/Darwin.swiftmodule/%target-swiftmodule-name -module-name Darwin > /dev/null |
| 185 | ++// RUN: llvm-bcanalyzer %platform-sdk-overlay-dir/Darwin.swiftmodule/%target-swiftmodule-name | %FileCheck %s |
| 186 | ++ |
| 187 | ++// REQUIRES: objc_interop |
| 188 | ++ |
| 189 | ++// CHECK-NOT: Unknown |
| 190 | +diff --git a/test/embedded/concurrency-actors.swift b/test/embedded/concurrency-actors.swift |
| 191 | +index 0076b54335c..15486a7d143 100644 |
| 192 | +--- a/test/embedded/concurrency-actors.swift |
| 193 | ++++ b/test/embedded/concurrency-actors.swift |
| 194 | +@@ -9,10 +9,6 @@ |
| 195 | + // REQUIRES: optimized_stdlib |
| 196 | + // REQUIRES: OS=macosx |
| 197 | + |
| 198 | +-// The Darwin SDK overlay module in the macOS SDK cannot be imported in |
| 199 | +-// embedded Swift mode. |
| 200 | +-// XFAIL: OS=macosx |
| 201 | +- |
| 202 | + import _Concurrency |
| 203 | + |
| 204 | + actor Number { |
| 205 | +diff --git a/test/embedded/concurrency-async-let.swift b/test/embedded/concurrency-async-let.swift |
| 206 | +index ec616c934cf..4b8e0ea20f6 100644 |
| 207 | +--- a/test/embedded/concurrency-async-let.swift |
| 208 | ++++ b/test/embedded/concurrency-async-let.swift |
| 209 | +@@ -9,10 +9,6 @@ |
| 210 | + // REQUIRES: optimized_stdlib |
| 211 | + // REQUIRES: OS=macosx |
| 212 | + |
| 213 | +-// The Darwin SDK overlay module in the macOS SDK cannot be imported in |
| 214 | +-// embedded Swift mode. |
| 215 | +-// XFAIL: OS=macosx |
| 216 | +- |
| 217 | + import _Concurrency |
| 218 | + |
| 219 | + func fib(_ n: Int) -> Int { |
| 220 | +diff --git a/test/embedded/concurrency-simple.swift b/test/embedded/concurrency-simple.swift |
| 221 | +index 3b42b59290c..004cf4aa8f7 100644 |
| 222 | +--- a/test/embedded/concurrency-simple.swift |
| 223 | ++++ b/test/embedded/concurrency-simple.swift |
| 224 | +@@ -9,10 +9,6 @@ |
| 225 | + // REQUIRES: optimized_stdlib |
| 226 | + // REQUIRES: OS=macosx |
| 227 | + |
| 228 | +-// The Darwin SDK overlay module in the macOS SDK cannot be imported in |
| 229 | +-// embedded Swift mode. |
| 230 | +-// XFAIL: OS=macosx |
| 231 | +- |
| 232 | + import _Concurrency |
| 233 | + |
| 234 | + public func test() async -> Int { |
| 235 | +diff --git a/test/embedded/darwin-bridging-header.swift b/test/embedded/darwin-bridging-header.swift |
| 236 | +index d9fb85e5c45..e919e8ee0a1 100644 |
| 237 | +--- a/test/embedded/darwin-bridging-header.swift |
| 238 | ++++ b/test/embedded/darwin-bridging-header.swift |
| 239 | +@@ -11,10 +11,6 @@ |
| 240 | + // REQUIRES: VENDOR=apple |
| 241 | + // REQUIRES: OS=macosx |
| 242 | + |
| 243 | +-// The Darwin SDK overlay module in the macOS SDK cannot be imported in |
| 244 | +-// embedded Swift mode. |
| 245 | +-// XFAIL: OS=macosx |
| 246 | +- |
| 247 | + // BEGIN BridgingHeader.h |
| 248 | + |
| 249 | + #include <unistd.h> |
| 250 | +diff --git a/test/embedded/darwin.swift b/test/embedded/darwin.swift |
| 251 | +index e90513ea284..e15cf66d88a 100644 |
| 252 | +--- a/test/embedded/darwin.swift |
| 253 | ++++ b/test/embedded/darwin.swift |
| 254 | +@@ -9,10 +9,6 @@ |
| 255 | + // REQUIRES: VENDOR=apple |
| 256 | + // REQUIRES: OS=macosx |
| 257 | + |
| 258 | +-// The Darwin SDK overlay module in the macOS SDK cannot be imported in |
| 259 | +-// embedded Swift mode. |
| 260 | +-// XFAIL: OS=macosx |
| 261 | +- |
| 262 | + import Darwin |
| 263 | + |
| 264 | + @main |
| 265 | +diff --git a/test/lit.cfg b/test/lit.cfg |
| 266 | +index 16d5c01a8da..c327efdb9f7 100644 |
| 267 | +--- a/test/lit.cfg |
| 268 | ++++ b/test/lit.cfg |
| 269 | +@@ -1498,8 +1498,8 @@ if run_vendor == 'apple': |
| 270 | + '%s -modulewrap -target %s' % |
| 271 | + (config.swiftc, config.variant_triple)) |
| 272 | + config.target_swift_emit_pcm = ( |
| 273 | +- '%s -emit-pcm -target %s -sdk %r' % |
| 274 | +- (config.swiftc, config.variant_triple, config.variant_sdk)) |
| 275 | ++ '%s -emit-pcm -target %s' % |
| 276 | ++ (config.swiftc, config.variant_triple)) |
| 277 | + subst_target_swift_frontend_mock_sdk_after = \ |
| 278 | + target_options_for_mock_sdk_after |
| 279 | + config.target_sil_opt = ( |
| 280 | +diff --git a/utils/build_swift/build_swift/driver_arguments.py b/utils/build_swift/build_swift/driver_arguments.py |
| 281 | +index 4345cb43d6d..cd9480cc7b3 100644 |
| 282 | +--- a/utils/build_swift/build_swift/driver_arguments.py |
| 283 | ++++ b/utils/build_swift/build_swift/driver_arguments.py |
| 284 | +@@ -8,7 +8,6 @@ |
| 285 | + |
| 286 | + import multiprocessing |
| 287 | + import os |
| 288 | +-import platform |
| 289 | + |
| 290 | + import android.adb.commands |
| 291 | + |
| 292 | +@@ -1146,7 +1145,7 @@ def create_argument_parser(): |
| 293 | + help='build static variants of the Swift standard library') |
| 294 | + |
| 295 | + option('--build-swift-dynamic-sdk-overlay', toggle_true, |
| 296 | +- default=platform.system() != "Darwin", |
| 297 | ++ default=True, |
| 298 | + help='build dynamic variants of the Swift SDK overlay') |
| 299 | + |
| 300 | + option('--build-swift-static-sdk-overlay', toggle_true, |
| 301 | +diff --git a/utils/build_swift/tests/expected_options.py b/utils/build_swift/tests/expected_options.py |
| 302 | +index 72687e27fd2..5d1a6a6898a 100644 |
| 303 | +--- a/utils/build_swift/tests/expected_options.py |
| 304 | ++++ b/utils/build_swift/tests/expected_options.py |
| 305 | +@@ -8,7 +8,6 @@ |
| 306 | + |
| 307 | + |
| 308 | + import multiprocessing |
| 309 | +-import platform |
| 310 | + |
| 311 | + from build_swift import argparse |
| 312 | + from build_swift import defaults |
| 313 | +@@ -81,7 +80,7 @@ EXPECTED_DEFAULTS = { |
| 314 | + 'build_runtime_with_host_compiler': False, |
| 315 | + 'build_stdlib_deployment_targets': ['all'], |
| 316 | + 'build_subdir': None, |
| 317 | +- 'build_swift_dynamic_sdk_overlay': platform.system() != "Darwin", |
| 318 | ++ 'build_swift_dynamic_sdk_overlay': True, |
| 319 | + 'build_swift_dynamic_stdlib': True, |
| 320 | + 'build_swift_inspect': False, |
| 321 | + 'build_swift_external_generic_metadata_builder': True, |
| 322 | +-- |
| 323 | +2.46.0 |
| 324 | + |
0 commit comments