Skip to content

Commit ca7a8fe

Browse files
committed
Enable LTO on the stdlib for the 'minimal' preset
1 parent 6de4ee8 commit ca7a8fe

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

test/lit.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,8 @@ if run_vendor == 'apple':
965965
# it by explicitly -l linking all libraries needed in tests.
966966
if "stdlib_lto" in config.available_features:
967967
for library in ["swiftCore", "swiftStdlibUnittest",
968+
"swiftStdlibUnicodeUnittest",
969+
"swiftStdlibCollectionUnittest",
968970
"swiftSwiftPrivateLibcExtras", "swiftSwiftPrivate",
969971
"swiftDarwin", "swiftSwiftPrivateThreadExtras",
970972
"swiftSwiftOnoneSupport"]:

utils/build-presets.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2469,6 +2469,7 @@ swift-stdlib-has-stdin=0
24692469
swift-runtime-static-image-inspection=1
24702470
swift-stdlib-single-threaded-runtime=1
24712471
swift-stdlib-os-versioning=0
2472+
swift-stdlib-lto=full
24722473
extra-cmake-options=
24732474
-DSWIFT_ENABLE_DISPATCH:BOOL=FALSE
24742475
-DSWIFT_IMPLICIT_CONCURRENCY_IMPORT:BOOL=FALSE

utils/build-script-impl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ KNOWN_SETTINGS=(
213213
swift-stdlib-stable-abi "" "should stdlib be built with stable ABI, if not set defaults to true on Darwin, false otherwise"
214214
swift-stdlib-has-darwin-libmalloc "1" "whether the Darwin build of stdlib can use extended libmalloc APIs"
215215
swift-stdlib-has-stdin "1" "whether to build stdlib assuming the platform supports stdin and getline API"
216+
swift-stdlib-lto "" "enable LLVM LTO on the stdlib, valid values are empty string (no LTO), 'full' and 'thin'"
216217
swift-disable-dead-stripping "0" "turns off Darwin-specific dead stripping for Swift host tools"
217218
common-swift-flags "" "Flags used for Swift targets other than the stdlib, like the corelibs"
218219

@@ -1988,6 +1989,7 @@ for host in "${ALL_HOSTS[@]}"; do
19881989
-DSWIFT_STDLIB_OS_VERSIONING:BOOL=$(true_false "${SWIFT_STDLIB_OS_VERSIONING}")
19891990
-DSWIFT_STDLIB_HAS_DARWIN_LIBMALLOC:BOOL=$(true_false "${SWIFT_STDLIB_HAS_DARWIN_LIBMALLOC}")
19901991
-DSWIFT_STDLIB_HAS_STDIN:BOOL=$(true_false "${SWIFT_STDLIB_HAS_STDIN}")
1992+
-DSWIFT_STDLIB_ENABLE_LTO:STRING="${SWIFT_STDLIB_LTO}"
19911993
-DSWIFT_NATIVE_LLVM_TOOLS_PATH:STRING="${native_llvm_tools_path}"
19921994
-DSWIFT_NATIVE_CLANG_TOOLS_PATH:STRING="${native_clang_tools_path}"
19931995
-DSWIFT_NATIVE_SWIFT_TOOLS_PATH:STRING="${native_swift_tools_path}"

validation-test/lit.site.cfg.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ if "@SWIFT_TOOLS_ENABLE_LTO@".lower() in ["full", "thin"]:
6868
else:
6969
config.available_features.add("no_lto")
7070

71+
if '@SWIFT_STDLIB_ENABLE_LTO@'.lower() in ['full', 'thin']:
72+
config.available_features.add('stdlib_lto')
73+
7174
if "@LLVM_ENABLE_ASSERTIONS@" == "TRUE":
7275
config.available_features.add('asserts')
7376
else:

0 commit comments

Comments
 (0)