Skip to content

Commit a3f1282

Browse files
Merge branch 'main' into katei/merge-960d0e3
2 parents 02864f6 + 960d0e3 commit a3f1282

File tree

5 files changed

+17
-72
lines changed

5 files changed

+17
-72
lines changed

stdlib/public/core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ elseif(SWIFT_PRIMARY_VARIANT_SDK STREQUAL FREEBSD)
274274
${SWIFTLIB_DIR}/clang/lib/freebsd/libclang_rt.builtins-${SWIFT_PRIMARY_VARIANT_ARCH}.a)
275275
elseif(SWIFT_PRIMARY_VARIANT_SDK STREQUAL LINUX)
276276
if(SWIFT_BUILD_STATIC_STDLIB)
277-
list(APPEND swift_core_private_link_libraries swiftImageInspectionShared)
277+
list(APPEND swift_core_private_link_libraries)
278278
endif()
279279
elseif(SWIFT_PRIMARY_VARIANT_SDK STREQUAL WINDOWS)
280280
list(APPEND swift_core_private_link_libraries shell32;DbgHelp)

stdlib/public/runtime/CMakeLists.txt

Lines changed: 3 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -81,59 +81,11 @@ set(swift_runtime_library_compile_flags ${swift_runtime_compile_flags})
8181
list(APPEND swift_runtime_library_compile_flags -DswiftCore_EXPORTS)
8282
list(APPEND swift_runtime_library_compile_flags -I${SWIFT_SOURCE_DIR}/stdlib/include/llvm/Support -I${SWIFT_SOURCE_DIR}/include)
8383

84-
set(static_binary_lnk_file_list)
85-
set(static_binary_dependencies_list)
8684
macro(add_image_inspection_shared sdk primary_arch inspection_file linkfile_src)
87-
if(${inspection_file} IN_LIST swift_runtime_sources)
88-
list(REMOVE_ITEM swift_runtime_sources ${inspection_file})
89-
endif()
85+
set(static_binary_lnk_file_list)
9086
string(TOLOWER "${sdk}" lowercase_sdk)
9187

92-
# These two libraries are only used with the static swiftcore
93-
add_swift_target_library(swiftImageInspectionShared STATIC
94-
${inspection_file}
95-
C_COMPILE_FLAGS ${swift_runtime_library_compile_flags}
96-
LINK_FLAGS ${swift_runtime_linker_flags}
97-
SWIFT_COMPILE_FLAGS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
98-
TARGET_SDKS ${sdk}
99-
INSTALL_IN_COMPONENT stdlib)
100-
101-
foreach(arch IN LISTS SWIFT_SDK_${sdk}_ARCHITECTURES)
102-
set(FragileSupportLibrary swiftImageInspectionShared-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch})
103-
set(LibraryLocation ${SWIFTSTATICLIB_DIR}/${lowercase_sdk}/${arch})
104-
105-
add_custom_command_target(swift_image_inspection_${lowercase_sdk}_${arch}_static
106-
COMMAND
107-
"${CMAKE_COMMAND}" -E copy $<TARGET_FILE:${FragileSupportLibrary}> ${LibraryLocation}
108-
OUTPUT
109-
"${LibraryLocation}/${CMAKE_STATIC_LIBRARY_PREFIX}swiftImageInspectionShared${CMAKE_STATIC_LIBRARY_SUFFIX}"
110-
DEPENDS
111-
${FragileSupportLibrary})
112-
113-
list(APPEND static_binary_dependencies_list ${swift_image_inspection_${lowercase_sdk}_${arch}_static})
114-
add_dependencies(stdlib ${FragileSupportLibrary})
115-
swift_install_in_component(FILES $<TARGET_FILE:${FragileSupportLibrary}>
116-
DESTINATION "lib/swift_static/${lowercase_sdk}/${arch}"
117-
COMPONENT stdlib)
118-
endforeach()
119-
120-
if(NOT "${primary_arch}" STREQUAL "")
121-
set(FragileSupportLibraryPrimary swiftImageInspectionShared-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${primary_arch})
122-
set(LibraryLocationPrimary ${SWIFTSTATICLIB_DIR}/${lowercase_sdk})
123-
add_custom_command_target(swift_image_inspection_static_${lowercase_sdk}_primary_arch
124-
COMMAND
125-
"${CMAKE_COMMAND}" -E copy $<TARGET_FILE:${FragileSupportLibraryPrimary}> ${LibraryLocationPrimary}
126-
OUTPUT
127-
"${LibraryLocationPrimary}/${CMAKE_STATIC_LIBRARY_PREFIX}swiftImageInspectionShared${CMAKE_STATIC_LIBRARY_SUFFIX}"
128-
DEPENDS
129-
${FragileSupportLibraryPrimary})
130-
list(APPEND static_binary_dependencies_list ${swift_image_inspection_static_${lowercase_sdk}_primary_arch})
131-
add_dependencies(stdlib ${FragileSupportLibraryPrimary})
132-
swift_install_in_component(FILES $<TARGET_FILE:${FragileSupportLibraryPrimary}>
133-
DESTINATION "lib/swift_static/${lowercase_sdk}"
134-
COMPONENT stdlib)
135-
endif()
136-
88+
# Generate the static-executable-args.lnk file used for ELF systems (eg linux)
13789
set(linkfile "${lowercase_sdk}/static-executable-args.lnk")
13890
add_custom_command_target(swift_static_binary_${sdk}_args
13991
COMMAND
@@ -149,14 +101,6 @@ macro(add_image_inspection_shared sdk primary_arch inspection_file linkfile_src)
149101
swift_install_in_component(FILES "${SWIFTSTATICLIB_DIR}/${linkfile}"
150102
DESTINATION "lib/swift_static/${lowercase_sdk}"
151103
COMPONENT stdlib)
152-
153-
add_swift_target_library(swiftImageInspectionSharedObject OBJECT_LIBRARY
154-
${inspection_file}
155-
C_COMPILE_FLAGS ${swift_runtime_library_compile_flags}
156-
LINK_FLAGS ${swift_runtime_linker_flags}
157-
SWIFT_COMPILE_FLAGS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
158-
TARGET_SDKS ${sdk}
159-
INSTALL_IN_COMPONENT never_install)
160104
endmacro()
161105

162106
set(is_image_inspection_required)
@@ -194,7 +138,7 @@ foreach(sdk IN LISTS SWIFT_SDKS)
194138
endforeach()
195139

196140
if(is_image_inspection_required)
197-
add_custom_target(static_binary_magic ALL DEPENDS ${static_binary_lnk_file_list} ${static_binary_dependencies_list})
141+
add_custom_target(static_binary_magic ALL DEPENDS ${static_binary_lnk_file_list})
198142
add_dependencies(stdlib static_binary_magic)
199143
endif()
200144

@@ -338,7 +282,6 @@ foreach(sdk ${SWIFT_CONFIGURED_SDKS})
338282
-ldl
339283
-lpthread
340284
-lswiftCore
341-
-lswiftImageInspectionShared
342285
${libicu_i18n_a}
343286
${libicu_uc_a}
344287
${libicu_data_a}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Build a static executable "hello world" program
2+
// REQUIRES: OS=linux-gnu
3+
// REQUIRES: static_stdlib
4+
print("hello world!")
5+
// RUN: %empty-directory(%t)
6+
// RUN: %target-swiftc_driver -static-executable -o %t/static-executable %s
7+
// RUN: %t/static-executable | %FileCheck %s
8+
// RUN: file %t/static-executable | %FileCheck %s --check-prefix=FILE
9+
// CHECK: hello world!
10+
// FILE: , statically linked,

unittests/runtime/CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ if(("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "${SWIFT_PRIMARY_VARIANT_SDK}") AND
2828
endif()
2929
endif()
3030

31-
set(swift_runtime_test_extra_libraries)
32-
if(SWIFT_BUILD_STATIC_STDLIB AND "${SWIFT_HOST_VARIANT_SDK}" STREQUAL "LINUX")
33-
list(APPEND swift_runtime_test_extra_libraries
34-
$<TARGET_FILE:swiftImageInspectionShared-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}-${SWIFT_HOST_VARIANT_ARCH}>)
35-
endif()
36-
3731
add_subdirectory(LongTests)
3832

3933
set(PLATFORM_SOURCES)
@@ -94,7 +88,6 @@ if(("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "${SWIFT_PRIMARY_VARIANT_SDK}") AND
9488
PRIVATE
9589
swiftCore${SWIFT_PRIMARY_VARIANT_SUFFIX}
9690
${PLATFORM_TARGET_LINK_LIBRARIES}
97-
${swift_runtime_test_extra_libraries}
9891
)
9992
endif()
10093

utils/static-executable-args.lnk

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
-static
22
-lswiftCore
3-
-lswiftImageInspectionShared
43
-Xlinker
5-
--defsym=__import_pthread_self=pthread_self
4+
-undefined=pthread_self
65
-Xlinker
7-
--defsym=__import_pthread_once=pthread_once
6+
-undefined=pthread_once
87
-Xlinker
9-
--defsym=__import_pthread_key_create=pthread_key_create
8+
-undefined=pthread_key_create
109
-lpthread
1110
-licui18nswift
1211
-licuucswift

0 commit comments

Comments
 (0)