diff --git a/cmake/modules/SwiftSharedCMakeConfig.cmake b/cmake/modules/SwiftSharedCMakeConfig.cmake index a832224ece6e8..5c2db0f3cf9cd 100644 --- a/cmake/modules/SwiftSharedCMakeConfig.cmake +++ b/cmake/modules/SwiftSharedCMakeConfig.cmake @@ -81,7 +81,9 @@ macro(swift_common_standalone_build_config_llvm product is_cross_compiling) # HACK: this ugly tweaking is to prevent the propagation of the flag from LLVM # into swift. The use of this flag pollutes all targets, and we are not able # to remove it on a per-target basis which breaks cross-compilation. - string(REGEX REPLACE "-Wl,-z,defs" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") + if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") + string(REGEX REPLACE "-Wl,-z,defs" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") + endif() set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}") string(REGEX REPLACE "([0-9]+)\\.[0-9]+(\\.[0-9]+)?" "\\1" PACKAGE_VERSION_MAJOR diff --git a/stdlib/public/SwiftRemoteMirror/CMakeLists.txt b/stdlib/public/SwiftRemoteMirror/CMakeLists.txt index 260d04e0f9d4a..6aa7709547909 100644 --- a/stdlib/public/SwiftRemoteMirror/CMakeLists.txt +++ b/stdlib/public/SwiftRemoteMirror/CMakeLists.txt @@ -1,3 +1,6 @@ +# HACK: Force this library to build with undefined symbols. +string(REGEX REPLACE "-Wl,-z,defs" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") + # libswiftRemoteMirror.dylib should not have runtime dependencies; it's # always built as a shared library. if(SWIFT_BUILD_DYNAMIC_STDLIB OR SWIFT_BUILD_REMOTE_MIRROR)