Skip to content
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

Merged
merged 6 commits into from Jan 29, 2018

Conversation

Projects
None yet
8 participants
@malbarbo
Copy link
Contributor

malbarbo commented Jan 22, 2018

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.

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.
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jan 22, 2018

r? @aturon

(rust_highfive has picked a reviewer for you, use r? to override)

@malbarbo

This comment has been minimized.

Copy link
Contributor Author

malbarbo commented Jan 22, 2018

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jan 22, 2018

cc @japaric I think you originally added these targets, right? If so, do you have thoughts on this?

@japaric

This comment has been minimized.

Copy link
Member

japaric commented Jan 23, 2018

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.

@malbarbo

This comment has been minimized.

Copy link
Contributor Author

malbarbo commented Jan 23, 2018

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 crt_static_default = false in the target definition, while still allowing static linking.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jan 23, 2018

@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?

@malbarbo

This comment has been minimized.

Copy link
Contributor Author

malbarbo commented Jan 23, 2018

Ok, I changed crt_static_default = false.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jan 23, 2018

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)

@malbarbo

This comment has been minimized.

Copy link
Contributor Author

malbarbo commented Jan 23, 2018

Done.

@malbarbo

This comment has been minimized.

Copy link
Contributor Author

malbarbo commented Jan 23, 2018

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jan 23, 2018

@bors: r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 23, 2018

📋 Looks like this PR is still in progress, ignoring approval

@malbarbo

This comment has been minimized.

Copy link
Contributor Author

malbarbo commented Jan 23, 2018

We should wait for rust-lang/libc#908

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jan 23, 2018

Ah ok! I thought that with the change in defaults this may no longer need the PR. I left a comment over there

@malbarbo

This comment has been minimized.

Copy link
Contributor Author

malbarbo commented Jan 23, 2018

Add -fPIC. Without it, dynamic linking fails.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jan 24, 2018

Ok! Want to update libc here too?

@malbarbo

This comment has been minimized.

Copy link
Contributor Author

malbarbo commented Jan 24, 2018

Update libc.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jan 24, 2018

@bors: r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 24, 2018

📋 Looks like this PR is still in progress, ignoring approval

@malbarbo malbarbo changed the title [WIP] Do not assume dynamic linking for musl/mips[el] targets Do not assume dynamic linking for musl/mips[el] targets Jan 24, 2018

@malbarbo

This comment has been minimized.

Copy link
Contributor Author

malbarbo commented Jan 24, 2018

Remove WIP from title issue... Is this the reason bors is complaining?

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jan 24, 2018

@bors: r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 24, 2018

📌 Commit cd47ddf has been approved by alexcrichton

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jan 24, 2018

Apparently so!

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 27, 2018

⌛️ Testing commit cd47ddf with merge c188e44...

bors added a commit that referenced this pull request Jan 27, 2018

Auto merge of #47663 - malbarbo:mips-crt-static, r=alexcrichton
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.
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 27, 2018

💔 Test failed - status-travis

@kennytm

This comment has been minimized.

Copy link
Member

kennytm commented Jan 27, 2018

ui/test-should-panic-attr.rs failed on musl due to "fatal runtime error: failed to initiate panic, error 5", legit.

[00:56:16] ---- [ui] ui/test-should-panic-attr.rs stdout ----
[00:56:16] 	
[00:56:16] error: test run failed!
[00:56:16] status: signal: 6
[00:56:16] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/test-should-panic-attr.stage2-i686-unknown-linux-musl"
[00:56:16] stdout:
[00:56:16] ------------------------------------------
[00:56:16] 
[00:56:16] running 5 tests
[00:56:16] 
[00:56:16] ------------------------------------------
[00:56:16] stderr:
[00:56:16] ------------------------------------------
[00:56:16] fatal runtime error: failed to initiate panic, error 5
[00:56:16] 
[00:56:16] ------------------------------------------
[00:56:16] 
[00:56:16] thread '[ui] ui/test-should-panic-attr.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2883:9
[00:56:16] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:56:16] 
[00:56:16] 
[00:56:16] failures:
[00:56:16]     [ui] ui/test-should-panic-attr.rs
@malbarbo

This comment has been minimized.

Copy link
Contributor Author

malbarbo commented Jan 27, 2018

I think we do not need the x86 patch anymore: llvm-mirror/libunwind@aa805e4

I will test it in my machine...

Remove musl/libunwind patch for i686
The i686 problem was fixed upstream:
llvm-mirror/libunwind@aa805e4
@malbarbo

This comment has been minimized.

Copy link
Contributor Author

malbarbo commented Jan 27, 2018

i686 patch removed (it worked locally).

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jan 28, 2018

@bors: r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 28, 2018

📌 Commit 2875f82 has been approved by alexcrichton

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 28, 2018

⌛️ Testing commit 2875f82 with merge 385ef15...

bors added a commit that referenced this pull request Jan 28, 2018

Auto merge of #47663 - malbarbo:mips-crt-static, r=alexcrichton
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.
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 29, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 385ef15 to master...

@bors bors merged commit 2875f82 into rust-lang:master Jan 29, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.