Skip to content

Reordering autolink-extract runtime orderings #65375

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 14 additions & 18 deletions lib/DriverTool/autolink_extract_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,35 +217,31 @@ int autolink_extract_main(ArrayRef<const char *> Args, const char *Argv0,
// in most object files

std::vector<std::string> SwiftRuntimeLibsOrdered = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this benefit from a code comment for posterity that clarifies that ordering matters here and why it's ordered the way it is?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should probably also be a note that it's safe to list all libraries in this list regardless of whether any given link operation actually uses any particular library or whether the library exists in the "current" toolchain (the list only controls ordering and deduplication).

// Common Swift runtime libs
"-lswiftSwiftOnoneSupport",
"-lswiftCore",
"-lswift_Concurrency",
"-lFoundationXML",
"-lFoundationNetworking",
"-lFoundation",
"-lswiftDispatch",
"-lswiftRegexBuilder",
"-lswift_Backtracing",
"-lswift_StringProcessing",
"-lswift_RegexBuilder",
"-lswift_RegexParser",
"-lswift_Backtracing",
"-lswift_Concurrency",
"-lswiftGlibc",
"-lBlocksRuntime",
// Dispatch-specific Swift runtime libs
"-lswiftSwiftOnoneSupport",
"-lswiftCore",
"-lCoreFoundation",
"-licui18nswift",
"-licuucswift",
"-licudataswift",
"-ldispatch",
"-lBlocksRuntime",
"-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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well also fix my silly comment typo from way back in my original PR while we're at it:

Suggested change
// XCTest runtime libs (must be first due to http://github.com/apple/swift-corelibs-xctest/issues/432)
// XCTest runtime libs (must come after runtime libs due to https://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",
Expand Down