Skip to content

Commit 974151a

Browse files
authored
Rollup merge of rust-lang#40019 - alexcrichton:fix-musl, r=brson
travis: Compile a more compatible libc.a for musl The mitigations for rust-lang#34978 involve passing `-Wa,-mrelax-relocations=no` to all C code we compile, and we just forgot to pass it when compiling musl itself. Closes rust-lang#39979
2 parents e71db58 + 9a08f40 commit 974151a

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/bootstrap/lib.rs

-11
Original file line numberDiff line numberDiff line change
@@ -832,17 +832,6 @@ impl Build {
832832
if target.contains("apple-darwin") {
833833
base.push("-stdlib=libc++".into());
834834
}
835-
// This is a hack, because newer binutils broke things on some vms/distros
836-
// (i.e., linking against unknown relocs disabled by the following flag)
837-
// See: https://github.com/rust-lang/rust/issues/34978
838-
match target {
839-
"i586-unknown-linux-gnu" |
840-
"i686-unknown-linux-musl" |
841-
"x86_64-unknown-linux-musl" => {
842-
base.push("-Wa,-mrelax-relocations=no".into());
843-
},
844-
_ => {},
845-
}
846835
return base
847836
}
848837

src/ci/docker/linux-tested-targets/Dockerfile

+8
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ ENV RUST_CONFIGURE_ARGS \
3434
--musl-root-x86_64=/musl-x86_64 \
3535
--musl-root-i686=/musl-i686
3636

37+
# Newer binutils broke things on some vms/distros (i.e., linking against
38+
# unknown relocs disabled by the following flag), so we need to go out of our
39+
# way to produce "super compatible" binaries.
40+
#
41+
# See: https://github.com/rust-lang/rust/issues/34978
42+
ENV CFLAGS_i686_unknown_linux_gnu=-Wa,-mrelax-relocations=no \
43+
CFLAGS_x86_64_unknown_linux_gnu=-Wa,-mrelax-relocations=no
44+
3745
ENV SCRIPT \
3846
python2.7 ../x.py test \
3947
--target x86_64-unknown-linux-musl \

src/ci/docker/linux-tested-targets/build-musl.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111

1212
set -ex
1313

14-
export CFLAGS="-fPIC"
14+
# We need to mitigate rust-lang/rust#34978 when compiling musl itself as well
15+
export CFLAGS="-fPIC -Wa,-mrelax-relocations=no"
16+
export CXXFLAGS="-Wa,-mrelax-relocations=no"
17+
1518
MUSL=musl-1.1.14
1619
curl https://www.musl-libc.org/releases/$MUSL.tar.gz | tar xzf -
1720
cd $MUSL

0 commit comments

Comments
 (0)