- Notifications
You must be signed in to change notification settings - Fork 10.6k
[autolink-extract] Update deduplication list for new Foundation, Testing, and WASI platform #84784
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
base: main
Are you sure you want to change the base?
[autolink-extract] Update deduplication list for new Foundation, Testing, and WASI platform #84784
Conversation
…ing, and WASI platform We now have several new runtime libraries in the toolchain but they are not listed in the autolink deduplication list. This can lead to an excessive memory footprint when linking on platforms that use autolink-extract. See swiftlang#58380
@swift-ci smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All for half of these, not sure about the others.
"-lFoundationInternationalization", | ||
"-lFoundationNetworking", | ||
"-lFoundationXML", | ||
"-l_CFXMLInterface", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a static-only CoreFoundation library: I thought we weren't supposed to publicly link these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, yes. They are static-only libraries and we static-link everything. They are not supposed to be imported at code, so they don't have their corresponding .swiftmodule but we still ship their archives. So those link options are embedded in the client of those private modules (in this case, FoundationXML.swiftmodule) through -public-autolink-library
https://github.com/swiftlang/swift-corelibs-foundation/blob/ec675206c8cd939fbd4783421ea07954dcb5e175/Sources/FoundationXML/CMakeLists.txt#L33-L47
"-lFoundationNetworking", | ||
"-lFoundationXML", | ||
"-l_CFXMLInterface", | ||
"-l_FoundationCShims", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another static-only library, bit taken aback since the first time I'm seeing these listed here, sure you need this?
"-lFoundationXML", | ||
"-l_CFXMLInterface", | ||
"-l_FoundationCShims", | ||
"-l_FoundationCollections", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, static-only, I guess you're static linking the runtime libraries much more for Wasm binaries?
"-lXCTest", | ||
// swift-testing libraries | ||
"-l_TestingInternals", | ||
"-l_TestDiscovery", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see either of these in the linux SDK, Wasm only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are also static-only libraries, installed only when building swift-testing with BUILD_SHARED_LIBS=OFF
.
https://github.com/swiftlang/swift-testing/blob/fa1e095b316b9925dd5cc7fafc5d67825a07cd52/Sources/_TestingInternals/CMakeLists.txt#L31
Other platform toolchains/SDKs don't have it because they always build it as shared libraries.
We now have several new runtime libraries in the toolchain but they are not listed in the autolink deduplication list. This can lead to an excessive memory footprint when linking on platforms that use autolink-extract.
See #58380
As a data point, this change reduced the memory footprint of our wasm-ld process from 33.34 GiB → 2.22 GiB and link time from 46.4 s → 1.4 s.