Skip to content

Prefix linker flags with -Xlinker #7588

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
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,13 @@ public final class ProductBuildDescription: SPMBuildCore.ProductBuildDescription
// Other linker flags.
for target in self.staticTargets {
let scope = self.buildParameters.createScope(for: target)
flags += scope.evaluate(.OTHER_LDFLAGS)
let additionalFlags = scope.evaluate(.OTHER_LDFLAGS)
// FIXME: this should be based on the target package's tools version
Copy link
Contributor

Choose a reason for hiding this comment

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

IIUC our current convention was to base all behavior on root package's tools version? @neonichu do I understand that correctly?

Copy link
Contributor

Choose a reason for hiding this comment

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

It depends. Mostly we try to apply the specific package's tools-version, but there are some behaviors that are more far reaching where we look at root packages.

I think for more build related things like this that should be localized to the package itself, looking at the specific package is the most appropriate.

if self.toolsVersion.major >= 6 {
flags += additionalFlags.asSwiftcLinkerFlags()
} else {
flags += additionalFlags
}
}

return flags
Expand Down