Skip to content
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

Revert "Merge pull request #64312 from gwynne/patch-2" #65585

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
60 changes: 12 additions & 48 deletions lib/DriverTool/autolink_extract_main.cpp
Expand Up @@ -243,50 +243,16 @@ int autolink_extract_main(ArrayRef<const char *> Args, const char *Argv0,
std::vector<std::string> LinkerFlags;

// Keep track of whether we've already added the common
// Swift libraries that usually have autolink directives
// in most object files

std::vector<std::string> 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<std::string, bool> SwiftRuntimeLibraries = {
{"-lswiftSwiftOnoneSupport", false},
{"-lswiftCore", false},
{"-lswift_Concurrency", false},
{"-lswift_StringProcessing", false},
{"-lswift_RegexParser", false},
{"-lswift_Backtracing", false},
};
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()) {
Expand Down Expand Up @@ -323,11 +289,9 @@ int autolink_extract_main(ArrayRef<const char *> 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';
}


Expand Down