Skip to content

Commit 3013c36

Browse files
lovellkleisauke
andauthored
Use rust nightly on platforms where linker supports it (#280)
Allows use of not-yet-stable flags to reduce binary size by ~200KB Co-authored-by: Kleis Auke Wolthuizen <[email protected]>
1 parent 77fb93c commit 3013c36

File tree

8 files changed

+20
-5
lines changed

8 files changed

+20
-5
lines changed

build/posix.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ CURL="curl --silent --location --retry 3 --retry-max-time 30"
106106

107107
if [ "$DARWIN" = true ]; then
108108
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
109-
| sh -s -- -y --no-modify-path --profile minimal
109+
| sh -s -- -y --no-modify-path --profile minimal --default-toolchain nightly
110+
export RUSTFLAGS+=" -Zlocation-detail=none -Zfmt-debug=none"
110111
CFLAGS= cargo install cargo-c --locked
111112
fi
112113

platforms/linux-arm64v8/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ RUN \
4848
--no-modify-path \
4949
--profile minimal \
5050
--default-host aarch64-unknown-linux-gnu \
51+
--default-toolchain nightly \
5152
&& \
5253
cargo install cargo-c --locked && \
5354
ln -s /usr/bin/cmake3 /usr/bin/cmake && \
@@ -58,6 +59,7 @@ ENV \
5859
PKG_CONFIG="pkg-config --static" \
5960
PLATFORM="linux-arm64v8" \
6061
FLAGS="-march=armv8-a" \
62+
RUSTFLAGS="-Zlocation-detail=none -Zfmt-debug=none" \
6163
MESON="--cross-file=/root/meson.ini"
6264

6365
COPY Toolchain.cmake /root/

platforms/linux-armv6/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ RUN \
3535
curl https://sh.rustup.rs -sSf | sh -s -- -y \
3636
--no-modify-path \
3737
--profile minimal \
38+
--target arm-unknown-linux-gnueabihf \
39+
--default-toolchain nightly \
3840
&& \
39-
rustup target add arm-unknown-linux-gnueabihf && \
4041
cargo install cargo-c --locked && \
4142
pip3 install meson==1.7.2 tomli
4243

@@ -47,6 +48,7 @@ ENV \
4748
CHOST="arm-rpi-linux-gnueabihf" \
4849
RUST_TARGET="arm-unknown-linux-gnueabihf" \
4950
FLAGS="-marm -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard" \
51+
RUSTFLAGS="-Zlocation-detail=none -Zfmt-debug=none" \
5052
WITHOUT_NEON="true" \
5153
# Highway requires NEON (Armv7+)
5254
WITHOUT_HIGHWAY="true" \

platforms/linux-ppc64le/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ RUN \
3333
curl https://sh.rustup.rs -sSf | sh -s -- -y \
3434
--no-modify-path \
3535
--profile minimal \
36+
--target powerpc64le-unknown-linux-gnu \
37+
--default-toolchain nightly \
3638
&& \
37-
rustup target add powerpc64le-unknown-linux-gnu && \
3839
cargo install cargo-c --locked && \
3940
pip3 install meson==1.7.2 tomli
4041

@@ -49,6 +50,7 @@ ENV \
4950
CHOST="powerpc64le-linux-gnu" \
5051
RUST_TARGET="powerpc64le-unknown-linux-gnu" \
5152
FLAGS="" \
53+
RUSTFLAGS="-Zlocation-detail=none -Zfmt-debug=none" \
5254
MESON="--cross-file=/root/meson.ini"
5355

5456
COPY Toolchain.cmake /root/

platforms/linux-riscv64/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ RUN \
3535
curl https://sh.rustup.rs -sSf | sh -s -- -y \
3636
--no-modify-path \
3737
--profile minimal \
38+
--target riscv64gc-unknown-linux-gnu \
39+
--default-toolchain nightly \
3840
&& \
39-
rustup target add riscv64gc-unknown-linux-gnu && \
4041
cargo install cargo-c --locked && \
4142
pipx install meson==1.7.2
4243

@@ -47,6 +48,7 @@ ENV \
4748
CHOST="riscv64-linux-gnu" \
4849
RUST_TARGET="riscv64gc-unknown-linux-gnu" \
4950
FLAGS="-march=rv64gc" \
51+
RUSTFLAGS="-Zlocation-detail=none -Zfmt-debug=none" \
5052
WITHOUT_HIGHWAY="true" \
5153
MESON="--cross-file=/root/meson.ini"
5254

platforms/linux-s390x/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ RUN \
3434
curl https://sh.rustup.rs -sSf | sh -s -- -y \
3535
--no-modify-path \
3636
--profile minimal \
37+
--target s390x-unknown-linux-gnu \
38+
--default-toolchain nightly \
3739
&& \
38-
rustup target add s390x-unknown-linux-gnu && \
3940
cargo install cargo-c --locked && \
4041
pip3 install meson==1.7.2 tomli
4142

@@ -50,6 +51,7 @@ ENV \
5051
CHOST="s390x-linux-gnu" \
5152
RUST_TARGET="s390x-unknown-linux-gnu" \
5253
FLAGS="" \
54+
RUSTFLAGS="-Zlocation-detail=none -Zfmt-debug=none" \
5355
# Highway supports IBMZ starting from IBM/Z14, which needs GCC 11 or
5456
# higher (i.e. Debian 12, glibc 2.36). Therefore, it should be disabled
5557
# for the time being.

platforms/linuxmusl-arm64v8/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ RUN \
4242
--no-modify-path \
4343
--profile minimal \
4444
--default-host aarch64-unknown-linux-musl \
45+
--default-toolchain nightly \
4546
&& \
4647
cargo install cargo-c --locked && \
4748
pip3 install meson==1.7.2
@@ -51,6 +52,7 @@ ENV \
5152
PKG_CONFIG="pkg-config --static" \
5253
PLATFORM="linuxmusl-arm64v8" \
5354
FLAGS="-march=armv8-a" \
55+
RUSTFLAGS="-Zlocation-detail=none -Zfmt-debug=none" \
5456
MESON="--cross-file=/root/meson.ini"
5557

5658
COPY Toolchain.cmake /root/

platforms/linuxmusl-x64/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ RUN \
4242
curl https://sh.rustup.rs -sSf | sh -s -- -y \
4343
--no-modify-path \
4444
--profile minimal \
45+
--default-toolchain nightly \
4546
&& \
4647
cargo install cargo-c --locked && \
4748
pip3 install meson==1.7.2
@@ -51,6 +52,7 @@ ENV \
5152
PKG_CONFIG="pkg-config --static" \
5253
PLATFORM="linuxmusl-x64" \
5354
FLAGS="-march=nehalem" \
55+
RUSTFLAGS="-Zlocation-detail=none -Zfmt-debug=none" \
5456
MESON="--cross-file=/root/meson.ini"
5557

5658
COPY Toolchain.cmake /root/

0 commit comments

Comments
 (0)