Skip to content

Commit b71f636

Browse files
committed
Add armv5te-unknown-linux-musl target
1 parent 698b956 commit b71f636

File tree

5 files changed

+89
-0
lines changed

5 files changed

+89
-0
lines changed

src/bootstrap/configure.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ def v(*args):
120120
"arm-unknown-linux-musleabi install directory")
121121
v("musl-root-armhf", "target.arm-unknown-linux-musleabihf.musl-root",
122122
"arm-unknown-linux-musleabihf install directory")
123+
v("musl-root-armv5te", "target.armv5te-unknown-linux-musl.musl-root",
124+
"armv5te-unknown-linux-musleabi install directory")
123125
v("musl-root-armv7", "target.armv7-unknown-linux-musleabihf.musl-root",
124126
"armv7-unknown-linux-musleabihf install directory")
125127
v("musl-root-aarch64", "target.aarch64-unknown-linux-musl.musl-root",
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
4+
g++ \
5+
make \
6+
file \
7+
curl \
8+
ca-certificates \
9+
python2.7 \
10+
git \
11+
cmake \
12+
sudo \
13+
xz-utils \
14+
zlib1g-dev \
15+
g++-arm-linux-gnueabi \
16+
bzip2 \
17+
patch \
18+
pkg-config
19+
20+
WORKDIR /build
21+
22+
# Suppress some warnings in the openwrt toolchains we downloaded
23+
ENV STAGING_DIR=/tmp
24+
25+
COPY scripts/musl.sh /build
26+
RUN env \
27+
CC=arm-linux-gnueabi-gcc CFLAGS="-march=armv5te -marm -mfloat-abi=soft" \
28+
CXX=arm-linux-gnueabi-g++ CXXFLAGS="-march=armv5te -marm -mfloat-abi=soft" \
29+
bash musl.sh armv5te && \
30+
rm -rf /build/*
31+
32+
ENV TARGETS=armv5te-unknown-linux-musl
33+
34+
# FIXME: remove armv5te vars after https://github.com/alexcrichton/cc-rs/issues/271
35+
# get fixed and cc update
36+
ENV CC_armv5te_unknown_linux_musl=arm-linux-gnueabi-gcc \
37+
CFLAGS_armv5te_unknown_linux_musl="-march=armv5te -marm -mfloat-abi=soft"
38+
39+
ENV RUST_CONFIGURE_ARGS \
40+
--musl-root-armv5te=/musl-armv5te \
41+
--disable-docs
42+
43+
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
44+
45+
# sccache
46+
COPY scripts/sccache.sh /scripts/
47+
RUN sh /scripts/sccache.sh
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright 2018 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 spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
12+
13+
pub fn target() -> TargetResult {
14+
let base = super::linux_musl_base::opts();
15+
Ok(Target {
16+
// It's important we use "gnueabihf" and not "musleabihf" here. LLVM
17+
// uses it to determine the calling convention and float ABI, and LLVM
18+
// doesn't support the "musleabihf" value.
19+
llvm_target: "armv5te-unknown-linux-gnueabi".to_string(),
20+
target_endian: "little".to_string(),
21+
target_pointer_width: "32".to_string(),
22+
target_c_int_width: "32".to_string(),
23+
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
24+
arch: "arm".to_string(),
25+
target_os: "linux".to_string(),
26+
target_env: "musl".to_string(),
27+
target_vendor: "unknown".to_string(),
28+
linker_flavor: LinkerFlavor::Gcc,
29+
30+
options: TargetOptions {
31+
features: "+soft-float,+strict-align".to_string(),
32+
// Atomic operations provided by compiler-builtins
33+
max_atomic_width: Some(32),
34+
abi_blacklist: super::arm_base::abi_blacklist(),
35+
.. base
36+
}
37+
})
38+
}

src/librustc_target/spec/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ supported_targets! {
283283
("arm-unknown-linux-musleabihf", arm_unknown_linux_musleabihf),
284284
("armv4t-unknown-linux-gnueabi", armv4t_unknown_linux_gnueabi),
285285
("armv5te-unknown-linux-gnueabi", armv5te_unknown_linux_gnueabi),
286+
("armv5te-unknown-linux-musl", armv5te_unknown_linux_musl),
286287
("armv7-unknown-linux-gnueabihf", armv7_unknown_linux_gnueabihf),
287288
("armv7-unknown-linux-musleabihf", armv7_unknown_linux_musleabihf),
288289
("aarch64-unknown-linux-gnu", aarch64_unknown_linux_gnu),

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ static TARGETS: &'static [&'static str] = &[
5757
"arm-unknown-linux-musleabi",
5858
"arm-unknown-linux-musleabihf",
5959
"armv5te-unknown-linux-gnueabi",
60+
"armv5te-unknown-linux-musl",
6061
"armv7-apple-ios",
6162
"armv7-linux-androideabi",
6263
"armv7-unknown-cloudabi-eabihf",

0 commit comments

Comments
 (0)