Skip to content

Commit 2b0f448

Browse files
committed
Added support for armv7-unknown-linux-gnueabi and armv7-unknown-linux-musleabi.
Support for the targets in the compiler and std build in the CI.
1 parent 8b94e9e commit 2b0f448

File tree

7 files changed

+100
-7
lines changed

7 files changed

+100
-7
lines changed

src/bootstrap/configure.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ def v(*args):
125125
"arm-unknown-linux-musleabihf install directory")
126126
v("musl-root-armv5te", "target.armv5te-unknown-linux-musleabi.musl-root",
127127
"armv5te-unknown-linux-musleabi install directory")
128-
v("musl-root-armv7", "target.armv7-unknown-linux-musleabihf.musl-root",
128+
v("musl-root-armv7", "target.armv7-unknown-linux-musleabi.musl-root",
129+
"armv7-unknown-linux-musleabi install directory")
130+
v("musl-root-armv7hf", "target.armv7-unknown-linux-musleabihf.musl-root",
129131
"armv7-unknown-linux-musleabihf install directory")
130132
v("musl-root-aarch64", "target.aarch64-unknown-linux-musl.musl-root",
131133
"aarch64-unknown-linux-musl install directory")

src/ci/docker/dist-various-1/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ RUN env \
6464
env \
6565
CC=arm-linux-gnueabihf-gcc CFLAGS="-march=armv7-a" \
6666
CXX=arm-linux-gnueabihf-g++ CXXFLAGS="-march=armv7-a" \
67-
bash musl.sh armv7 && \
67+
bash musl.sh armv7hf && \
6868
env \
6969
CC=aarch64-linux-gnu-gcc \
7070
CXX=aarch64-linux-gnu-g++ \
@@ -135,7 +135,7 @@ ENV RUST_CONFIGURE_ARGS \
135135
--musl-root-armv5te=/musl-armv5te \
136136
--musl-root-arm=/musl-arm \
137137
--musl-root-armhf=/musl-armhf \
138-
--musl-root-armv7=/musl-armv7 \
138+
--musl-root-armv7hf=/musl-armv7hf \
139139
--musl-root-aarch64=/musl-aarch64 \
140140
--musl-root-mips=/musl-mips \
141141
--musl-root-mipsel=/musl-mipsel \

src/ci/docker/dist-various-2/Dockerfile

+28-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ RUN sed -i 's/^# deb-src/deb-src/' /etc/apt/sources.list
88

99
RUN apt-get update && apt-get build-dep -y clang llvm && apt-get install -y --no-install-recommends \
1010
build-essential \
11-
gcc-multilib \
11+
# gcc-multilib can not be installed together with gcc-arm-linux-gnueabi
12+
gcc-7-multilib \
1213
libedit-dev \
1314
libgmp-dev \
1415
libisl-dev \
@@ -21,11 +22,20 @@ RUN apt-get update && apt-get build-dep -y clang llvm && apt-get install -y --no
2122
unzip \
2223
# Needed for apt-key to work:
2324
dirmngr \
24-
gpg-agent
25+
gpg-agent \
26+
g++-7-arm-linux-gnueabi
2527

2628
RUN apt-key adv --batch --yes --keyserver keyserver.ubuntu.com --recv-keys 74DA7924C5513486
2729
RUN add-apt-repository -y 'deb http://apt.dilos.org/dilos dilos2 main'
2830

31+
WORKDIR /build
32+
COPY scripts/musl.sh /build
33+
RUN env \
34+
CC=arm-linux-gnueabi-gcc-7 CFLAGS="-march=armv7-a" \
35+
CXX=arm-linux-gnueabi-g++-7 CXXFLAGS="-march=armv7-a" \
36+
bash musl.sh armv7 && \
37+
rm -rf /build/*
38+
2939
WORKDIR /tmp
3040
COPY dist-various-2/shared.sh /tmp/
3141
COPY dist-various-2/build-cloudabi-toolchain.sh /tmp/
@@ -58,7 +68,11 @@ ENV \
5868
CXX_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-g++ \
5969
AR_x86_64_sun_solaris=x86_64-sun-solaris2.10-ar \
6070
CC_x86_64_sun_solaris=x86_64-sun-solaris2.10-gcc \
61-
CXX_x86_64_sun_solaris=x86_64-sun-solaris2.10-g++
71+
CXX_x86_64_sun_solaris=x86_64-sun-solaris2.10-g++ \
72+
CC_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-gcc-7 \
73+
CXX_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-g++-7 \
74+
CC=gcc-7 \
75+
CXX=g++-7
6276

6377
ENV CARGO_TARGET_X86_64_FUCHSIA_AR /usr/local/bin/llvm-ar
6478
ENV CARGO_TARGET_X86_64_FUCHSIA_RUSTFLAGS \
@@ -81,9 +95,19 @@ ENV TARGETS=$TARGETS,x86_64-unknown-linux-gnux32
8195
ENV TARGETS=$TARGETS,x86_64-unknown-cloudabi
8296
ENV TARGETS=$TARGETS,x86_64-fortanix-unknown-sgx
8397
ENV TARGETS=$TARGETS,nvptx64-nvidia-cuda
98+
ENV TARGETS=$TARGETS,armv7-unknown-linux-gnueabi
99+
ENV TARGETS=$TARGETS,armv7-unknown-linux-musleabi
84100

85101
ENV X86_FORTANIX_SGX_LIBS="/x86_64-fortanix-unknown-sgx/lib/"
86102

103+
# As per https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1300211
104+
# we need asm in the search path for gcc-7 (for gnux32) but not in the search path of the
105+
# cross compilers.
106+
# Luckily one of the folders is /usr/local/include so symlink /usr/include/asm-generic there
107+
RUN ln -s /usr/include/asm-generic /usr/local/include/asm
108+
87109
ENV RUST_CONFIGURE_ARGS --enable-extended --enable-lld --disable-docs \
88-
--set target.wasm32-wasi.wasi-root=/wasm32-wasi
110+
--set target.wasm32-wasi.wasi-root=/wasm32-wasi \
111+
--musl-root-armv7=/musl-armv7
112+
89113
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
2+
3+
// This target is for glibc Linux on ARMv7 without thumb-mode, NEON or
4+
// hardfloat.
5+
6+
pub fn target() -> TargetResult {
7+
let base = super::linux_base::opts();
8+
Ok(Target {
9+
llvm_target: "armv7-unknown-linux-gnueabi".to_string(),
10+
target_endian: "little".to_string(),
11+
target_pointer_width: "32".to_string(),
12+
target_c_int_width: "32".to_string(),
13+
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
14+
arch: "arm".to_string(),
15+
target_os: "linux".to_string(),
16+
target_env: "gnu".to_string(),
17+
target_vendor: "unknown".to_string(),
18+
linker_flavor: LinkerFlavor::Gcc,
19+
20+
options: TargetOptions {
21+
features: "+v7,+thumb2,+soft-float,-neon".to_string(),
22+
cpu: "generic".to_string(),
23+
max_atomic_width: Some(64),
24+
abi_blacklist: super::arm_base::abi_blacklist(),
25+
target_mcount: "\u{1}__gnu_mcount_nc".to_string(),
26+
.. base
27+
}
28+
})
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
2+
3+
// This target is for musl Linux on ARMv7 without thumb-mode, NEON or
4+
// hardfloat.
5+
6+
pub fn target() -> TargetResult {
7+
let base = super::linux_musl_base::opts();
8+
// Most of these settings are copied from the armv7_unknown_linux_gnueabi
9+
// target.
10+
Ok(Target {
11+
// It's important we use "gnueabi" and not "musleabi" here. LLVM uses it
12+
// to determine the calling convention and float ABI, and it doesn't
13+
// support the "musleabi" value.
14+
llvm_target: "armv7-unknown-linux-gnueabi".to_string(),
15+
target_endian: "little".to_string(),
16+
target_pointer_width: "32".to_string(),
17+
target_c_int_width: "32".to_string(),
18+
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
19+
arch: "arm".to_string(),
20+
target_os: "linux".to_string(),
21+
target_env: "musl".to_string(),
22+
target_vendor: "unknown".to_string(),
23+
linker_flavor: LinkerFlavor::Gcc,
24+
25+
options: TargetOptions {
26+
features: "+v7,+thumb2,+soft-float,-neon".to_string(),
27+
cpu: "generic".to_string(),
28+
max_atomic_width: Some(64),
29+
abi_blacklist: super::arm_base::abi_blacklist(),
30+
target_mcount: "\u{1}mcount".to_string(),
31+
.. base
32+
}
33+
})
34+
}

src/librustc_target/spec/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,10 @@ supported_targets! {
359359
("armv4t-unknown-linux-gnueabi", armv4t_unknown_linux_gnueabi),
360360
("armv5te-unknown-linux-gnueabi", armv5te_unknown_linux_gnueabi),
361361
("armv5te-unknown-linux-musleabi", armv5te_unknown_linux_musleabi),
362+
("armv7-unknown-linux-gnueabi", armv7_unknown_linux_gnueabi),
362363
("armv7-unknown-linux-gnueabihf", armv7_unknown_linux_gnueabihf),
363364
("thumbv7neon-unknown-linux-gnueabihf", thumbv7neon_unknown_linux_gnueabihf),
365+
("armv7-unknown-linux-musleabi", armv7_unknown_linux_musleabi),
364366
("armv7-unknown-linux-musleabihf", armv7_unknown_linux_musleabihf),
365367
("aarch64-unknown-linux-gnu", aarch64_unknown_linux_gnu),
366368
("aarch64-unknown-linux-musl", aarch64_unknown_linux_musl),

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

+2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@ static TARGETS: &[&str] = &[
5656
"armv7-apple-ios",
5757
"armv7-linux-androideabi",
5858
"thumbv7neon-linux-androideabi",
59+
"armv7-unknown-linux-gnueabi",
5960
"armv7-unknown-linux-gnueabihf",
6061
"thumbv7neon-unknown-linux-gnueabihf",
62+
"armv7-unknown-linux-musleabi",
6163
"armv7-unknown-linux-musleabihf",
6264
"armebv7r-none-eabi",
6365
"armebv7r-none-eabihf",

0 commit comments

Comments
 (0)