-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Autolink Extract] Filter out common Swift libraries from being linked more than once #59063
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
Conversation
@swift-ci please test |
// Swift libraries that ususally have autolink directives | ||
// in most object fiels | ||
std::unordered_map<std::string, bool> CommonAddedSwiftLibraries = {{"-lswiftSwiftOnoneSupport", false}, | ||
{"-lswiftCore", false}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, -lswiftCore
should be added by the driver (and this tool is only ever invoked by the swift driver) ... so we could even eliminate it entirely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to put this change in a release asap so let's just de-duplicate it for now to be safe and then examine the duplication with the driver, too. Because it'd probably be better to remove this at the place where the directives get inserted, instead of completely removing here.
@@ -245,7 +275,7 @@ int autolink_extract_main(ArrayRef<const char *> Args, const char *Argv0, | |||
} | |||
|
|||
if (extractLinkerFlags(BinaryOwner->getBinary(), Instance, BinaryFileName, | |||
LinkerFlags)) { | |||
LinkerFlags, CommonAddedSwiftLibraries)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it makes sense to sink this entirely into the 3 instances, and use a constexpr
as an initializer?
…d more than once A partial solution to swiftlang#58380
34c1abe
to
3d30527
Compare
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This looks good! We may want to extend this to cover the string processing libraries and the regex libraires subsequently.
@swift-ci Please Build Toolchain Linux Platform |
A partial solution to #58380
We cannot filter all libraries because duplicate
-l
flags have a semantic meaning based on their order, but filtering out just the common Swift libraries should yield a good size improvement already and is safe.