From cd1db4a575ad717ad95bc471e0d2b52731b03fbd Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 9 Oct 2025 06:56:58 +0000 Subject: [PATCH] [autolink-extract] Update deduplication list for new Foundation, Testing, 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 https://github.com/swiftlang/swift/issues/58380 --- lib/DriverTool/autolink_extract_main.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/DriverTool/autolink_extract_main.cpp b/lib/DriverTool/autolink_extract_main.cpp index 074d1cd68af33..72fd813aba70c 100644 --- a/lib/DriverTool/autolink_extract_main.cpp +++ b/lib/DriverTool/autolink_extract_main.cpp @@ -236,6 +236,7 @@ int autolink_extract_main(ArrayRef Args, const char *Argv0, "-lswiftSynchronization", "-lswiftGlibc", "-lswiftAndroid", + "-lswiftWASILibc", "-lBlocksRuntime", // Dispatch-specific Swift runtime libs "-ldispatch", @@ -249,6 +250,9 @@ int autolink_extract_main(ArrayRef Args, const char *Argv0, "-lFoundationInternationalization", "-lFoundationNetworking", "-lFoundationXML", + "-l_CFXMLInterface", + "-l_FoundationCShims", + "-l_FoundationCollections", // Foundation support libs "-lcurl", "-lxml2", @@ -256,12 +260,20 @@ int autolink_extract_main(ArrayRef Args, const char *Argv0, "-lTesting", // XCTest runtime libs (must be first due to http://github.com/apple/swift-corelibs-xctest/issues/432) "-lXCTest", + // swift-testing libraries + "-l_TestingInternals", + "-l_TestDiscovery", + "-l_Testing_Foundation", // Common-use ordering-agnostic Linux system libs "-lm", "-lpthread", "-lutil", "-ldl", "-lz", + // Common-use ordering-agnostic WASI system libs + "-lwasi-emulated-getpid", + "-lwasi-emulated-mman", + "-lwasi-emulated-signal", }; std::unordered_map SwiftRuntimeLibraries; for (const auto &RuntimeLib : SwiftRuntimeLibsOrdered) {