Skip to content

Commit 67f2c05

Browse files
committed
Runtimes: properly link in swiftrtT?.obj on Windows
`swiftrtT.obj` should be used for statically linking the standard library (or within the standard library itself). For the other modules, we need to differentiate between `swiftrt.obj` and `swiftrtT.obj`. This fixes that oversight. This was not caught by the CI builds as we do not currently build both the static and dynamic variants of the new runtimes.
1 parent 9a8f827 commit 67f2c05

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

Runtimes/Core/Concurrency/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ target_link_libraries(swift_Concurrency PRIVATE
116116
$<$<PLATFORM_ID:Windows>:mincore>
117117
# Link to the runtime that we are just building.
118118
swiftCore
119-
$<$<NOT:$<PLATFORM_ID:Darwin>>:swiftrt>)
119+
SwiftRuntimeRegistration)
120120
target_link_options(swift_Concurrency PRIVATE
121121
-nostartfiles)
122122
set_target_properties(swift_Concurrency PROPERTIES

Runtimes/Core/SwiftOnoneSupport/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,14 @@ target_compile_options(swiftSwiftOnoneSupport PRIVATE
2626
target_compile_definitions(swiftSwiftOnoneSupport PRIVATE
2727
$<$<COMPILE_LANGUAGE:C,CXX>:-DSWIFT_TARGET_LIBRARY_NAME=swiftSwiftOnoneSupport>)
2828

29+
target_link_options(swiftSwiftOnoneSupport PRIVATE
30+
-nostartfiles)
31+
2932
target_link_libraries(swiftSwiftOnoneSupport
3033
PRIVATE
3134
swiftShims
32-
swiftCore)
35+
swiftCore
36+
SwiftRuntimeRegistration)
3337

3438
install(TARGETS swiftSwiftOnoneSupport
3539
EXPORT SwiftCoreTargets

Runtimes/Core/runtime/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ elseif("${SwiftCore_OBJECT_FORMAT}" STREQUAL "coffx")
173173
SWIFT_STATIC_STDLIB)
174174
target_link_libraries(swiftrtT PRIVATE swiftShims)
175175
install(FILES $<TARGET_OBJECTS:swiftrtT>
176+
COMPONENT SwiftCore_runtime
176177
DESTINATION "${CMAKE_INSTALL_LIBDIR}/swift/${SwiftCore_PLATFORM_SUBDIR}/${SwiftCore_ARCH_SUBDIR}"
177178
RENAME swiftrtT.obj)
178179

@@ -185,3 +186,10 @@ elseif("${SwiftCore_OBJECT_FORMAT}" STREQUAL "coffx")
185186
elseif(NOT "${SwiftCore_OBJECT_FORMAT}" STREQUAL "x")
186187
message(SEND_ERROR "Unknown object format '${SwiftCore_OBJECT_FORMAT}'")
187188
endif()
189+
190+
add_library(SwiftRuntimeRegistration INTERFACE)
191+
target_link_libraries(SwiftRuntimeRegistration INTERFACE
192+
$<$<NOT:$<PLATFORM_ID:Darwin>>:swiftrt$<$<AND:$<PLATFORM_ID:Windows>,$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>>:T>>)
193+
install(TARGETS SwiftRuntimeRegistration
194+
EXPORT SwiftCoreTargets
195+
COMPONENT SwiftCore_runtime)

0 commit comments

Comments
 (0)