mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Okay, let's try actually having an ordering if we're trying to use an ordering
This commit is contained in:
@@ -245,43 +245,48 @@ int autolink_extract_main(ArrayRef<const char *> Args, const char *Argv0,
|
||||
// Keep track of whether we've already added the common
|
||||
// Swift libraries that usually have autolink directives
|
||||
// in most object files
|
||||
std::unordered_map<std::string, bool> SwiftRuntimeLibraries = {
|
||||
|
||||
std::vector<std::string> SwiftRuntimeLibsOrdered = {
|
||||
// XCTest runtime libs (must be first due to http://github.com/apple/swift-corelibs-xctest/issues/432)
|
||||
{"-lXCTest", false},
|
||||
"-lXCTest",
|
||||
// Common Swift runtime libs
|
||||
{"-lswiftSwiftOnoneSupport", false},
|
||||
{"-lswiftCore", false},
|
||||
{"-lswift_Concurrency", false},
|
||||
{"-lswift_StringProcessing", false},
|
||||
{"-lswift_RegexBuilder", false},
|
||||
{"-lswift_RegexParser", false},
|
||||
{"-lswift_Backtracing", false},
|
||||
{"-lswiftGlibc", false},
|
||||
{"-lBlocksRuntime", false},
|
||||
"-lswiftSwiftOnoneSupport",
|
||||
"-lswiftCore",
|
||||
"-lswift_Concurrency",
|
||||
"-lswift_StringProcessing",
|
||||
"-lswift_RegexBuilder",
|
||||
"-lswift_RegexParser",
|
||||
"-lswift_Backtracing",
|
||||
"-lswiftGlibc",
|
||||
"-lBlocksRuntime",
|
||||
// Dispatch-specific Swift runtime libs
|
||||
{"-ldispatch", false},
|
||||
{"-lDispatchStubs", false},
|
||||
{"-lswiftDispatch", false},
|
||||
"-ldispatch",
|
||||
"-lDispatchStubs",
|
||||
"-lswiftDispatch",
|
||||
// CoreFoundation and Foundation Swift runtime libs
|
||||
{"-lCoreFoundation", false},
|
||||
{"-lFoundation", false},
|
||||
{"-lFoundationNetworking", false},
|
||||
{"-lFoundationXML", false},
|
||||
"-lCoreFoundation",
|
||||
"-lFoundation",
|
||||
"-lFoundationNetworking",
|
||||
"-lFoundationXML",
|
||||
// Foundation support libs
|
||||
{"-lcurl", false},
|
||||
{"-lxml2", false},
|
||||
{"-luuid", false},
|
||||
"-lcurl",
|
||||
"-lxml2",
|
||||
"-luuid",
|
||||
// ICU Swift runtime libs
|
||||
{"-licui18nswift", false},
|
||||
{"-licuucswift", false},
|
||||
{"-licudataswift", false},
|
||||
"-licui18nswift",
|
||||
"-licuucswift",
|
||||
"-licudataswift",
|
||||
// Common-use ordering-agnostic Linux system libs
|
||||
{"-lm", false},
|
||||
{"-lpthread", false},
|
||||
{"-lutil", false},
|
||||
{"-ldl", false},
|
||||
{"-lz", false},
|
||||
"-lm",
|
||||
"-lpthread",
|
||||
"-lutil",
|
||||
"-ldl",
|
||||
"-lz",
|
||||
};
|
||||
std::unordered_map<std::string, bool> SwiftRuntimeLibraries;
|
||||
for (const auto &RuntimeLib : SwiftRuntimeLibsOrdered) {
|
||||
SwiftRuntimeLibraries[RuntimeLib] = false;
|
||||
}
|
||||
|
||||
// Extract the linker flags from the objects.
|
||||
for (const auto &BinaryFileName : Invocation.getInputFilenames()) {
|
||||
@@ -318,9 +323,11 @@ int autolink_extract_main(ArrayRef<const char *> Args, const char *Argv0,
|
||||
OutOS << Flag << '\n';
|
||||
}
|
||||
|
||||
for (const auto &RuntimeLib : SwiftRuntimeLibraries) {
|
||||
if (RuntimeLib.second)
|
||||
OutOS << RuntimeLib.first << '\n';
|
||||
for (const auto &RuntimeLib : SwiftRuntimeLibsOrdered) {
|
||||
auto entry = SwiftRuntimeLibraries.find(RuntimeLib);
|
||||
if (entry != SwiftRuntimeLibraries.end() && entry->second) {
|
||||
OutOS << entry->first << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user