Skip to content

Commit 724f811

Browse files
authored
Auto merge of #35060 - japaric:arm-musl, r=alexcrichton
Add ARM MUSL targets Rebase of #33189. I tested this by producing a std for `arm-unknown-linux-musleabi` then I cross compiled Hello world to said target. Checked that the produced binary was statically linked and verified that the binary worked under QEMU. This depends on rust-lang/libc#341. I'll have to update this PR after that libc PR is merged. I'm also working on generating ARM musl cross toolchain via crosstool-ng. Once I verified those work, I'll send a PR to rust-buildbot. r? @alexcrichton cc @timonvo
2 parents c267ab4 + eb61738 commit 724f811

20 files changed

+144
-21
lines changed

configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,7 @@ do
11921192
;;
11931193

11941194

1195-
x86_64-*-musl)
1195+
x86_64-*-musl | arm-*-musleabi)
11961196
if [ ! -f $CFG_MUSL_ROOT/lib/libc.a ]
11971197
then
11981198
err "musl libc $CFG_MUSL_ROOT/lib/libc.a not found"

mk/cfg/arm-unknown-linux-musleabi.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This file is intentially left empty to indicate that, while this target is
2+
# supported, it's not supported using plain GNU Make builds. Use a --rustbuild
3+
# instead.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This file is intentially left empty to indicate that, while this target is
2+
# supported, it's not supported using plain GNU Make builds. Use a --rustbuild
3+
# instead.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This file is intentially left empty to indicate that, while this target is
2+
# supported, it's not supported using plain GNU Make builds. Use a --rustbuild
3+
# instead.

src/bootstrap/Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bootstrap/compile.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ pub fn std_link(build: &Build,
9292
}
9393
add_to_sysroot(&out_dir, &libdir);
9494

95-
if target.contains("musl") &&
96-
(target.contains("x86_64") || target.contains("i686")) {
95+
if target.contains("musl") && !target.contains("mips") {
9796
copy_third_party_objects(build, target, &libdir);
9897
}
9998
}

src/bootstrap/sanity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ pub fn check(build: &mut Build) {
109109
}
110110

111111
// Make sure musl-root is valid if specified
112-
if target.contains("musl") && (target.contains("x86_64") || target.contains("i686")) {
112+
if target.contains("musl") && !target.contains("mips") {
113113
match build.config.musl_root {
114114
Some(ref root) => {
115115
if fs::metadata(root.join("lib/libc.a")).is_err() {

src/liballoc_jemalloc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ libc = { path = "../rustc/libc_shim" }
1616

1717
[build-dependencies]
1818
build_helper = { path = "../build_helper" }
19-
gcc = "0.3.17"
19+
gcc = "0.3.27"
2020

2121
[features]
2222
debug = []

src/liballoc_jemalloc/build.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,16 @@ fn main() {
7373
.replace("\\", "/"))
7474
.current_dir(&build_dir)
7575
.env("CC", compiler.path())
76-
.env("EXTRA_CFLAGS", cflags)
76+
.env("EXTRA_CFLAGS", cflags.clone())
77+
// jemalloc generates Makefile deps using GCC's "-MM" flag. This means
78+
// that GCC will run the preprocessor, and only the preprocessor, over
79+
// jemalloc's source files. If we don't specify CPPFLAGS, then at least
80+
// on ARM that step fails with a "Missing implementation for 32-bit
81+
// atomic operations" error. This is because no "-march" flag will be
82+
// passed to GCC, and then GCC won't define the
83+
// "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4" macro that jemalloc needs to
84+
// select an atomic operation implementation.
85+
.env("CPPFLAGS", cflags.clone())
7786
.env("AR", &ar)
7887
.env("RANLIB", format!("{} s", ar.display()));
7988

src/libflate/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ crate-type = ["dylib"]
1111

1212
[build-dependencies]
1313
build_helper = { path = "../build_helper" }
14-
gcc = "0.3"
14+
gcc = "0.3.27"

0 commit comments

Comments
 (0)