-
Notifications
You must be signed in to change notification settings - Fork 199
[Explicit Module Builds] Move generation of explicit auto-link flags to a toolchain-specific method #1874
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
[Explicit Module Builds] Move generation of explicit auto-link flags to a toolchain-specific method #1874
Conversation
@swift-ci test |
@swift-ci test Linux platform |
2d6d7a9
to
85c26cb
Compare
@swift-ci test |
@swift-ci test Windows platform |
1 similar comment
@swift-ci test Windows platform |
…to a toolchain-specific method This way we can adopt a feature of a specific platform's linker separately from the others
85c26cb
to
20a42b6
Compare
@swift-ci test |
@swift-ci test Windows platform |
for linkLibrary in linkLibraries { | ||
if !linkLibrary.isFramework { | ||
commandLine.appendFlag(.Xlinker) | ||
commandLine.appendFlag("-possible-l\(linkLibrary.linkName)") |
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.
Do we have a rule for what is the linker compatibility from swift-driver? This is quite a new option that doesn't work with older linker and doesn't work with ld-classic
.
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.
We do not, but since this entire code-path is currently behind an opt-in flag (-explicit-auto-linking
), my thinking is to defer to the client to figure that out, at the moment. We have some precedent in swift-build
of enabling compiler features based on the current system linker version.
On Darwin, with older linkers which do not support this option, this feature does not really make much sense anyway since using the non--possible
flags changes the semantics too much compared to the current auto-linking mechanism (load directives in object files).
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 am fine with defer to swift-build to figure out but if you use the option from command-line, there is no link that the error message of unknown linker flag has anything to do with -explicit-auto-linking
?
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.
No, there's not really a link there. I'm not sure I see an obvious way to establish such a link, especially given that we use clang
as the linker driver. Maybe we could emit a warning when the user enables this feature, but that's got its own obvious downsides. And I'm not sure it's worth it, given that this is a fully opt-in behavior.
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 don't have better idea either.
-possible_l*
and-possible_framework *
flags on Darwin platforms.