Skip to content

Commit 1367aab

Browse files
authored
Merge pull request #83443 from compnerd/lnk4217
Runtimes: ensure that we validate the linkage on Windows
2 parents eed7f6c + ecc3874 commit 1367aab

File tree

6 files changed

+55
-0
lines changed

6 files changed

+55
-0
lines changed

Runtimes/Overlay/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ add_compile_options(
7878
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-concurrency-module-import>"
7979
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-string-processing-module-import>")
8080

81+
# LNK4049: symbol 'symbol' defined in 'filename.obj' is imported
82+
# LNK4286: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj'
83+
# LNK4217: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj' in function 'function'
84+
#
85+
# We cannot selectively filter the linker warnings as we do not use the MSVC
86+
# frontned and `clang-cl` (and `clang`) currently do not support `/WX:nnnn`. As
87+
# a compromise, treat all linker warnings as errors.
88+
add_link_options($<$<PLATFORM_ID:Windows>:LINKER:/WX>)
89+
8190
add_compile_definitions(
8291
$<$<BOOL:${SwiftOverlay_ENABLE_BACKDEPLOYMENT_SUPPORT}>:SWIFT_STDLIB_SUPPORT_BACK_DEPLOYMENT>)
8392

Runtimes/Supplemental/Differentiation/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,17 @@ add_compile_options(
7878
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -target-min-inlining-version -Xfrontend min>"
7979
$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_LIBRARY_EVOLUTION}>,$<COMPILE_LANGUAGE:Swift>>:-enable-library-evolution>)
8080

81+
# LNK4049: symbol 'symbol' defined in 'filename.obj' is imported
82+
# LNK4286: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj'
83+
# LNK4217: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj' in function 'function'
84+
#
85+
# We cannot selectively filter the linker warnings as we do not use the MSVC
86+
# frontned and `clang-cl` (and `clang`) currently do not support `/WX:nnnn`. As
87+
# a compromise, treat all linker warnings as errors.
88+
# FIXME(#83444) - enable this once we fix DLL storage for
89+
# `_fatalErrorForwardModeDifferentiationDisabled`
90+
# add_link_options($<$<PLATFORM_ID:Windows>:LINKER:/WX>)
91+
8192
if(SwiftDifferentiation_ENABLE_VECTOR_TYPES)
8293
gyb_expand(SIMDDifferentiation.swift.gyb SIMDDifferentiation.swift)
8394
endif()

Runtimes/Supplemental/Distributed/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,14 @@ add_compile_options(
9090
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_LIBRARY_EVOLUTION}>,$<COMPILE_LANGUAGE:Swift>>:-enable-library-evolution>"
9191
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_PRESPECIALIZATION}>,$<COMPILE_LANGUAGE:Swift>>:SHELL:-Xfrontend -prespecialize-generic-metadata>")
9292

93+
# LNK4049: symbol 'symbol' defined in 'filename.obj' is imported
94+
# LNK4286: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj'
95+
# LNK4217: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj' in function 'function'
96+
#
97+
# We cannot selectively filter the linker warnings as we do not use the MSVC
98+
# frontned and `clang-cl` (and `clang`) currently do not support `/WX:nnnn`. As
99+
# a compromise, treat all linker warnings as errors.
100+
add_link_options($<$<PLATFORM_ID:Windows>:LINKER:/WX>)
93101

94102
add_library(swiftDistributed
95103
DistributedActor.cpp

Runtimes/Supplemental/Observation/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ add_compile_options(
7575
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_LIBRARY_EVOLUTION}>,$<COMPILE_LANGUAGE:Swift>>:-enable-library-evolution>"
7676
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_PRESPECIALIZATION}>,$<COMPILE_LANGUAGE:Swift>>:SHELL:-Xfrontend -prespecialize-generic-metadata>")
7777

78+
# LNK4049: symbol 'symbol' defined in 'filename.obj' is imported
79+
# LNK4286: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj'
80+
# LNK4217: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj' in function 'function'
81+
#
82+
# We cannot selectively filter the linker warnings as we do not use the MSVC
83+
# frontned and `clang-cl` (and `clang`) currently do not support `/WX:nnnn`. As
84+
# a compromise, treat all linker warnings as errors.
85+
add_link_options($<$<PLATFORM_ID:Windows>:LINKER:/WX>)
86+
7887
add_library(swiftObservation
7988
Sources/Observation/Locking.swift
8089
Sources/Observation/Observable.swift

Runtimes/Supplemental/StringProcessing/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ add_compile_options(
5757
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_LIBRARY_EVOLUTION}>,$<COMPILE_LANGUAGE:Swift>>:-enable-library-evolution>"
5858
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_PRESPECIALIZATION}>,$<COMPILE_LANGUAGE:Swift>>:SHELL:-Xfrontend -prespecialize-generic-metadata>")
5959

60+
# LNK4049: symbol 'symbol' defined in 'filename.obj' is imported
61+
# LNK4286: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj'
62+
# LNK4217: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj' in function 'function'
63+
#
64+
# We cannot selectively filter the linker warnings as we do not use the MSVC
65+
# frontned and `clang-cl` (and `clang`) currently do not support `/WX:nnnn`. As
66+
# a compromise, treat all linker warnings as errors.
67+
add_link_options($<$<PLATFORM_ID:Windows>:LINKER:/WX>)
68+
6069
add_subdirectory(_RegexParser)
6170
add_subdirectory(_StringProcessing)
6271
add_subdirectory(RegexBuilder)

Runtimes/Supplemental/Synchronization/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ add_compile_options(
9393
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_LIBRARY_EVOLUTION}>,$<COMPILE_LANGUAGE:Swift>>:-enable-library-evolution>"
9494
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_PRESPECIALIZATION}>,$<COMPILE_LANGUAGE:Swift>>:SHELL:-Xfrontend -prespecialize-generic-metadata>")
9595

96+
# LNK4049: symbol 'symbol' defined in 'filename.obj' is imported
97+
# LNK4286: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj'
98+
# LNK4217: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj' in function 'function'
99+
#
100+
# We cannot selectively filter the linker warnings as we do not use the MSVC
101+
# frontned and `clang-cl` (and `clang`) currently do not support `/WX:nnnn`. As
102+
# a compromise, treat all linker warnings as errors.
103+
add_link_options($<$<PLATFORM_ID:Windows>:LINKER:/WX>)
104+
96105
gyb_expand(Atomics/AtomicIntegers.swift.gyb Atomics/AtomicIntegers.swift)
97106
gyb_expand(Atomics/AtomicStorage.swift.gyb Atomics/AtomicStorage.swift)
98107

0 commit comments

Comments
 (0)