Skip to content

Don't add rpath to swift with statically linking #10381

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 2 commits into from
Jun 20, 2017
Merged

Don't add rpath to swift with statically linking #10381

merged 2 commits into from
Jun 20, 2017

Conversation

keith
Copy link
Member

@keith keith commented Jun 19, 2017

This updates the rpath linking logic to only add the rpath that points
to the swift dylibs in the case that the libraries are not statically
linked into the binary.

This fix is marginally relevant to https://bugs.swift.org/browse/SR-1967, but does not solve the core problem here.

@dduan
Copy link
Contributor

dduan commented Jun 19, 2017

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 3c41982dd8e8b02ab58486fbc393c4410f4339fe
Test requested by - @dduan

@aciidgh aciidgh requested a review from jrose-apple June 19, 2017 20:31
Copy link
Contributor

@jrose-apple jrose-apple left a comment

Choose a reason for hiding this comment

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

Thanks for picking this up, Keith! Can you add a test to test/Driver/linker.swift as well?

@@ -1283,10 +1284,10 @@ toolchains::Darwin::constructInvocation(const LinkJobAction &job,
Arguments.push_back(context.Args.MakeArgString(LibProfile));
}

// FIXME: We probably shouldn't be adding an rpath here unless we know ahead
// of time the standard library won't be copied.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please preserve this FIXME in the new code as well—it's referencing the rest of SR-1967.

Copy link
Member Author

@keith keith Jun 19, 2017

Choose a reason for hiding this comment

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

Done, also moved this up into the else above

This updates the rpath linking logic to only add the rpath that points
to the swift dylibs in the case that the libraries are not statically
linked into the binary.
@keith
Copy link
Member Author

keith commented Jun 19, 2017

Yep I'll look at adding that test!

@keith
Copy link
Member Author

keith commented Jun 19, 2017

(sorry about the tests, the first push here was bogus)

@CodaFi
Copy link
Contributor

CodaFi commented Jun 19, 2017

@swift-ci please test

@keith
Copy link
Member Author

keith commented Jun 20, 2017

I've just pushed a test for this. I would love some feedback on how I'm using FileCheck to validated the absence of -rpath. AFACIT there's no good way to do this. Really I want something like:

// SWIFT_STATIC-DAG-NOT: -rpath

Instead I'm using the -implicit-check-not flag, which works in this case it seems, but requires a more ordered list of arguments, rather than ignoring the order and using -DAG for all of these (since the order doesn't actually matter)

This test validates the arguments passed to the linker when statically
linking the swift standard library. Currently in order to ensure that no
-rpath is passed, we're using FileCheck's -implicit-check-not flag, and
strictly validating the order of the arguments. The order doesn't really
matter here but is required for that flag to validate that no -rpath is
passed.
@keith
Copy link
Member Author

keith commented Jun 20, 2017

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - c281f0f2af5ce8cd86d40f4584336a71acdb00db
Test requested by - @dduan

@keith
Copy link
Member Author

keith commented Jun 20, 2017

Looks like these failures are because I force pushed, it's still building the new sha.

@swiftlang swiftlang deleted a comment from swift-ci Jun 20, 2017
@swiftlang swiftlang deleted a comment from swift-ci Jun 20, 2017
@swiftlang swiftlang deleted a comment from swift-ci Jun 20, 2017
@swiftlang swiftlang deleted a comment from swift-ci Jun 20, 2017
@swiftlang swiftlang deleted a comment from swift-ci Jun 20, 2017
@dduan
Copy link
Contributor

dduan commented Jun 20, 2017

@swift-ci please test

@keith
Copy link
Member Author

keith commented Jun 20, 2017

(it seems to still be running)

@dduan
Copy link
Contributor

dduan commented Jun 20, 2017

@swift-ci please smoke test OS X Platform

@jrose-apple jrose-apple merged commit ad3c773 into swiftlang:master Jun 20, 2017
@keith
Copy link
Member Author

keith commented Jun 20, 2017

Thanks!

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.

5 participants