Skip to content

Commit 4b9e9d3

Browse files
committed
build: excise the concept of fat libraries
This was used for the swift-reflection-test tool. Instead of using fat binaries, use the target binary itself. This simplifies the build logic as well as paves the road to sub-builds for each target rather than a monolithic build as we have today. Originally, the swift-reflection-test was a host tool that linked against the target libraries since it was testing the target layout. Now that the tool has been split into a host and target component (5ea5bb0) and we have target and host libraries that we can link against appropriately, we do not need to link against the FAT binary. Since there was exactly one use of this functionality, switching that from fat linking to regular linking allows us to remove this functionality entirely. Switch to regular linking and remove the option.
1 parent d36af3b commit 4b9e9d3

File tree

3 files changed

+14
-40
lines changed

3 files changed

+14
-40
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,15 +2104,12 @@ endfunction()
21042104
#
21052105
# [ARCHITECTURE architecture]
21062106
# Architecture to build for.
2107-
#
2108-
# [LINK_FAT_LIBRARIES lipo_target1 ...]
2109-
# Fat libraries to link with.
21102107
function(_add_swift_executable_single name)
21112108
# Parse the arguments we were given.
21122109
cmake_parse_arguments(SWIFTEXE_SINGLE
21132110
"EXCLUDE_FROM_ALL"
21142111
"SDK;ARCHITECTURE"
2115-
"DEPENDS;LLVM_COMPONENT_DEPENDS;LINK_LIBRARIES;LINK_FAT_LIBRARIES;COMPILE_FLAGS"
2112+
"DEPENDS;LLVM_COMPONENT_DEPENDS;LINK_LIBRARIES;COMPILE_FLAGS"
21162113
${ARGN})
21172114

21182115
set(SWIFTEXE_SINGLE_SOURCES ${SWIFTEXE_SINGLE_UNPARSED_ARGUMENTS})
@@ -2160,27 +2157,11 @@ function(_add_swift_executable_single name)
21602157
"-Xlinker" "@executable_path/../lib/swift/${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}")
21612158
endif()
21622159

2163-
# Find the names of dependency library targets.
2164-
#
2165-
# We don't add the ${ARCH} to the target suffix because we want to link
2166-
# against fat libraries. This only works for the Darwin targets as MachO is
2167-
# the only format with the fat libraries.
2168-
if(${SWIFTEXE_SINGLE_SDK} IN_LIST SWIFT_APPLE_PLATFORMS)
2169-
_list_add_string_suffix(
2170-
"${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES}"
2171-
"-${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}"
2172-
SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES_TARGETS)
2173-
_list_add_string_suffix(
2174-
"${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES}"
2175-
"-${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}-${SWIFTEXE_SINGLE_ARCHITECTURE}"
2176-
SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES)
2177-
else()
2178-
_list_add_string_suffix(
2179-
"${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES}"
2180-
"-${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}-${SWIFTEXE_SINGLE_ARCHITECTURE}"
2181-
SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES_TARGETS)
2182-
set(SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES ${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES_TARGETS})
2183-
endif()
2160+
_list_add_string_suffix(
2161+
"${SWIFTEXE_SINGLE_LINK_LIBRARIES}"
2162+
"-${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}-${SWIFTEXE_SINGLE_ARCHITECTURE}"
2163+
SWIFTEXE_SINGLE_LINK_LIBRARIES_TARGETS)
2164+
set(SWIFTEXE_SINGLE_LINK_LIBRARIES ${SWIFTEXE_SINGLE_LINK_LIBRARIES_TARGETS})
21842165

21852166
handle_swift_sources(
21862167
dependency_target
@@ -2191,7 +2172,6 @@ function(_add_swift_executable_single name)
21912172
SWIFTEXE_SINGLE_SOURCES SWIFTEXE_SINGLE_EXTERNAL_SOURCES ${name}
21922173
DEPENDS
21932174
${SWIFTEXE_SINGLE_DEPENDS}
2194-
${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES_TARGETS}
21952175
MODULE_NAME ${name}
21962176
SDK ${SWIFTEXE_SINGLE_SDK}
21972177
ARCHITECTURE ${SWIFTEXE_SINGLE_ARCHITECTURE}
@@ -2209,8 +2189,7 @@ function(_add_swift_executable_single name)
22092189
DEPENDS
22102190
${dependency_target}
22112191
${LLVM_COMMON_DEPENDS}
2212-
${SWIFTEXE_SINGLE_DEPENDS}
2213-
${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES_TARGETS})
2192+
${SWIFTEXE_SINGLE_DEPENDS})
22142193
llvm_update_compile_flags("${name}")
22152194

22162195
# Convert variables to space-separated strings.
@@ -2230,11 +2209,10 @@ function(_add_swift_executable_single name)
22302209
BINARY_DIR ${SWIFT_RUNTIME_OUTPUT_INTDIR}
22312210
LIBRARY_DIR ${SWIFT_LIBRARY_OUTPUT_INTDIR})
22322211

2233-
target_link_libraries("${name}" PRIVATE ${SWIFTEXE_SINGLE_LINK_LIBRARIES} ${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES})
2212+
target_link_libraries("${name}" PRIVATE ${SWIFTEXE_SINGLE_LINK_LIBRARIES})
22342213
swift_common_llvm_config("${name}" ${SWIFTEXE_SINGLE_LLVM_COMPONENT_DEPENDS})
22352214

2236-
set_target_properties(${name}
2237-
PROPERTIES FOLDER "Swift executables")
2215+
set_target_properties(${name} PROPERTIES FOLDER "Swift executables")
22382216
endfunction()
22392217

22402218
macro(add_swift_tool_subdirectory name)

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,12 @@ include(AddSwift)
55
# with the variant SDK and ARCH.
66
#
77
# See add_swift_executable for detailed documentation.
8-
#
9-
# Additional parameters:
10-
# [LINK_FAT_LIBRARIES lipo_target1 ...]
11-
# Fat libraries to link with.
128
function(add_swift_target_executable name)
139
# Parse the arguments we were given.
1410
cmake_parse_arguments(SWIFTEXE_TARGET
1511
"EXCLUDE_FROM_ALL;;BUILD_WITH_STDLIB"
1612
""
17-
"DEPENDS;LLVM_COMPONENT_DEPENDS;LINK_FAT_LIBRARIES"
13+
"DEPENDS;LLVM_COMPONENT_DEPENDS;LINK_LIBRARIES"
1814
${ARGN})
1915

2016
set(SWIFTEXE_TARGET_SOURCES ${SWIFTEXE_TARGET_UNPARSED_ARGUMENTS})
@@ -24,12 +20,12 @@ function(add_swift_target_executable name)
2420
SWIFTEXE_TARGET_EXCLUDE_FROM_ALL_FLAG)
2521

2622
# All Swift executables depend on the standard library.
27-
list(APPEND SWIFTEXE_TARGET_LINK_FAT_LIBRARIES swiftCore)
23+
list(APPEND SWIFTEXE_TARGET_LINK_LIBRARIES swiftCore)
2824
# All Swift executables depend on the swiftSwiftOnoneSupport library.
2925
list(APPEND SWIFTEXE_TARGET_DEPENDS swiftSwiftOnoneSupport)
3026

3127
if(NOT "${SWIFT_BUILD_STDLIB}")
32-
list(REMOVE_ITEM SWIFTEXE_TARGET_LINK_FAT_LIBRARIES
28+
list(REMOVE_ITEM SWIFTEXE_TARGET_LINK_LIBRARIES
3329
swiftCore)
3430
endif()
3531

@@ -63,7 +59,7 @@ function(add_swift_target_executable name)
6359
LLVM_COMPONENT_DEPENDS ${SWIFTEXE_TARGET_LLVM_COMPONENT_DEPENDS}
6460
SDK "${sdk}"
6561
ARCHITECTURE "${arch}"
66-
LINK_FAT_LIBRARIES ${SWIFTEXE_TARGET_LINK_FAT_LIBRARIES}
62+
LINK_LIBRARIES ${SWIFTEXE_TARGET_LINK_LIBRARIES}
6763
${SWIFTEXE_TARGET_EXCLUDE_FROM_ALL_FLAG_CURRENT})
6864

6965
if(${sdk} IN_LIST SWIFT_APPLE_PLATFORMS)

stdlib/tools/swift-reflection-test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
add_swift_target_executable(swift-reflection-test BUILD_WITH_STDLIB
22
swift-reflection-test.c
33
overrides.c
4-
LINK_FAT_LIBRARIES
4+
LINK_LIBRARIES
55
swiftRemoteMirror
66
swiftReflection)
77
# NOTE(compnerd) since _WINDLL has no impact on non-Windows targets,

0 commit comments

Comments
 (0)