Skip to content

Commit 882cd3c

Browse files
committed
Add i586-unknown-linux-musl target
1 parent ee220da commit 882cd3c

File tree

8 files changed

+41
-11
lines changed

8 files changed

+41
-11
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ matrix:
126126
if: branch = auto
127127
- env: IMAGE=dist-armv7-linux DEPLOY=1
128128
if: branch = auto
129-
- env: IMAGE=dist-i586-gnu-i686-musl DEPLOY=1
129+
- env: IMAGE=dist-i586-gnu-i586-i686-musl DEPLOY=1
130130
if: branch = auto
131131
- env: IMAGE=dist-i686-freebsd DEPLOY=1
132132
if: branch = auto

src/bootstrap/configure.py

+2
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ def v(*args):
108108
"MUSL root installation directory (deprecated)")
109109
v("musl-root-x86_64", "target.x86_64-unknown-linux-musl.musl-root",
110110
"x86_64-unknown-linux-musl install directory")
111+
v("musl-root-i586", "target.i586-unknown-linux-musl.musl-root",
112+
"i586-unknown-linux-musl install directory")
111113
v("musl-root-i686", "target.i686-unknown-linux-musl.musl-root",
112114
"i686-unknown-linux-musl install directory")
113115
v("musl-root-arm", "target.arm-unknown-linux-musleabi.musl-root",

src/bootstrap/native.rs

+2
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,8 @@ impl Step for Openssl {
429429
"arm-unknown-linux-gnueabihf" => "linux-armv4",
430430
"armv7-linux-androideabi" => "android-armv7",
431431
"armv7-unknown-linux-gnueabihf" => "linux-armv4",
432+
"i586-unknown-linux-gnu" => "linux-elf",
433+
"i586-unknown-linux-musl" => "linux-elf",
432434
"i686-apple-darwin" => "darwin-i386-cc",
433435
"i686-linux-android" => "android-x86",
434436
"i686-unknown-freebsd" => "BSD-x86-elf",

src/ci/docker/dist-i586-gnu-i686-musl/Dockerfile src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile

+12-7
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,17 @@ COPY scripts/musl.sh /build/
2121
RUN CC=gcc CFLAGS="-m32 -fPIC -Wa,-mrelax-relocations=no" \
2222
CXX=g++ CXXFLAGS="-m32 -Wa,-mrelax-relocations=no" \
2323
bash musl.sh i686 --target=i686 && \
24+
CC=gcc CFLAGS="-march=pentium -m32 -fPIC -Wa,-mrelax-relocations=no" \
25+
CXX=g++ CXXFLAGS="-march=pentium -m32 -Wa,-mrelax-relocations=no" \
26+
bash musl.sh i586 --target=i586 && \
2427
rm -rf /build
2528

2629
COPY scripts/sccache.sh /scripts/
2730
RUN sh /scripts/sccache.sh
2831

2932
ENV RUST_CONFIGURE_ARGS \
3033
--target=i686-unknown-linux-musl,i586-unknown-linux-gnu \
34+
--musl-root-i586=/musl-i586 \
3135
--musl-root-i686=/musl-i686 \
3236
--enable-extended
3337

@@ -38,12 +42,13 @@ ENV RUST_CONFIGURE_ARGS \
3842
# See: https://github.com/rust-lang/rust/issues/34978
3943
ENV CFLAGS_i686_unknown_linux_musl=-Wa,-mrelax-relocations=no
4044
ENV CFLAGS_i586_unknown_linux_gnu=-Wa,-mrelax-relocations=no
45+
# FIXME remove -Wl,-melf_i386 after cc is updated to include
46+
# https://github.com/alexcrichton/cc-rs/pull/281
47+
ENV CFLAGS_i586_unknown_linux_musl="-Wa,-mrelax-relocations=no -Wl,-melf_i386"
48+
49+
ENV TARGETS=i586-unknown-linux-gnu
50+
ENV TARGETS=$TARGETS,i686-unknown-linux-musl
4151

4252
ENV SCRIPT \
43-
python2.7 ../x.py test \
44-
--target i686-unknown-linux-musl \
45-
--target i586-unknown-linux-gnu \
46-
&& \
47-
python2.7 ../x.py dist \
48-
--target i686-unknown-linux-musl \
49-
--target i586-unknown-linux-gnu
53+
python2.7 ../x.py test --target $TARGETS && \
54+
python2.7 ../x.py dist --target $TARGETS,i586-unknown-linux-musl

src/ci/docker/scripts/musl.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fi
3939

4040
cd $MUSL
4141
./configure --disable-shared --prefix=/musl-$TAG $@
42-
if [ "$TAG" = "i686" ]; then
42+
if [ "$TAG" = "i586" -o "$TAG" = "i686" ]; then
4343
hide_output make -j$(nproc) AR=ar RANLIB=ranlib
4444
else
4545
hide_output make -j$(nproc)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use target::TargetResult;
12+
13+
pub fn target() -> TargetResult {
14+
let mut base = super::i686_unknown_linux_musl::target()?;
15+
base.options.cpu = "pentium".to_string();
16+
base.llvm_target = "i586-unknown-linux-musl".to_string();
17+
Ok(base)
18+
}

src/librustc_back/target/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ supported_targets! {
147147
("powerpc64-unknown-linux-gnu", powerpc64_unknown_linux_gnu),
148148
("powerpc64le-unknown-linux-gnu", powerpc64le_unknown_linux_gnu),
149149
("s390x-unknown-linux-gnu", s390x_unknown_linux_gnu),
150+
("sparc64-unknown-linux-gnu", sparc64_unknown_linux_gnu),
150151
("arm-unknown-linux-gnueabi", arm_unknown_linux_gnueabi),
151152
("arm-unknown-linux-gnueabihf", arm_unknown_linux_gnueabihf),
152153
("arm-unknown-linux-musleabi", arm_unknown_linux_musleabi),
@@ -156,16 +157,17 @@ supported_targets! {
156157
("armv7-unknown-linux-gnueabihf", armv7_unknown_linux_gnueabihf),
157158
("armv7-unknown-linux-musleabihf", armv7_unknown_linux_musleabihf),
158159
("aarch64-unknown-linux-gnu", aarch64_unknown_linux_gnu),
160+
159161
("aarch64-unknown-linux-musl", aarch64_unknown_linux_musl),
160162
("x86_64-unknown-linux-musl", x86_64_unknown_linux_musl),
161163
("i686-unknown-linux-musl", i686_unknown_linux_musl),
164+
("i586-unknown-linux-musl", i586_unknown_linux_musl),
162165
("mips-unknown-linux-musl", mips_unknown_linux_musl),
163166
("mipsel-unknown-linux-musl", mipsel_unknown_linux_musl),
167+
164168
("mips-unknown-linux-uclibc", mips_unknown_linux_uclibc),
165169
("mipsel-unknown-linux-uclibc", mipsel_unknown_linux_uclibc),
166170

167-
("sparc64-unknown-linux-gnu", sparc64_unknown_linux_gnu),
168-
169171
("i686-linux-android", i686_linux_android),
170172
("x86_64-linux-android", x86_64_linux_android),
171173
("arm-linux-androideabi", arm_linux_androideabi),

src/tools/build-manifest/src/main.rs

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ static TARGETS: &'static [&'static str] = &[
6767
"i386-apple-ios",
6868
"i586-pc-windows-msvc",
6969
"i586-unknown-linux-gnu",
70+
"i586-unknown-linux-musl",
7071
"i686-apple-darwin",
7172
"i686-linux-android",
7273
"i686-pc-windows-gnu",

0 commit comments

Comments
 (0)