Skip to content

Commit 5bb4978

Browse files
committed
runtime: add swiftrtT.obj build
This introduces the new variant of the `swiftrt.obj` - `swiftrtT.obj` for Windows. This follows the C standard library naming convention as set forth by GCC. `crtbegin.o` => used to find constructors `crtbeginS.o` => used to find constructors in DSOs/PIEs `crtbeginT.o` => used to find constructors in static executables The newly minted `swiftrtT.obj` is meant for static linking. The one exception to this is building the swift runtime itself which locally defines the symbols and thus should always use the static variant.
1 parent 3787044 commit 5bb4978

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Runtimes/Core/runtime/CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,17 @@ if("${SwiftCore_OBJECT_FORMAT}" STREQUAL "elfx")
157157
DESTINATION "${CMAKE_INSTALL_LIBDIR}/swift/${SwiftCore_PLATFORM_SUBDIR}/${SwiftCore_ARCH_SUBDIR}"
158158
RENAME swiftrt.o)
159159
elseif("${SwiftCore_OBJECT_FORMAT}" STREQUAL "coffx")
160+
add_library(swiftrtT OBJECT SwiftRT-COFF.cpp)
161+
target_compile_definitions(swiftrtT PRIVATE
162+
SWIFT_STATIC_STDLIB)
163+
target_link_libraries(swiftrtT PRIVATE swiftShims)
164+
install(FILES $<TARGET_OBJECTS:swiftrtT>
165+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/swift/${SwiftCore_PLATFORM_SUBDIR}/${SwiftCore_ARCH_SUBDIR}"
166+
RENAME swiftrtT.obj)
167+
160168
add_library(swiftrt OBJECT SwiftRT-COFF.cpp)
161-
target_compile_definitions(swiftrt PRIVATE
162-
$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:SWIFT_STATIC_STDLIB>)
163169
target_link_libraries(swiftrt PRIVATE swiftShims)
164170
install(FILES $<TARGET_OBJECTS:swiftrt>
165-
# The driver requires that swifrt.obj is under `usr/lib/swift/<platform>/<arch>`
166-
# Regardless of settings
167171
DESTINATION "${CMAKE_INSTALL_LIBDIR}/swift/${SwiftCore_PLATFORM_SUBDIR}/${SwiftCore_ARCH_SUBDIR}"
168172
RENAME swiftrt.obj)
169173
elseif(NOT "${SwiftCore_OBJECT_FORMAT}" STREQUAL "x")

0 commit comments

Comments
 (0)