From dbf2c150b9ab42db39e45d80c8b77cfbaf2bf929 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Tue, 2 May 2023 17:38:51 +0100 Subject: [PATCH] Revert "Merge pull request #64312 from gwynne/patch-2" This reverts commit 1b64e769e0b125ac627874aba752c287b6219b80, reversing changes made to 5ef25e75427df4da0a4951def2c9830780de797a. --- lib/DriverTool/autolink_extract_main.cpp | 60 +++++------------------- 1 file changed, 12 insertions(+), 48 deletions(-) diff --git a/lib/DriverTool/autolink_extract_main.cpp b/lib/DriverTool/autolink_extract_main.cpp index 1f2538e1ac6e1..efcbbb1e096ab 100644 --- a/lib/DriverTool/autolink_extract_main.cpp +++ b/lib/DriverTool/autolink_extract_main.cpp @@ -243,50 +243,16 @@ int autolink_extract_main(ArrayRef Args, const char *Argv0, std::vector LinkerFlags; // Keep track of whether we've already added the common - // Swift libraries that usually have autolink directives - // in most object files - - std::vector SwiftRuntimeLibsOrdered = { - // Common Swift runtime libs - "-lswiftSwiftOnoneSupport", - "-lswiftCore", - "-lswift_Concurrency", - "-lswift_StringProcessing", - "-lswift_RegexBuilder", - "-lswift_RegexParser", - "-lswift_Backtracing", - "-lswiftGlibc", - "-lBlocksRuntime", - // Dispatch-specific Swift runtime libs - "-ldispatch", - "-lDispatchStubs", - "-lswiftDispatch", - // CoreFoundation and Foundation Swift runtime libs - "-lCoreFoundation", - "-lFoundation", - "-lFoundationNetworking", - "-lFoundationXML", - // Foundation support libs - "-lcurl", - "-lxml2", - "-luuid", - // XCTest runtime libs (must be first due to http://github.com/apple/swift-corelibs-xctest/issues/432) - "-lXCTest", - // ICU Swift runtime libs - "-licui18nswift", - "-licuucswift", - "-licudataswift", - // Common-use ordering-agnostic Linux system libs - "-lm", - "-lpthread", - "-lutil", - "-ldl", - "-lz", + // Swift libraries that ususally have autolink directives + // in most object fiels + std::unordered_map SwiftRuntimeLibraries = { + {"-lswiftSwiftOnoneSupport", false}, + {"-lswiftCore", false}, + {"-lswift_Concurrency", false}, + {"-lswift_StringProcessing", false}, + {"-lswift_RegexParser", false}, + {"-lswift_Backtracing", false}, }; - std::unordered_map SwiftRuntimeLibraries; - for (const auto &RuntimeLib : SwiftRuntimeLibsOrdered) { - SwiftRuntimeLibraries[RuntimeLib] = false; - } // Extract the linker flags from the objects. for (const auto &BinaryFileName : Invocation.getInputFilenames()) { @@ -323,11 +289,9 @@ int autolink_extract_main(ArrayRef Args, const char *Argv0, OutOS << Flag << '\n'; } - for (const auto &RuntimeLib : SwiftRuntimeLibsOrdered) { - auto entry = SwiftRuntimeLibraries.find(RuntimeLib); - if (entry != SwiftRuntimeLibraries.end() && entry->second) { - OutOS << entry->first << '\n'; - } + for (const auto &RuntimeLib : SwiftRuntimeLibraries) { + if (RuntimeLib.second) + OutOS << RuntimeLib.first << '\n'; }