From e9d6ba91545c7eceac71dd4b37211961d7de32f9 Mon Sep 17 00:00:00 2001 From: eeckstein Date: Wed, 24 Apr 2024 04:12:31 -0700 Subject: [PATCH 1/6] cmake: enable SwiftCompilerSources on Windows --- CMakeLists.txt | 16 ++++++++++++++++ SwiftCompilerSources/CMakeLists.txt | 9 ++++++++- .../SILOptimizer/vjp_and_pullback_inlining.swift | 1 + .../loadable_by_address_address_assignment.swift | 2 -- test/embedded/optionset2.swift | 3 +++ test/embedded/ouroboros-bug.swift | 3 +++ test/embedded/stdlib-array.swift | 3 +++ test/embedded/stdlib-basic.swift | 3 +++ test/embedded/stdlib-dictionary.swift | 3 +++ test/embedded/stdlib-random.swift | 3 +++ test/embedded/stdlib-set.swift | 3 +++ test/embedded/stdlib-types.swift | 3 +++ .../cmake/modules/AddSwiftSourceKit.cmake | 6 ++++++ 13 files changed, 55 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c76d78620d40b..7876c3989077e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -736,6 +736,18 @@ option(SWIFT_ENABLE_BACKTRACING set(SWIFT_DARWIN_DEPLOYMENT_VERSION_MACCATALYST "14.5" CACHE STRING "Minimum deployment target version for macCatalyst") +# A tempoarary hack: force enabling HOSTTOOLS mode on Windows. +# Right now, SwiftCompilerSources cannot be enabled for lldb because on Windows +# swift and lldb are built in a unified build and there is a missing dependency +# on swiftrt. +# Swift and lldb are configured with the same cmake invocation and therefore +# enabling bootstrapping for swift and disabling it for lldb only works by +# hardcoding the bootstrapping mode in the cmake file. +# https://github.com/apple/swift/issues/73322 +if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + set(BOOTSTRAPPING_MODE "HOSTTOOLS") +endif() + # # End of user-configurable options. # @@ -904,6 +916,10 @@ if("${SWIFT_NATIVE_SWIFT_TOOLS_PATH}" STREQUAL "") # This is the normal case. We are not cross-compiling. set(SWIFT_NATIVE_SWIFT_TOOLS_PATH "${SWIFT_RUNTIME_OUTPUT_INTDIR}") set(SWIFT_EXEC_FOR_SWIFT_MODULES "${CMAKE_Swift_COMPILER}") + if(NOT SWIFT_EXEC_FOR_SWIFT_MODULES) + message(WARNING "BOOSTRAPPING set to OFF because no Swift compiler is defined") + set(BOOTSTRAPPING_MODE "OFF") + endif() elseif(BOOTSTRAPPING_MODE MATCHES "BOOTSTRAPPING.*") # If cross-compiling, we don't have to bootstrap. We can just use the previously # built native swiftc to build the swift compiler modules. diff --git a/SwiftCompilerSources/CMakeLists.txt b/SwiftCompilerSources/CMakeLists.txt index d355cb203fb27..b9425af9e27d2 100644 --- a/SwiftCompilerSources/CMakeLists.txt +++ b/SwiftCompilerSources/CMakeLists.txt @@ -106,6 +106,7 @@ function(add_swift_compiler_modules_library name) "-Xcc" "-std=c++17" "-Xcc" "-DCOMPILED_WITH_SWIFT" "-Xcc" "-DSWIFT_TARGET" "-Xcc" "-UIBOutlet" "-Xcc" "-UIBAction" "-Xcc" "-UIBInspectable") + # Prior to 5.9, we have to use the experimental flag for C++ interop. if (CMAKE_Swift_COMPILER_VERSION VERSION_LESS 5.9) list(APPEND swift_compile_options "-Xfrontend" "-enable-experimental-cxx-interop") @@ -167,7 +168,13 @@ function(add_swift_compiler_modules_library name) # under `include/swift`. These are either located next to the compiler (in case of open source toolchains) or # in the SDK (in case a Swift compiler from Xcode) get_filename_component(swift_exec_bin_dir ${ALS_SWIFT_EXEC} DIRECTORY) - list(APPEND sdk_option "-I" "${swift_exec_bin_dir}/../lib" "-I" "${sdk_path}/usr/lib") + + if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + list(APPEND swift_compile_options "-static") + list(APPEND sdk_option "-sdk" "${SWIFT_PATH_TO_SWIFT_SDK}") + else() + list(APPEND sdk_option "-I" "${swift_exec_bin_dir}/../lib" "-I" "${sdk_path}/usr/lib") + endif() set(all_obj_files) set(all_module_targets) diff --git a/test/AutoDiff/SILOptimizer/vjp_and_pullback_inlining.swift b/test/AutoDiff/SILOptimizer/vjp_and_pullback_inlining.swift index 53ec00ddb5ad0..43581c1cf6396 100644 --- a/test/AutoDiff/SILOptimizer/vjp_and_pullback_inlining.swift +++ b/test/AutoDiff/SILOptimizer/vjp_and_pullback_inlining.swift @@ -4,6 +4,7 @@ // REQUIRES: asserts // REQUIRES: swift_in_compiler +// UNSUPPORTED: OS=windows-msvc import _Differentiation #if canImport(Glibc) diff --git a/test/IRGen/loadable_by_address_address_assignment.swift b/test/IRGen/loadable_by_address_address_assignment.swift index 704ec6b00e470..123c4d3b1a798 100644 --- a/test/IRGen/loadable_by_address_address_assignment.swift +++ b/test/IRGen/loadable_by_address_address_assignment.swift @@ -1,7 +1,5 @@ // RUN: %target-swift-frontend %s -O -Xllvm -sil-print-after=loadable-address -c -o %t/t.o 2>&1 | %FileCheck %s -// XFAIL: OS=windows-msvc - public struct LargeThing { var s0 : String = "" var s1 : String = "" diff --git a/test/embedded/optionset2.swift b/test/embedded/optionset2.swift index 96ea0602e94c2..20c25dbdf1715 100644 --- a/test/embedded/optionset2.swift +++ b/test/embedded/optionset2.swift @@ -5,6 +5,9 @@ // REQUIRES: optimized_stdlib // REQUIRES: CODEGENERATOR=ARM +// https://github.com/apple/swift/issues/73249 +// UNSUPPORTED: OS=windows-msvc + protocol MyOptionSet: Equatable { init(rawValue: Int) init() diff --git a/test/embedded/ouroboros-bug.swift b/test/embedded/ouroboros-bug.swift index f28b7954e127d..a207643fc9317 100644 --- a/test/embedded/ouroboros-bug.swift +++ b/test/embedded/ouroboros-bug.swift @@ -10,6 +10,9 @@ // REQUIRES: optimized_stdlib // REQUIRES: CODEGENERATOR=ARM +// https://github.com/apple/swift/issues/73249 +// UNSUPPORTED: OS=windows-msvc + public func test() {} test() diff --git a/test/embedded/stdlib-array.swift b/test/embedded/stdlib-array.swift index a7612060c2176..52788b6ddb866 100644 --- a/test/embedded/stdlib-array.swift +++ b/test/embedded/stdlib-array.swift @@ -5,6 +5,9 @@ // REQUIRES: optimized_stdlib // REQUIRES: CODEGENERATOR=ARM +// https://github.com/apple/swift/issues/73249 +// UNSUPPORTED: OS=windows-msvc + public func test() { var array: [Int] = [1, 2, 3] array.append(42) diff --git a/test/embedded/stdlib-basic.swift b/test/embedded/stdlib-basic.swift index 2513e0157477c..16ea5301ffb0a 100644 --- a/test/embedded/stdlib-basic.swift +++ b/test/embedded/stdlib-basic.swift @@ -4,6 +4,9 @@ // REQUIRES: swift_in_compiler // REQUIRES: CODEGENERATOR=ARM +// https://github.com/apple/swift/issues/73249 +// UNSUPPORTED: OS=windows-msvc + public func bool() -> Bool { return true } diff --git a/test/embedded/stdlib-dictionary.swift b/test/embedded/stdlib-dictionary.swift index e5c1d6b24c3a3..f24986798102e 100644 --- a/test/embedded/stdlib-dictionary.swift +++ b/test/embedded/stdlib-dictionary.swift @@ -4,6 +4,9 @@ // REQUIRES: swift_in_compiler // REQUIRES: optimized_stdlib +// https://github.com/apple/swift/issues/73249 +// UNSUPPORTED: OS=windows-msvc + public func test() { var d: [Int:Int] = [1: 2, 3: 4, 5: 6] d[8] = 9 diff --git a/test/embedded/stdlib-random.swift b/test/embedded/stdlib-random.swift index 5804101618e5a..475f2b1de689c 100644 --- a/test/embedded/stdlib-random.swift +++ b/test/embedded/stdlib-random.swift @@ -4,6 +4,9 @@ // REQUIRES: swift_in_compiler // REQUIRES: optimized_stdlib +// https://github.com/apple/swift/issues/73249 +// UNSUPPORTED: OS=windows-msvc + public func test() { Bool.random() Int.random(in: 0 ..< 100) diff --git a/test/embedded/stdlib-set.swift b/test/embedded/stdlib-set.swift index 02f60b29129f4..e89efa5d68d08 100644 --- a/test/embedded/stdlib-set.swift +++ b/test/embedded/stdlib-set.swift @@ -5,6 +5,9 @@ // REQUIRES: optimized_stdlib // REQUIRES: CODEGENERATOR=ARM +// https://github.com/apple/swift/issues/73249 +// UNSUPPORTED: OS=windows-msvc + public func test() { var s: Set = [1, 2, 3] s.insert(42) diff --git a/test/embedded/stdlib-types.swift b/test/embedded/stdlib-types.swift index 705c25e45a574..5e9cf3f915499 100644 --- a/test/embedded/stdlib-types.swift +++ b/test/embedded/stdlib-types.swift @@ -5,6 +5,9 @@ // REQUIRES: optimized_stdlib // REQUIRES: CODEGENERATOR=ARM +// https://github.com/apple/swift/issues/73249 +// UNSUPPORTED: OS=windows-msvc + class MyClass {} public func test() { diff --git a/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake b/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake index 58baab5b58122..bf92d58f70637 100644 --- a/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake +++ b/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake @@ -142,6 +142,12 @@ function(add_sourcekit_swift_runtime_link_flags target path HAS_SWIFT_MODULES) else() message(FATAL_ERROR "Unknown ASKD_BOOTSTRAPPING_MODE '${ASKD_BOOTSTRAPPING_MODE}'") endif() + elseif(SWIFT_HOST_VARIANT_SDK STREQUAL "WINDOWS") + if(ASKD_BOOTSTRAPPING_MODE MATCHES "HOSTTOOLS") + set(swiftrt_obj + ${SWIFT_PATH_TO_SWIFT_SDK}/usr/lib/swift/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}/${SWIFT_HOST_VARIANT_ARCH}/swiftrt${CMAKE_C_OUTPUT_EXTENSION}) + target_link_libraries(${target} PRIVATE ${swiftrt_obj}) + endif() endif() if(SWIFT_BUILD_SWIFT_SYNTAX) From 0c8c98523edd649da5760f856cf0b3fbccd7b146 Mon Sep 17 00:00:00 2001 From: Erik Eckstein Date: Thu, 25 Apr 2024 20:25:00 +0200 Subject: [PATCH 2/6] SwiftCompilerSources: remove a not needed `import CxxStdlib` It's not needed and doesn't work on Windows --- SwiftCompilerSources/Sources/Basic/Utils.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/SwiftCompilerSources/Sources/Basic/Utils.swift b/SwiftCompilerSources/Sources/Basic/Utils.swift index 6e878309f9335..7eb783ed6e76c 100644 --- a/SwiftCompilerSources/Sources/Basic/Utils.swift +++ b/SwiftCompilerSources/Sources/Basic/Utils.swift @@ -11,7 +11,6 @@ //===----------------------------------------------------------------------===// @_exported import BasicBridging -import CxxStdlib /// The assert function to be used in the compiler. /// From 87a520ccb25b5af72ec8d2e3cb6c2f2df4bca6ec Mon Sep 17 00:00:00 2001 From: eeckstein Date: Wed, 24 Apr 2024 04:13:17 -0700 Subject: [PATCH 3/6] SwiftCompilerSources: exclude some low level file operations, which are not compilable on windows --- SwiftCompilerSources/Sources/Basic/Utils.swift | 5 +++++ .../FunctionPasses/LifetimeDependenceDiagnostics.swift | 3 +++ SwiftCompilerSources/Sources/Optimizer/Utilities/Test.swift | 3 +++ test/SILOptimizer/argument_conventions.sil | 3 +++ test/SILOptimizer/borrow_introducer_unit.sil | 3 +++ test/SILOptimizer/enclosing_def_unit.sil | 3 +++ test/SILOptimizer/forwarding_utils.sil | 3 +++ test/SILOptimizer/lifetime_dependence_util.sil | 3 +++ test/SILOptimizer/opaque_values_unit.sil | 3 +++ test/SILOptimizer/ownership_liveness_unit.sil | 3 +++ test/SILOptimizer/test_specification_parsing.sil | 3 +++ 11 files changed, 35 insertions(+) diff --git a/SwiftCompilerSources/Sources/Basic/Utils.swift b/SwiftCompilerSources/Sources/Basic/Utils.swift index 7eb783ed6e76c..eae13580d3eb0 100644 --- a/SwiftCompilerSources/Sources/Basic/Utils.swift +++ b/SwiftCompilerSources/Sources/Basic/Utils.swift @@ -51,6 +51,9 @@ public extension NoReflectionChildren { var customMirror: Mirror { Mirror(self, children: []) } } +#if !os(Windows) +// TODO: https://github.com/apple/swift/issues/73252 + public var standardError = CFileStream(fp: stderr) #if os(Android) || canImport(Musl) @@ -71,6 +74,8 @@ public struct CFileStream: TextOutputStream { } } +#endif + //===----------------------------------------------------------------------===// // StringRef //===----------------------------------------------------------------------===// diff --git a/SwiftCompilerSources/Sources/Optimizer/FunctionPasses/LifetimeDependenceDiagnostics.swift b/SwiftCompilerSources/Sources/Optimizer/FunctionPasses/LifetimeDependenceDiagnostics.swift index 8ddd3b1b3699e..48f8aa73f696b 100644 --- a/SwiftCompilerSources/Sources/Optimizer/FunctionPasses/LifetimeDependenceDiagnostics.swift +++ b/SwiftCompilerSources/Sources/Optimizer/FunctionPasses/LifetimeDependenceDiagnostics.swift @@ -121,7 +121,10 @@ private struct DiagnoseDependence { } func reportUnknown(operand: Operand) { +#if !os(Windows) + // TODO: https://github.com/apple/swift/issues/73252 standardError.write("Unknown use: \(operand)\n\(function)") +#endif reportEscaping(operand: operand) } diff --git a/SwiftCompilerSources/Sources/Optimizer/Utilities/Test.swift b/SwiftCompilerSources/Sources/Optimizer/Utilities/Test.swift index 20e1a95fcd6d3..7138f56c4cb6f 100644 --- a/SwiftCompilerSources/Sources/Optimizer/Utilities/Test.swift +++ b/SwiftCompilerSources/Sources/Optimizer/Utilities/Test.swift @@ -197,7 +197,10 @@ private func functionTestThunk( let invocation = castToInvocation(fromOpaquePointer: erasedInvocation) let context = FunctionPassContext(_bridged: BridgedPassContext(invocation: passInvocation.invocation)) invocation(function.function, arguments.native, context) +#if !os(Windows) + // TODO: https://github.com/apple/swift/issues/73252 fflush(stdout) +#endif } /// Bitcast a thin test closure to void *. diff --git a/test/SILOptimizer/argument_conventions.sil b/test/SILOptimizer/argument_conventions.sil index 77ba49521d676..a6493e4bc6881 100644 --- a/test/SILOptimizer/argument_conventions.sil +++ b/test/SILOptimizer/argument_conventions.sil @@ -5,6 +5,9 @@ // REQUIRES: swift_in_compiler +// https://github.com/apple/swift/issues/73252 +// UNSUPPORTED: OS=windows-msvc + import Builtin class C {} diff --git a/test/SILOptimizer/borrow_introducer_unit.sil b/test/SILOptimizer/borrow_introducer_unit.sil index a084eb09095a1..d123f1b097a91 100644 --- a/test/SILOptimizer/borrow_introducer_unit.sil +++ b/test/SILOptimizer/borrow_introducer_unit.sil @@ -2,6 +2,9 @@ // // REQUIRES: swift_in_compiler +// https://github.com/apple/swift/issues/73252 +// UNSUPPORTED: OS=windows-msvc + sil_stage raw import Builtin diff --git a/test/SILOptimizer/enclosing_def_unit.sil b/test/SILOptimizer/enclosing_def_unit.sil index d581dceafcebd..2df64d0d2f656 100644 --- a/test/SILOptimizer/enclosing_def_unit.sil +++ b/test/SILOptimizer/enclosing_def_unit.sil @@ -2,6 +2,9 @@ // // REQUIRES: swift_in_compiler +// https://github.com/apple/swift/issues/73252 +// UNSUPPORTED: OS=windows-msvc + sil_stage raw import Builtin diff --git a/test/SILOptimizer/forwarding_utils.sil b/test/SILOptimizer/forwarding_utils.sil index aecb0a26f3587..d3da28ae81dfa 100644 --- a/test/SILOptimizer/forwarding_utils.sil +++ b/test/SILOptimizer/forwarding_utils.sil @@ -2,6 +2,9 @@ // REQUIRES: swift_in_compiler +// https://github.com/apple/swift/issues/73252 +// UNSUPPORTED: OS=windows-msvc + sil_stage raw import Builtin diff --git a/test/SILOptimizer/lifetime_dependence_util.sil b/test/SILOptimizer/lifetime_dependence_util.sil index 727baf9e46afc..8e59a7b55b729 100644 --- a/test/SILOptimizer/lifetime_dependence_util.sil +++ b/test/SILOptimizer/lifetime_dependence_util.sil @@ -7,6 +7,9 @@ // REQUIRES: asserts // REQUIRES: swift_in_compiler +// https://github.com/apple/swift/issues/73252 +// UNSUPPORTED: OS=windows-msvc + sil_stage canonical import Builtin diff --git a/test/SILOptimizer/opaque_values_unit.sil b/test/SILOptimizer/opaque_values_unit.sil index a879e8f68dfb8..a2f4c76755d9f 100644 --- a/test/SILOptimizer/opaque_values_unit.sil +++ b/test/SILOptimizer/opaque_values_unit.sil @@ -2,6 +2,9 @@ // REQUIRES: swift_in_compiler +// https://github.com/apple/swift/issues/73252 +// UNSUPPORTED: OS=windows-msvc + import Builtin class C {} diff --git a/test/SILOptimizer/ownership_liveness_unit.sil b/test/SILOptimizer/ownership_liveness_unit.sil index 058e4fd44012a..3dcae585575c4 100644 --- a/test/SILOptimizer/ownership_liveness_unit.sil +++ b/test/SILOptimizer/ownership_liveness_unit.sil @@ -6,6 +6,9 @@ // REQUIRES: swift_in_compiler +// https://github.com/apple/swift/issues/73252 +// UNSUPPORTED: OS=windows-msvc + sil_stage canonical import Builtin diff --git a/test/SILOptimizer/test_specification_parsing.sil b/test/SILOptimizer/test_specification_parsing.sil index 79165c44d8e10..06f5dd398cf2e 100644 --- a/test/SILOptimizer/test_specification_parsing.sil +++ b/test/SILOptimizer/test_specification_parsing.sil @@ -2,6 +2,9 @@ // REQUIRES: swift_in_compiler +// https://github.com/apple/swift/issues/73252 +// UNSUPPORTED: OS=windows-msvc + sil_stage raw import Builtin From 7bf193e764f022a0fe1858bbf4778912503e77a2 Mon Sep 17 00:00:00 2001 From: eeckstein Date: Wed, 24 Apr 2024 04:16:12 -0700 Subject: [PATCH 4/6] SwiftCompilerSources: workaround a compiler crash on windows by disabling convert_function simplification --- .../SimplifyConvertEscapeToNoEscape.swift | 5 +++++ SwiftCompilerSources/Sources/SIL/Type.swift | 4 ++++ test/SILOptimizer/simplify_convert_escape_to_noescape.sil | 3 +++ 3 files changed, 12 insertions(+) diff --git a/SwiftCompilerSources/Sources/Optimizer/InstructionSimplification/SimplifyConvertEscapeToNoEscape.swift b/SwiftCompilerSources/Sources/Optimizer/InstructionSimplification/SimplifyConvertEscapeToNoEscape.swift index e31c8e7a13afb..440d78a36730f 100644 --- a/SwiftCompilerSources/Sources/Optimizer/InstructionSimplification/SimplifyConvertEscapeToNoEscape.swift +++ b/SwiftCompilerSources/Sources/Optimizer/InstructionSimplification/SimplifyConvertEscapeToNoEscape.swift @@ -28,6 +28,10 @@ private extension ConvertEscapeToNoEscapeInst { /// %3 = thin_to_thick_function %1 to $@noescape () -> () func tryCombineWithThinToThickOperand(_ context: SimplifyContext) { + // compiling bridged.getFunctionTypeWithNoEscape crashes the 5.10 Windows compiler +#if !os(Windows) + // TODO: https://github.com/apple/swift/issues/73253 + if let thinToThick = fromFunction as? ThinToThickFunctionInst { let builder = Builder(before: self, context) let noEscapeFnType = thinToThick.type.getFunctionType(withNoEscape: true) @@ -36,5 +40,6 @@ private extension ConvertEscapeToNoEscapeInst { uses.replaceAll(with: newThinToThick, context) context.erase(instruction: self) } +#endif } } diff --git a/SwiftCompilerSources/Sources/SIL/Type.swift b/SwiftCompilerSources/Sources/SIL/Type.swift index 6aeb25c49584f..a9cc836de73b9 100644 --- a/SwiftCompilerSources/Sources/SIL/Type.swift +++ b/SwiftCompilerSources/Sources/SIL/Type.swift @@ -142,9 +142,13 @@ public struct Type : CustomStringConvertible, NoReflectionChildren { return idx >= 0 ? idx : nil } +// compiling bridged.getFunctionTypeWithNoEscape crashes the 5.10 Windows compiler +#if !os(Windows) + // TODO: https://github.com/apple/swift/issues/73253 public func getFunctionType(withNoEscape: Bool) -> Type { bridged.getFunctionTypeWithNoEscape(withNoEscape).type } +#endif public var description: String { String(taking: bridged.getDebugDescription()) diff --git a/test/SILOptimizer/simplify_convert_escape_to_noescape.sil b/test/SILOptimizer/simplify_convert_escape_to_noescape.sil index 95d2c5c4fa47d..1fe66b5c41820 100644 --- a/test/SILOptimizer/simplify_convert_escape_to_noescape.sil +++ b/test/SILOptimizer/simplify_convert_escape_to_noescape.sil @@ -2,6 +2,9 @@ // REQUIRES: swift_in_compiler +// https://github.com/apple/swift/issues/73253 +// UNSUPPORTED: OS=windows-msvc + sil_stage canonical import Builtin From 338dd185e78918d9a3469b1439db72f9ba8a868c Mon Sep 17 00:00:00 2001 From: Erik Eckstein Date: Thu, 25 Apr 2024 11:07:36 +0200 Subject: [PATCH 5/6] SwiftCompilerSources: workaround a crash in the LoadableByAddress pass when building on Windows --- SwiftCompilerSources/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SwiftCompilerSources/CMakeLists.txt b/SwiftCompilerSources/CMakeLists.txt index b9425af9e27d2..070c00b61cdd6 100644 --- a/SwiftCompilerSources/CMakeLists.txt +++ b/SwiftCompilerSources/CMakeLists.txt @@ -172,6 +172,10 @@ function(add_swift_compiler_modules_library name) if(CMAKE_SYSTEM_NAME STREQUAL "Windows") list(APPEND swift_compile_options "-static") list(APPEND sdk_option "-sdk" "${SWIFT_PATH_TO_SWIFT_SDK}") + + # Workaround a crash in the LoadableByAddress pass + # https://github.com/apple/swift/issues/73254 + list(APPEND swift_compile_options "-Xllvm" "-sil-disable-pass=loadable-address") else() list(APPEND sdk_option "-I" "${swift_exec_bin_dir}/../lib" "-I" "${sdk_path}/usr/lib") endif() From dcf27a1f3696bb3411a8408b5d4963f84251ae2b Mon Sep 17 00:00:00 2001 From: Erik Eckstein Date: Mon, 29 Apr 2024 08:52:12 +0200 Subject: [PATCH 6/6] Disable the IRGen/linker_set_low_level_exec.swift on Windows https://github.com/apple/swift/issues/73321 --- test/IRGen/linker_set_low_level_exec.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/IRGen/linker_set_low_level_exec.swift b/test/IRGen/linker_set_low_level_exec.swift index 20caeec44fd98..943141d1cf2ad 100644 --- a/test/IRGen/linker_set_low_level_exec.swift +++ b/test/IRGen/linker_set_low_level_exec.swift @@ -3,6 +3,9 @@ // REQUIRES: executable_test // REQUIRES: swift_in_compiler +// https://github.com/apple/swift/issues/73321 +// UNSUPPORTED: OS=windows-msvc + @_used #if canImport(Darwin) @_section("__TEXT,__mysection")