Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upadd support for mips(el)-unknown-linux-musl #31298
Conversation
japaric
reviewed
Jan 30, 2016
| @@ -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 | |||
This comment has been minimized.
This comment has been minimized.
japaric
reviewed
Jan 30, 2016
| @@ -0,0 +1,24 @@ | |||
| # mips-unknown-linux-musl configuration | |||
| CC_mips-unknown-linux-musl=mips-openwrt-linux-gcc | |||
This comment has been minimized.
This comment has been minimized.
japaric
Jan 30, 2016
Author
Member
TODO change the prefixes to something vendor neutral. Probably mips-linux-musl-gcc.
japaric
reviewed
Jan 30, 2016
| @@ -1 +1 @@ | |||
| Subproject commit 91ff43c736de664f8d3cd351e148c09cdea6731e | |||
| Subproject commit 81c05bcddb05d0e5facf66f3945405bbf50b04d3 | |||
This comment has been minimized.
This comment has been minimized.
japaric
reviewed
Jan 30, 2016
| @@ -93,11 +93,20 @@ mod arch { | |||
| use os::raw::{c_long, c_ulong}; | |||
| use os::unix::raw::{gid_t, uid_t}; | |||
|
|
|||
| #[cfg(target_env = "musl")] | |||
| #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = i64; | |||
This comment has been minimized.
This comment has been minimized.
japaric
Jan 30, 2016
Author
Member
I'm not sure what stability level this should have. AFAIK, these types are going to be deprecated in the future.
This comment has been minimized.
This comment has been minimized.
alexcrichton
reviewed
Jan 30, 2016
| llvm_target: "mipsel-unknown-linux-musl".to_string(), | ||
| target_endian: "little".to_string(), | ||
| target_pointer_width: "32".to_string(), | ||
| arch: "mips".to_string(), |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
japaric
Jan 30, 2016
Author
Member
Should this be mipsel?
Not sure! The existing mipsel-unknown-linux-gnu target is also using mips as the arch.
AIUI, this arch field is used for #[cfg(target_arch = ...)] and not for codegen (that's what llvm-target is used for). If we want to change both targets (mipsel-gnu and mipsel-musl) to use arch = mipsel, then we'll have to update the cfgs in crates like libc from #[cfg(target_arch = "mips")] to #[cfg(any(target_arch = "mips", any(target_arch = "mipsel"))].
This comment has been minimized.
This comment has been minimized.
alexcrichton
Jan 30, 2016
Member
Oh interesting! That may be a bug in the target triple, however, depending on how you look at it. Either that or we may just want to make sure that we're consistent. Some data points:
- The newly-added
powerpc64le-unknown-linux-gnutriple haspowerpc64leas thetarget_arch. - There's some
cfg(target_arch = "mipsel")directives in the standard library, which apparently are doing nothing. - We don't necessarily require the arch in the triple to equal the arch in
target_arch, for examplearmv7recently added has thetarget_archofarm.
I think that I'd prefer to lean towards leaving this as mips and tweaking the powerpc64le triple to have powerpc64 as the target_arch. That seems the most consistent to me and also the most ergonomic. The two triples can still be differentiated by looking at target_endian
This comment has been minimized.
This comment has been minimized.
japaric
Jan 30, 2016
Author
Member
I think that I'd prefer to lean towards leaving this as mips and tweaking the powerpc64le triple to have powerpc64 as the target_arch. That seems the most consistent to me and also the most ergonomic. The two triples can still be differentiated by looking at target_endian
alexcrichton
reviewed
Jan 30, 2016
| CC_mipsel-unknown-linux-musl=mipsel-openwrt-linux-gcc | ||
| CXX_mipsel-unknown-linux-musl=mipsel-openwrt-linux-g++ | ||
| CPP_mipsel-unknown-linux-musl=mipsel-openwrt-linux-gcc | ||
| AR_mipsel-unknown-linux-musl=mipsel-openwrt-linux-ar |
This comment has been minimized.
This comment has been minimized.
alexcrichton
Jan 30, 2016
Member
This should also work with a standard mipsel-linux-gnu-gcc toolchain, right?
This comment has been minimized.
This comment has been minimized.
alexcrichton
self-assigned this
Jan 30, 2016
This comment has been minimized.
This comment has been minimized.
|
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 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. |
This comment has been minimized.
This comment has been minimized.
|
ah and of course cc @rust-lang/tools about the dynamic-vs-static linkage of musl |
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
added some commits
Jan 30, 2016
japaric
force-pushed the
japaric:mips-musl
branch
from
84c1574
to
64ac041
Jan 30, 2016
This comment has been minimized.
This comment has been minimized.
|
This is now merge ready. |
This comment has been minimized.
This comment has been minimized.
alexcrichton
referenced this pull request
Jan 30, 2016
Merged
Remove "powerpc64le" and "mipsel" target_arch #31312
bors
added a commit
that referenced
this pull request
Jan 30, 2016
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Jan 31, 2016
This comment has been minimized.
This comment has been minimized.
|
|
japaric commentedJan 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