Skip to content

Commit ec03af4

Browse files
Merge #1028
1028: Fix tests, linkers, and specifications for various targets. r=Emilgardis a=Alexhuszagh - Fixes linking to libgcc for `armv5te-unknown-linux-musleabi`. - Adds C++ support for FreeBSD targets by linking to `libstdc++`. - Tests dynamic library support for Android targets in CI. - Tests C++ support for `mips64el-unknown-linux-muslabi64` in CI. - Convert `mips64el-unknown-linux-muslabi64` to a hard-float toolchain to match the rust target. - Convert `mips64el-unknown-linux-muslabi64` to use the `mips64r2` architecture. - Convert `mips-unknown-linux-musl` and `mipsel-unknown-linux-musl` to use the `mips32r2` architecture, identical to the rust targets. - Document whether MIPS musl targets are hard or soft float. Co-authored-by: Alex Huszagh <[email protected]> Co-authored-by: Alexander Huszagh <[email protected]>
2 parents a0c320f + 6101ba4 commit ec03af4

19 files changed

+167
-47
lines changed

.changes/1028.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[
2+
{
3+
"description": "link to libgcc for armv5te-unknown-linux-musleabi.",
4+
"type": "fixed"
5+
},
6+
{
7+
"description": "add C++ support for FreeBSD targets.",
8+
"type": "added"
9+
},
10+
{
11+
"description": "test dynamic library support for Android targets in CI.",
12+
"type": "internal"
13+
},
14+
{
15+
"description": "test partial C++ support for mips64el-unknown-linux-muslabi64 in CI.",
16+
"type": "internal"
17+
},
18+
{
19+
"description": "convert mips64el-unknown-linux-muslabi64 to a hard-float toolchain to match the rust target.",
20+
"type": "changed",
21+
"breaking": true
22+
},
23+
{
24+
"description": "convert mips64el-unknown-linux-muslabi64 to use the mips64r2 architecture, identical to the rust target.",
25+
"type": "changed",
26+
"breaking": true
27+
},
28+
{
29+
"description": "convert mips-unknown-linux-musl and mipsel-unknown-linux-musl to use the mips32r2 architecture, identical to the rust targets.",
30+
"type": "changed",
31+
"breaking": true
32+
}
33+
]

docker/Dockerfile.armv5te-unknown-linux-musleabi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ RUN /musl-symlink.sh $CROSS_MUSL_SYSROOT arm
2626

2727
COPY qemu-runner base-runner.sh /
2828

29-
ENV CARGO_TARGET_ARMV5TE_UNKNOWN_LINUX_MUSLEABI_LINKER=arm-linux-musleabi-gcc \
29+
COPY arm-linux-musleabi-gcc.sh /usr/bin/
30+
31+
ENV CARGO_TARGET_ARMV5TE_UNKNOWN_LINUX_MUSLEABI_LINKER=arm-linux-musleabi-gcc.sh \
3032
CARGO_TARGET_ARMV5TE_UNKNOWN_LINUX_MUSLEABI_RUNNER="/qemu-runner arm" \
3133
CC_armv5te_unknown_linux_musleabi=arm-linux-musleabi-gcc \
3234
CXX_armv5te_unknown_linux_musleabi=arm-linux-musleabi-g++ \

docker/Dockerfile.i686-unknown-freebsd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ COPY freebsd-install.sh /
1919
COPY freebsd-extras.sh /
2020
RUN /freebsd-extras.sh
2121

22-
ENV CARGO_TARGET_I686_UNKNOWN_FREEBSD_LINKER=i686-unknown-freebsd12-gcc \
22+
COPY i686-unknown-freebsd12-gcc.sh /usr/bin
23+
24+
ENV CARGO_TARGET_I686_UNKNOWN_FREEBSD_LINKER=i686-unknown-freebsd12-gcc.sh \
2325
CC_i686_unknown_freebsd=i686-unknown-freebsd12-gcc \
2426
CXX_i686_unknown_freebsd=i686-unknown-freebsd12-g++ \
2527
BINDGEN_EXTRA_CLANG_ARGS_i686_unknown_freebsd="--sysroot=/usr/local/i686-unknown-freebsd12" \

docker/Dockerfile.mips-unknown-linux-musl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ RUN /xargo.sh
1313
COPY qemu.sh /
1414
RUN /qemu.sh mips
1515

16+
# this is a soft-float target for the mips32r2 architecture
17+
# https://github.com/rust-lang/rust/blob/75d3027fb5ce1af6712e4503c9574802212101bd/compiler/rustc_target/src/spec/mips_unknown_linux_musl.rs#L7
1618
COPY musl.sh /
1719
RUN /musl.sh \
1820
TARGET=mips-linux-muslsf \

docker/Dockerfile.mips64-unknown-linux-muslabi64

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ RUN /xargo.sh
1212
COPY qemu.sh /
1313
RUN /qemu.sh mips64
1414

15+
# this is a hard-float target for the mips64r2 architecture
16+
# https://github.com/rust-lang/rust/blob/75d3027fb5ce1af6712e4503c9574802212101bd/compiler/rustc_target/src/spec/mips64_unknown_linux_muslabi64.rs#L7
1517
COPY musl.sh /
1618
RUN /musl.sh \
1719
TARGET=mips64-linux-musl \

docker/Dockerfile.mips64el-unknown-linux-muslabi64

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,29 @@ RUN /xargo.sh
1212
COPY qemu.sh /
1313
RUN /qemu.sh mips64el
1414

15+
# this is a hard-float target for the mips64r2 architecture
16+
# https://github.com/rust-lang/rust/blob/75d3027fb5ce1af6712e4503c9574802212101bd/compiler/rustc_target/src/spec/mips64el_unknown_linux_muslabi64.rs#L6
1517
COPY musl.sh /
1618
RUN /musl.sh \
17-
TARGET=mips64el-linux-muslsf \
18-
"COMMON_CONFIG += -with-arch=mips64"
19+
TARGET=mips64el-linux-musl \
20+
"COMMON_CONFIG += -with-arch=mips64r2"
1921

20-
ENV CROSS_MUSL_SYSROOT=/usr/local/mips64el-linux-muslsf
22+
ENV CROSS_MUSL_SYSROOT=/usr/local/mips64el-linux-musl
2123
COPY musl-symlink.sh /
22-
RUN /musl-symlink.sh $CROSS_MUSL_SYSROOT mips64el-sf
24+
RUN /musl-symlink.sh $CROSS_MUSL_SYSROOT mips64el
25+
RUN mkdir -p $CROSS_MUSL_SYSROOT/usr/lib64
26+
# needed for the C/C++ runners
27+
RUN ln -s $CROSS_MUSL_SYSROOT/usr/lib/libc.so $CROSS_MUSL_SYSROOT/usr/lib64/libc.so
28+
RUN ln -s $CROSS_MUSL_SYSROOT/usr/lib/libc.so.1 $CROSS_MUSL_SYSROOT/usr/lib64/libc.so.1
29+
30+
COPY mips64el-linux-musl-gcc.sh /usr/bin/
2331

2432
COPY qemu-runner base-runner.sh /
2533

26-
ENV CARGO_TARGET_MIPS64EL_UNKNOWN_LINUX_MUSLABI64_LINKER=mips64el-linux-muslsf-gcc \
34+
ENV CARGO_TARGET_MIPS64EL_UNKNOWN_LINUX_MUSLABI64_LINKER=mips64el-linux-musl-gcc.sh \
2735
CARGO_TARGET_MIPS64EL_UNKNOWN_LINUX_MUSLABI64_RUNNER="/qemu-runner mips64el" \
28-
CC_mips64el_unknown_linux_muslabi64=mips64el-linux-muslsf-gcc \
29-
CXX_mips64el_unknown_linux_muslabi64=mips64el-linux-muslsf-g++ \
36+
CC_mips64el_unknown_linux_muslabi64=mips64el-linux-musl-gcc \
37+
CXX_mips64el_unknown_linux_muslabi64=mips64el-linux-musl-g++ \
3038
BINDGEN_EXTRA_CLANG_ARGS_mips64el_unknown_linux_muslabi64="--sysroot=$CROSS_MUSL_SYSROOT" \
3139
QEMU_LD_PREFIX=$CROSS_MUSL_SYSROOT \
3240
RUST_TEST_THREADS=1

docker/Dockerfile.mipsel-unknown-linux-musl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ RUN /xargo.sh
1313
COPY qemu.sh /
1414
RUN /qemu.sh mipsel
1515

16+
# this is a soft-float target for the mips32r2 architecture
17+
# https://github.com/rust-lang/rust/blob/75d3027fb5ce1af6712e4503c9574802212101bd/compiler/rustc_target/src/spec/mipsel_unknown_linux_musl.rs#L6
1618
COPY musl.sh /
1719
RUN /musl.sh \
1820
TARGET=mipsel-linux-muslsf \
19-
"COMMON_CONFIG += -with-arch=mips32"
21+
"COMMON_CONFIG += -with-arch=mips32r2"
2022

2123
ENV CROSS_MUSL_SYSROOT=/usr/local/mipsel-linux-muslsf
2224
COPY musl-symlink.sh /

docker/Dockerfile.x86_64-unknown-freebsd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ COPY freebsd-install.sh /
1919
COPY freebsd-extras.sh /
2020
RUN /freebsd-extras.sh
2121

22-
ENV CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd12-gcc \
22+
COPY x86_64-unknown-freebsd12-gcc.sh /usr/bin
23+
24+
ENV CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd12-gcc.sh \
2325
CC_x86_64_unknown_freebsd=x86_64-unknown-freebsd12-gcc \
2426
CXX_x86_64_unknown_freebsd=x86_64-unknown-freebsd12-g++ \
2527
BINDGEN_EXTRA_CLANG_ARGS_x86_64_unknown_freebsd="--sysroot=/usr/local/x86_64-unknown-freebsd12" \

docker/aarch64-linux-musl-gcc.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@ set -x
88
set -euo pipefail
99

1010
main() {
11-
local release=
12-
release=$(rustc -Vv | grep '^release:' | cut -d ':' -f2)
13-
# NOTE we assume `major` is always "1"
14-
local minor=
15-
minor=$(echo "$release" | cut -d '.' -f2)
16-
17-
if (( minor >= 48 )) || [[ $# -eq 0 ]]; then
11+
if (( CROSS_RUSTC_MINOR_VERSION >= 48 )) || [[ $# -eq 0 ]]; then
1812
# no workaround
1913
exec aarch64-linux-musl-gcc "${@}"
2014
else

docker/arm-linux-musleabi-gcc.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
# this linker wrapper works around the missing sync `sync_X_and_fetch`
44
# routines. this affects rust versions with compiler-builtins <= 0.1.77,
5-
# which has not yet been merged into stable. this requires the `-lgcc`
5+
# which affects toolchains older than 1.65 which require the `-lgcc`
66
# linker flag to provide the missing builtin.
77
# https://github.com/rust-lang/compiler-builtins/pull/484
88

99
set -x
1010
set -euo pipefail
1111

1212
main() {
13-
if [[ $# -eq 0 ]]; then
13+
if (( CROSS_RUSTC_MINOR_VERSION >= 65 )) || [[ $# -eq 0 ]]; then
1414
exec arm-linux-musleabi-gcc "${@}"
1515
else
1616
exec arm-linux-musleabi-gcc "${@}" -lgcc -static-libgcc

0 commit comments

Comments
 (0)