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

add support for mips(el)-unknown-linux-musl #31298

Merged
merged 4 commits into from
Jan 31, 2016
Merged

Conversation

japaric
Copy link
Member

@japaric japaric commented Jan 30, 2016

This target covers MIPS devices that run the trunk version of OpenWRT.

The x86_64-unknown-linux-musl target always links statically to C libraries. For
the mips(el)-unknown-linux-musl target, we opt for dynamic linking (like most of
other targets do) to keep binary size down.

As for the C compiler flags used in the build system, we use the same flags used
for the mips(el)-unknown-linux-gnu target.

r? @alexcrichton

This target covers MIPS devices that run the trunk version of OpenWRT.

The x86_64-unknown-linux-musl target always links statically to C libraries. For
the mips(el)-unknown-linux-musl target, we opt for dynamic linking (like most of
other targets do) to keep binary size down.

As for the C compiler flags used in the build system, we use the same flags used
for the mips(el)-unknown-linux-gnu target.
@@ -16,4 +16,5 @@
url = https://github.com/rust-lang/rust-installer.git
[submodule "src/liblibc"]
path = src/liblibc
url = https://github.com/rust-lang-nursery/libc.git
url = https://github.com/japaric/libc.git
Copy link
Member Author

Choose a reason for hiding this comment

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

TODO revert this change

@alexcrichton alexcrichton self-assigned this Jan 30, 2016
@alexcrichton
Copy link
Member

Looks good to me, thanks @japaric!

This brings up an interesting facet about the MUSL targets, however, about whether the C standard library is statically or dynamically linked. The x86_64-unknown-linux-musl target was originally created with the intention of only really being used for statically linked binaries. I'd personally prefer that these targets remain consistent, but it seems that the current primary use case (OpenWRT?) is dynamically linking the C standard library.

In that sense all of the MUSL targets should really support either dynamically linking or statically linking, but we don't really support this sort of lazy linkage in the standard library (only on crates.io where you build from source).

I think for now I'd be fine basically choosing "whatever seems best" for the target at hand (e.g. static for x86_64 and perhaps i686 but dynamic for mips), but it's something we may wish to reconsider in the future.

@alexcrichton
Copy link
Member

ah and of course cc @rust-lang/tools about the dynamic-vs-static linkage of musl

@japaric japaric changed the title [blocked] add support for mips(el)-unknown-linux-musl add support for mips(el)-unknown-linux-musl Jan 30, 2016
@japaric
Copy link
Member Author

japaric commented Jan 30, 2016

This is now merge ready.

@alexcrichton
Copy link
Member

@bors: r+ 64ac041

bors added a commit that referenced this pull request Jan 30, 2016
This target covers MIPS devices that run the trunk version of OpenWRT.

The x86_64-unknown-linux-musl target always links statically to C libraries. For
the mips(el)-unknown-linux-musl target, we opt for dynamic linking (like most of
other targets do) to keep binary size down.

As for the C compiler flags used in the build system, we use the same flags used
for the mips(el)-unknown-linux-gnu target.

r? @alexcrichton
@bors
Copy link
Contributor

bors commented Jan 30, 2016

⌛ Testing commit 64ac041 with merge 8110338...

@bors
Copy link
Contributor

bors commented Jan 30, 2016

💔 Test failed - auto-linux-musl-64-opt

@japaric
Copy link
Member Author

japaric commented Jan 31, 2016

The failed test (os::raw::tests::unix) was caused by rust-lang/libc#122 which changed the definition of nlink_t to usize. I'll send a PR to libc to restore the old definition.

fixes failed test (std::os::raw::tests::unix) in x86_64-musl target
@japaric
Copy link
Member Author

japaric commented Jan 31, 2016

@bors: r=alexcrichton 27127db

bors added a commit that referenced this pull request Jan 31, 2016
This target covers MIPS devices that run the trunk version of OpenWRT.

The x86_64-unknown-linux-musl target always links statically to C libraries. For
the mips(el)-unknown-linux-musl target, we opt for dynamic linking (like most of
other targets do) to keep binary size down.

As for the C compiler flags used in the build system, we use the same flags used
for the mips(el)-unknown-linux-gnu target.

r? @alexcrichton
@bors
Copy link
Contributor

bors commented Jan 31, 2016

⌛ Testing commit 27127db with merge 9041b93...

@bors bors mentioned this pull request Jan 31, 2016
@japaric japaric deleted the mips-musl branch January 31, 2016 16:47
malbarbo added a commit to malbarbo/rust that referenced this pull request Jan 22, 2018
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.
bors added a commit that referenced this pull request Jan 28, 2018
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.
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.

3 participants