-
Notifications
You must be signed in to change notification settings - Fork 199
[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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT | |
/// that specify said explicit module dependencies. | ||
@_spi(Testing) public struct ExplicitDependencyBuildPlanner { | ||
/// The module dependency graph. | ||
private let dependencyGraph: InterModuleDependencyGraph | ||
@_spi(Testing) public let dependencyGraph: InterModuleDependencyGraph | ||
|
||
/// A set of direct and transitive dependencies for every module in the dependency graph | ||
private let reachabilityMap: [ModuleDependencyId : Set<ModuleDependencyId>] | ||
|
@@ -421,6 +421,29 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT | |
} | ||
} | ||
|
||
public func getLinkLibraryLoadCommandFlags(_ commandLine: inout [Job.ArgTemplate]) throws { | ||
var allLinkLibraries: [LinkLibraryInfo] = [] | ||
for (_, moduleInfo) in dependencyGraph.modules { | ||
guard let moduleLinkLibraries = moduleInfo.linkLibraries else { | ||
continue | ||
} | ||
for linkLibrary in moduleLinkLibraries { | ||
allLinkLibraries.append(linkLibrary) | ||
} | ||
} | ||
|
||
for linkLibrary in allLinkLibraries { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 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. |
||
if !linkLibrary.isFramework { | ||
commandLine.appendFlag("-l\(linkLibrary.linkName)") | ||
} else { | ||
commandLine.appendFlag(.Xlinker) | ||
commandLine.appendFlag("-framework") | ||
commandLine.appendFlag(.Xlinker) | ||
commandLine.appendFlag(linkLibrary.linkName) | ||
} | ||
} | ||
} | ||
|
||
/// Resolve all module dependencies of the main module and add them to the lists of | ||
/// inputs and command line flags. | ||
public mutating func resolveMainModuleDependencies(inputs: inout [TypedVirtualPath], | ||
|
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.
Can we check if we bump this, we are not missing any APIs that in the range of 7-9?