Skip to content

Enable LTO on the stdlib for the 'minimal' preset #39292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions test/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,8 @@ if run_vendor == 'apple':
# it by explicitly -l linking all libraries needed in tests.
if "stdlib_lto" in config.available_features:
for library in ["swiftCore", "swiftStdlibUnittest",
"swiftStdlibUnicodeUnittest",
"swiftStdlibCollectionUnittest",
"swiftSwiftPrivateLibcExtras", "swiftSwiftPrivate",
"swiftDarwin", "swiftSwiftPrivateThreadExtras",
"swiftSwiftOnoneSupport"]:
Expand Down
1 change: 1 addition & 0 deletions utils/build-presets.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2469,6 +2469,7 @@ swift-stdlib-has-stdin=0
swift-runtime-static-image-inspection=1
swift-stdlib-single-threaded-runtime=1
swift-stdlib-os-versioning=0
swift-stdlib-lto=full
extra-cmake-options=
-DSWIFT_ENABLE_DISPATCH:BOOL=FALSE
-DSWIFT_IMPLICIT_CONCURRENCY_IMPORT:BOOL=FALSE
Expand Down
2 changes: 2 additions & 0 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ KNOWN_SETTINGS=(
swift-stdlib-stable-abi "" "should stdlib be built with stable ABI, if not set defaults to true on Darwin, false otherwise"
swift-stdlib-has-darwin-libmalloc "1" "whether the Darwin build of stdlib can use extended libmalloc APIs"
swift-stdlib-has-stdin "1" "whether to build stdlib assuming the platform supports stdin and getline API"
swift-stdlib-lto "" "enable LLVM LTO on the stdlib, valid values are empty string (no LTO), 'full' and 'thin'"
swift-disable-dead-stripping "0" "turns off Darwin-specific dead stripping for Swift host tools"
common-swift-flags "" "Flags used for Swift targets other than the stdlib, like the corelibs"

Expand Down Expand Up @@ -1988,6 +1989,7 @@ for host in "${ALL_HOSTS[@]}"; do
-DSWIFT_STDLIB_OS_VERSIONING:BOOL=$(true_false "${SWIFT_STDLIB_OS_VERSIONING}")
-DSWIFT_STDLIB_HAS_DARWIN_LIBMALLOC:BOOL=$(true_false "${SWIFT_STDLIB_HAS_DARWIN_LIBMALLOC}")
-DSWIFT_STDLIB_HAS_STDIN:BOOL=$(true_false "${SWIFT_STDLIB_HAS_STDIN}")
-DSWIFT_STDLIB_ENABLE_LTO:STRING="${SWIFT_STDLIB_LTO}"
-DSWIFT_NATIVE_LLVM_TOOLS_PATH:STRING="${native_llvm_tools_path}"
-DSWIFT_NATIVE_CLANG_TOOLS_PATH:STRING="${native_clang_tools_path}"
-DSWIFT_NATIVE_SWIFT_TOOLS_PATH:STRING="${native_swift_tools_path}"
Expand Down
3 changes: 3 additions & 0 deletions validation-test/lit.site.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ if "@SWIFT_TOOLS_ENABLE_LTO@".lower() in ["full", "thin"]:
else:
config.available_features.add("no_lto")

if '@SWIFT_STDLIB_ENABLE_LTO@'.lower() in ['full', 'thin']:
config.available_features.add('stdlib_lto')

if "@LLVM_ENABLE_ASSERTIONS@" == "TRUE":
config.available_features.add('asserts')
else:
Expand Down