@@ -734,6 +734,7 @@ function(_add_swift_library_single target name)
734734 swift_windows_generate_sdk_vfs_overlay(SWIFTLIB_SINGLE_VFS_OVERLAY_FLAGS)
735735 foreach (flag ${SWIFTLIB_SINGLE_VFS_OVERLAY_FLAGS} )
736736 list (APPEND SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS -Xcc;${flag} )
737+ list (APPEND SWIFTLIB_SINGLE_C_COMPILE_FLAGS ${flag} )
737738 endforeach ()
738739 foreach (directory ${SWIFTLIB_INCLUDE} )
739740 list (APPEND SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS -Xfrontend;-I${directory} )
@@ -1474,6 +1475,11 @@ function(add_swift_library name)
14741475 continue ()
14751476 endif ()
14761477
1478+ # TODO: Currently SwiftPrivate runs into linker problems on Windows. See SR-6489.
1479+ if ("${sdk} " STREQUAL "WINDOWS" AND "${name} " MATCHES "SwiftPrivate" )
1480+ continue ()
1481+ endif ()
1482+
14771483 set (THIN_INPUT_TARGETS)
14781484
14791485 # For each architecture supported by this SDK
@@ -1613,6 +1619,18 @@ function(add_swift_library name)
16131619 endif ()
16141620 endif ()
16151621
1622+ # We unconditionally removed "-z,defs" from CMAKE_SHARED_LINKER_FLAGS in
1623+ # swift_common_standalone_build_config_llvm within SwiftSharedCMakeConfig.cmake,
1624+ # where it was added by a call to HandleLLVMOptions.
1625+ #
1626+ # Rather than applying it to all targets and libraries, we here add it back to
1627+ # supported targets and libraries only.
1628+ # Windows doesn't support the -z,defs flag and RemoteMirror needs to build
1629+ # with undefined symbols.
1630+ if (NOT "${sdk} " STREQUAL "WINDOWS" AND NOT "${name} " STREQUAL "swiftRemoteMirror" )
1631+ list (APPEND swiftlib_link_flags_all "-Wl,-z,defs" )
1632+ endif ()
1633+
16161634 # Add this library variant.
16171635 _add_swift_library_single(
16181636 ${VARIANT_NAME}
0 commit comments