Skip to content

[Explicit Module Builds] Adopt dependency scanner Link Libraries support #1622

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

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented May 24, 2024

  • Adopt new libSwiftScan API to query link libraries for each module dependency
  • Introduce '-explicit-auto-linking' to turn explicit dependency link library information into flags passed directly to the linker invocation

@artemcm artemcm force-pushed the ExplicitAutoLinkScanner branch from efa6ef1 to 34ce383 Compare May 28, 2024 18:47
@artemcm artemcm marked this pull request as ready for review May 28, 2024 18:48
@artemcm artemcm force-pushed the ExplicitAutoLinkScanner branch from 34ce383 to 9354e07 Compare May 28, 2024 19:51
@artemcm
Copy link
Contributor Author

artemcm commented May 28, 2024

@swift-ci test

Copy link
Contributor

@cachemeifyoucan cachemeifyoucan left a comment

Choose a reason for hiding this comment

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

Looks good in general from swift-driver side. Need to double check the swift side.

@@ -18,7 +18,7 @@
#include <stdint.h>

#define SWIFTSCAN_VERSION_MAJOR 0
#define SWIFTSCAN_VERSION_MINOR 6
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we check if we bump this, we are not missing any APIs that in the range of 7-9?

}
}

for linkLibrary in allLinkLibraries {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know the corresponding scanner change. Does the library here guaranteed to be found by linker? Also does force-linking does anything in the link here in logics? Maybe considering just pass force-linked library with full path (so linker can't drop them) and stop emitting force-linking symbols.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The library is not guaranteed to be found, no. On Darwin the linker treats load directives for auto-linked libraries and frameworks as essentially "optional".

On non-Darwin today we just end up with a collection of -l flags via swift-autolink-extract, so the behavior introduced here would be identical.

I'd like to still add this new behavior behind a flag in this PR, and consider the optionality of load directives and determining whether the linked binary exists separately.

@artemcm artemcm force-pushed the ExplicitAutoLinkScanner branch from 9354e07 to 34f60a2 Compare June 3, 2024 17:55
@artemcm
Copy link
Contributor Author

artemcm commented Jun 4, 2024

@swift-ci test

- Adopt new libSwiftScan API to query link libraries for each module dependency
- Introduce '-explicit-auto-linking' to turn explicit dependency link library information into flags passed directly to the linker invocation
@artemcm artemcm force-pushed the ExplicitAutoLinkScanner branch from 34f60a2 to 6646c38 Compare June 4, 2024 16:46
@artemcm
Copy link
Contributor Author

artemcm commented Jun 4, 2024

@swift-ci test

@artemcm
Copy link
Contributor Author

artemcm commented Jun 5, 2024

@swift-ci test Windows platform

@artemcm artemcm merged commit b0300a8 into swiftlang:main Jun 6, 2024
3 checks passed
@artemcm artemcm deleted the ExplicitAutoLinkScanner branch June 6, 2024 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants