-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Do not assume dynamic linking for musl/mips[el] targets #47663
Conversation
All musl targets except mips[el] assume static linking by default. This can be confusing https://users.rust-lang.org/t/static-cross-compiled-binaries-arent-really-static/6084 When the musl/mips[el] targets was [added](rust-lang#31298), dynamic linking was chosen because of binary size concerns, and probably also because libunwind [didn't](https://users.rust-lang.org/t/static-cross-compiled-binaries-arent-really-static/6084/8) supported mips. Now that we have `crt-static` target-feature (the user can choose dynamic link for musl targets), and libunwind [6.0](https://github.com/llvm-mirror/libunwind/commits/release_60) add support to mips, we do not need to assume dynamic linking.
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
Waiting rust-lang/libc#908 |
cc @japaric I think you originally added these targets, right? If so, do you have thoughts on this? |
I think it's a good idea to support both static linking and dynamic linking now that libunwind supports MIPS. Does this change the default linking mode, @malbarbo? Will mips-musl continue to link dynamically after this PR? I can't tell from the diff. I don't know if we want to change it so that musl = static by default everywhere; that may be less confusing (cf. PR description) but it would be a breaking change to change the default for this target as people could be relying on dynamic linking for their CI deployments, etc. |
Yes, this changes the default linking mode to static. It is a breaking change. But we some times do breaking changes, like when the android arm target was changed (Off course, it was included in the release notes). We need to evaluate if the breaking change here worth it. I think so, mainly because the others musl targets uses static linking by default. Anyway, we can revert to dynamic linking by default setting |
@malbarbo I wonder, could we perhaps land this without changing the defaults, and then consider that separately? Perhaps with a post to internals to try to catch users of the current target? |
Ok, I changed |
Ok! As a final question, could we use the more recent version of the unwinder for all targets? (AFAIK there's no technical reason to stick to an older version) |
Done. |
@bors: r+ |
📋 Looks like this PR is still in progress, ignoring approval |
We should wait for rust-lang/libc#908 |
Ah ok! I thought that with the change in defaults this may no longer need the PR. I left a comment over there |
Add -fPIC. Without it, dynamic linking fails. |
Ok! Want to update libc here too? |
Update libc. |
@bors: r+ |
📋 Looks like this PR is still in progress, ignoring approval |
Remove WIP from title issue... Is this the reason bors is complaining? |
@bors: r+ |
📌 Commit cd47ddf has been approved by |
Apparently so! |
⌛ Testing commit cd47ddf with merge c188e448eb8729aa4ea1ef7a458522d08f54c875... |
💔 Test failed - status-travis |
|
I think we do not need the x86 patch anymore: llvm-mirror/libunwind@aa805e4 I will test it in my machine... |
The i686 problem was fixed upstream: llvm-mirror/libunwind@aa805e4
i686 patch removed (it worked locally). |
@bors: r+ |
📌 Commit 2875f82 has been approved by |
Do not assume dynamic linking for musl/mips[el] targets All musl targets except mips[el] assume static linking by default. This can be [confusing](https://users.rust-lang.org/t/static-cross-compiled-binaries-arent-really-static/6084). When the musl/mips[el] targets was [added](#31298), dynamic linking was chosen because of binary size concerns, and probably also because libunwind [didn't](https://users.rust-lang.org/t/static-cross-compiled-binaries-arent-really-static/6084/8) supported mips. Now that we have `crt-static` target-feature (the user can choose dynamic link for musl targets), and libunwind [6.0](https://github.com/llvm-mirror/libunwind/commits/release_60) add support to mips, we do not need to assume dynamic linking.
☀️ Test successful - status-appveyor, status-travis |
All musl targets except mips[el] assume static linking by default. This can be confusing.
When the musl/mips[el] targets was added, dynamic linking was chosen because of binary size concerns, and probably also because libunwind didn't supported mips.
Now that we have
crt-static
target-feature (the user can choose dynamic link for musl targets), and libunwind 6.0 add support to mips, we do not need to assume dynamic linking.