Skip to content

Commit 48193e8

Browse files
committed
Auto merge of #1365 - gnzlbg:cleanup_linux, r=gnzlbg
[breaking change] Cleanup linux and update MUSL * Update MUSL kernel headers to 4.4.2 (non-breaking) * [breaking] `MADV_SOFT_OFFLINE` is not defined on MIPS * [breaking] `sendmmsg`/`recvmmsg` take an `unsigned int` flag on MUSL * [breaking] `pthread_t` is a pointer on MUSL * `rlimit` resources should use a type alias on GNU (non-breaking) * Deprecate `SIGNUNUSED` (should use SIGSYS instead)
2 parents 8e2e498 + 1a3d152 commit 48193e8

File tree

45 files changed

+605
-478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+605
-478
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ matrix:
2222
install: true
2323
script:
2424
- shellcheck --version
25-
- shellcheck ci/*.sh
25+
# FIXME: https://github.com/koalaman/shellcheck/issues/1591
26+
- shellcheck -e SC2103 ci/*.sh
2627
stage: tools-and-build-and-tier1
2728
- name: "Style"
2829
install: true

ci/docker/aarch64-unknown-linux-musl/Dockerfile

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,9 @@ FROM ubuntu:19.04
33
RUN apt-get update && apt-get install -y --no-install-recommends \
44
gcc make libc6-dev git curl ca-certificates \
55
gcc-aarch64-linux-gnu qemu-user
6-
RUN curl --retry 5 https://www.musl-libc.org/releases/musl-1.1.22.tar.gz | \
7-
tar xzf - && \
8-
cd musl-1.1.22 && \
9-
CC=aarch64-linux-gnu-gcc \
10-
./configure --prefix=/musl-aarch64 --enable-wrapper=yes && \
11-
make install -j4 && \
12-
cd .. && \
13-
rm -rf musl-1.1.22
14-
# Install linux kernel headers sanitized for use with musl
15-
RUN curl --retry 5 -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \
16-
tar xzf - && \
17-
cd kernel-headers-3.12.6-6 && \
18-
make ARCH=arm64 prefix=/musl-aarch64 install -j4 && \
19-
cd .. && \
20-
rm -rf kernel-headers-3.12.6-6
6+
7+
COPY install-musl.sh /
8+
RUN sh /install-musl.sh aarch64
219

2210
# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in libstd?
2311
ENV PATH=$PATH:/musl-aarch64/bin:/rust/bin \

ci/docker/arm-unknown-linux-musleabihf/Dockerfile

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
44
gcc make libc6-dev git curl ca-certificates \
55
gcc-arm-linux-gnueabihf qemu-user
66

7-
RUN curl --retry 5 https://www.musl-libc.org/releases/musl-1.1.22.tar.gz | tar xzf -
8-
WORKDIR /musl-1.1.22
9-
RUN CC=arm-linux-gnueabihf-gcc \
10-
CFLAGS="-march=armv6 -marm -mfpu=vfp" \
11-
./configure --prefix=/musl-arm --enable-wrapper=yes
12-
RUN make install -j4
13-
14-
# Install linux kernel headers sanitized for use with musl
15-
RUN curl --retry 5 -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \
16-
tar xzf - && \
17-
cd kernel-headers-3.12.6-6 && \
18-
make ARCH=arm prefix=/musl-arm install -j4 && \
19-
cd .. && \
20-
rm -rf kernel-headers-3.12.6-6
7+
COPY install-musl.sh /
8+
RUN sh /install-musl.sh arm
219

2210
ENV PATH=$PATH:/musl-arm/bin:/rust/bin \
2311
CC_arm_unknown_linux_musleabihf=musl-gcc \

ci/docker/i686-unknown-linux-musl/Dockerfile

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,9 @@ RUN dpkg --add-architecture i386
44
RUN apt-get update
55
RUN apt-get install -y --no-install-recommends \
66
gcc-multilib make libc6-dev git curl ca-certificates libc6:i386
7-
# Below we're cross-compiling musl for i686 using the system compiler on an
8-
# x86_64 system. This is an awkward thing to be doing and so we have to jump
9-
# through a couple hoops to get musl to be happy. In particular:
10-
#
11-
# * We specifically pass -m32 in CFLAGS and override CC when running ./configure,
12-
# since otherwise the script will fail to find a compiler.
13-
# * We manually unset CROSS_COMPILE when running make; otherwise the makefile
14-
# will call the non-existent binary 'i686-ar'.
15-
RUN curl --retry 5 https://www.musl-libc.org/releases/musl-1.1.22.tar.gz | \
16-
tar xzf - && \
17-
cd musl-1.1.22 && \
18-
CC=gcc CFLAGS=-m32 ./configure --prefix=/musl-i686 --disable-shared --target=i686 && \
19-
make CROSS_COMPILE= install -j4 && \
20-
cd .. && \
21-
rm -rf musl-1.1.22
22-
# Install linux kernel headers sanitized for use with musl
23-
RUN curl --retry 5 -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \
24-
tar xzf - && \
25-
cd kernel-headers-3.12.6-6 && \
26-
make ARCH=i386 prefix=/musl-i686 install -j4 && \
27-
cd .. && \
28-
rm -rf kernel-headers-3.12.6-6
7+
8+
COPY install-musl.sh /
9+
RUN sh /install-musl.sh i686
2910

3011
ENV PATH=$PATH:/musl-i686/bin:/rust/bin \
3112
CC_i686_unknown_linux_musl=musl-gcc

ci/docker/mips-unknown-linux-gnu/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM ubuntu:19.04
33
RUN apt-get update && apt-get install -y --no-install-recommends \
44
gcc libc6-dev qemu-user ca-certificates \
55
gcc-mips-linux-gnu libc6-dev-mips-cross \
6-
qemu-system-mips
6+
qemu-system-mips linux-headers-generic
77

88
ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc \
99
CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_RUNNER="qemu-mips -L /usr/mips-linux-gnu" \

ci/docker/mips-unknown-linux-musl/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ RUN mkdir /toolchain
99
# Note that this originally came from:
1010
# https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/OpenWrt-SDK-ar71xx-generic_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2
1111
RUN curl --retry 5 -L https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/OpenWrt-SDK-ar71xx-generic_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 | \
12-
tar xjf - -C /toolchain --strip-components=1
12+
tar xjf - -C /toolchain --strip-components=1
1313

1414
ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15/bin \
1515
CC_mips_unknown_linux_musl=mips-openwrt-linux-gcc \

ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM ubuntu:19.04
33
RUN apt-get update && apt-get install -y --no-install-recommends \
44
gcc libc6-dev qemu-user ca-certificates \
55
gcc-mips64-linux-gnuabi64 libc6-dev-mips64-cross \
6-
qemu-system-mips64
6+
qemu-system-mips64 linux-headers-generic
77

88
ENV CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_LINKER=mips64-linux-gnuabi64-gcc \
99
CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_RUNNER="qemu-mips64 -L /usr/mips64-linux-gnuabi64" \

ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM ubuntu:19.04
33
RUN apt-get update && apt-get install -y --no-install-recommends \
44
gcc libc6-dev qemu-user ca-certificates \
55
gcc-mips64el-linux-gnuabi64 libc6-dev-mips64el-cross \
6-
qemu-system-mips64el
6+
qemu-system-mips64el linux-headers-generic
77

88
ENV CARGO_TARGET_MIPS64EL_UNKNOWN_LINUX_GNUABI64_LINKER=mips64el-linux-gnuabi64-gcc \
99
CARGO_TARGET_MIPS64EL_UNKNOWN_LINUX_GNUABI64_RUNNER="qemu-mips64el -L /usr/mips64el-linux-gnuabi64" \
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
FROM ubuntu:19.04
22
RUN apt-get update
33
RUN apt-get install -y --no-install-recommends \
4-
gcc libc6-dev ca-certificates
4+
gcc libc6-dev ca-certificates linux-headers-generic
5+
6+
RUN apt search linux-headers
7+
RUN ls /usr/src
8+
59
ENV PATH=$PATH:/rust/bin

ci/docker/x86_64-unknown-linux-musl/Dockerfile

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,8 @@ FROM ubuntu:19.04
33
RUN apt-get update
44
RUN apt-get install -y --no-install-recommends \
55
gcc make libc6-dev git curl ca-certificates
6-
RUN curl --retry 5 https://www.musl-libc.org/releases/musl-1.1.22.tar.gz | \
7-
tar xzf - && \
8-
cd musl-1.1.22 && \
9-
./configure --prefix=/musl-x86_64 && \
10-
make install -j4 && \
11-
cd .. && \
12-
rm -rf musl-1.1.22
13-
# Install linux kernel headers sanitized for use with musl
14-
RUN curl --retry 5 -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \
15-
tar xzf - && \
16-
cd kernel-headers-3.12.6-6 && \
17-
make ARCH=x86_64 prefix=/musl-x86_64 install -j4 && \
18-
cd .. && \
19-
rm -rf kernel-headers-3.12.6-6
6+
7+
COPY install-musl.sh /
8+
RUN sh /install-musl.sh x86_64
9+
2010
ENV PATH=$PATH:/musl-x86_64/bin:/rust/bin

ci/install-musl.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env sh
2+
#
3+
# Install musl and musl-sanitized linux kernel headers
4+
# to musl-{$1} directory
5+
6+
set -ex
7+
8+
MUSL_VERSION=1.1.22
9+
MUSL="musl-${MUSL_VERSION}"
10+
11+
# Download, configure, build, and install musl:
12+
curl --retry 5 https://www.musl-libc.org/releases/${MUSL}.tar.gz | tar xzf -
13+
14+
cd $MUSL
15+
case ${1} in
16+
aarch64)
17+
musl_arch=aarch64
18+
kernel_arch=arm64
19+
CC=aarch64-linux-gnu-gcc \
20+
./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes
21+
make install -j4
22+
;;
23+
arm)
24+
musl_arch=arm
25+
kernel_arch=arm
26+
CC=arm-linux-gnueabihf-gcc CFLAGS="-march=armv6 -marm -mfpu=vfp" \
27+
./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes
28+
make install -j4
29+
;;
30+
i686)
31+
# cross-compile musl for i686 using the system compiler on an x86_64
32+
# system.
33+
musl_arch=i686
34+
kernel_arch=i386
35+
# Specifically pass -m32 in CFLAGS and override CC when running
36+
# ./configure, since otherwise the script will fail to find a compiler.
37+
CC=gcc CFLAGS="-m32" \
38+
./configure --prefix="/musl-${musl_arch}" --disable-shared --target=i686
39+
# unset CROSS_COMPILE when running make; otherwise the makefile will
40+
# call the non-existent binary 'i686-ar'.
41+
make CROSS_COMPILE= install -j4
42+
;;
43+
x86_64)
44+
musl_arch=x86_64
45+
kernel_arch=x86_64
46+
./configure --prefix="/musl-${musl_arch}"
47+
make install -j4
48+
;;
49+
*)
50+
echo "Unknown target arch: \"${1}\""
51+
exit 1
52+
;;
53+
esac
54+
55+
56+
# shellcheck disable=SC2103
57+
cd ..
58+
rm -rf $MUSL
59+
60+
# Download, configure, build, and install musl-sanitized kernel headers:
61+
KERNEL_HEADER_VER="4.4.2-2"
62+
curl --retry 5 -L \
63+
"https://github.com/sabotage-linux/kernel-headers/archive/v${KERNEL_HEADER_VER}.tar.gz" | \
64+
tar xzf -
65+
(
66+
cd kernel-headers-${KERNEL_HEADER_VER}
67+
make ARCH="${kernel_arch}" prefix="/musl-${musl_arch}" install -j4
68+
)
69+
rm -rf kernel-headers-${KERNEL_HEADER_VER}

libc-test/Cargo.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,26 @@ name = "linux-fcntl"
2828
path = "test/linux_fcntl.rs"
2929
harness = false
3030

31+
[[test]]
32+
name = "linux-ipv6"
33+
path = "test/linux_ipv6.rs"
34+
harness = false
35+
36+
[[test]]
37+
name = "linux-elf"
38+
path = "test/linux_elf.rs"
39+
harness = false
40+
41+
[[test]]
42+
name = "linux-strerror_r"
43+
path = "test/linux_strerror_r.rs"
44+
harness = false
45+
46+
[[test]]
47+
name = "linux-termios"
48+
path = "test/linux_termios.rs"
49+
harness = false
50+
3151
[[test]]
3252
name = "cmsg"
3353
path = "test/cmsg.rs"

0 commit comments

Comments
 (0)