Skip to content

Commit c0f6a1c

Browse files
committed
Auto merge of #135262 - mrkajetanp:ci-aarch64-dist-reland, r=Kobzol
ci: Move dist-aarch64-linux to an aarch64 runner Move the dist-aarch64-linux CI job to an aarch64 runner instead of cross-compiling it from an x86 one. This will make it possible to perform optimisations such as LTO, PGO and BOLT later on. r? `@Kobzol` Reland of #133809 now that the higher page sizes are fixed. try-job: dist-aarch64-linux try-job: dist-x86_64-linux try-job: dist-i686-linux
2 parents 1b41e84 + 9ba34f8 commit c0f6a1c

File tree

16 files changed

+134
-95
lines changed

16 files changed

+134
-95
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# We document platform support for minimum glibc 2.17 and kernel 3.2.
2+
# CentOS 7 has headers for kernel 3.10, but that's fine as long as we don't
3+
# actually use newer APIs in rustc or std without a fallback. It's more
4+
# important that we match glibc for ELF symbol versioning.
5+
FROM centos:7
6+
7+
WORKDIR /build
8+
9+
# CentOS 7 EOL is June 30, 2024, but the repos remain in the vault.
10+
RUN sed -i /etc/yum.repos.d/*.repo -e 's!^mirrorlist!#mirrorlist!' \
11+
-e 's!^#baseurl=http://mirror.centos.org/!baseurl=https://vault.centos.org/!'
12+
RUN sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf
13+
14+
RUN yum upgrade -y && \
15+
yum install -y \
16+
automake \
17+
bzip2 \
18+
file \
19+
gcc \
20+
gcc-c++ \
21+
git \
22+
glibc-devel \
23+
libedit-devel \
24+
libstdc++-devel \
25+
make \
26+
ncurses-devel \
27+
openssl-devel \
28+
patch \
29+
perl \
30+
perl-core \
31+
pkgconfig \
32+
python3 \
33+
unzip \
34+
wget \
35+
xz \
36+
zlib-devel \
37+
&& yum clean all
38+
39+
RUN mkdir -p /rustroot/bin
40+
41+
ENV PATH=/rustroot/bin:$PATH
42+
ENV LD_LIBRARY_PATH=/rustroot/lib64:/rustroot/lib32:/rustroot/lib
43+
ENV PKG_CONFIG_PATH=/rustroot/lib/pkgconfig
44+
WORKDIR /tmp
45+
RUN mkdir /home/user
46+
COPY scripts/shared.sh /tmp/
47+
48+
# Need at least GCC 5.1 to compile LLVM
49+
COPY scripts/build-gcc.sh /tmp/
50+
ENV GCC_VERSION=9.5.0
51+
ENV GCC_BUILD_TARGET=aarch64-unknown-linux-gnu
52+
RUN ./build-gcc.sh && yum remove -y gcc gcc-c++
53+
54+
ENV CC=gcc CXX=g++
55+
56+
# LLVM 17 needs cmake 3.20 or higher.
57+
COPY scripts/cmake.sh /tmp/
58+
RUN ./cmake.sh
59+
60+
# Build LLVM+Clang
61+
COPY scripts/build-clang.sh /tmp/
62+
ENV LLVM_BUILD_TARGETS=AArch64
63+
RUN ./build-clang.sh
64+
ENV CC=clang CXX=clang++
65+
66+
# Build zstd to enable `llvm.libzstd`.
67+
COPY scripts/build-zstd.sh /tmp/
68+
RUN ./build-zstd.sh
69+
70+
COPY scripts/sccache.sh /scripts/
71+
RUN sh /scripts/sccache.sh
72+
73+
ENV PGO_HOST=aarch64-unknown-linux-gnu
74+
ENV HOSTS=aarch64-unknown-linux-gnu
75+
76+
ENV CPATH=/usr/include/aarch64-linux-gnu/:$CPATH
77+
78+
ENV RUST_CONFIGURE_ARGS \
79+
--build=aarch64-unknown-linux-gnu \
80+
--enable-full-tools \
81+
--enable-profiler \
82+
--enable-sanitizers \
83+
--enable-compiler-docs \
84+
--set target.aarch64-unknown-linux-gnu.linker=clang \
85+
--set target.aarch64-unknown-linux-gnu.ar=/rustroot/bin/llvm-ar \
86+
--set target.aarch64-unknown-linux-gnu.ranlib=/rustroot/bin/llvm-ranlib \
87+
--set llvm.link-shared=true \
88+
--set llvm.thin-lto=true \
89+
--set llvm.libzstd=true \
90+
--set llvm.ninja=false \
91+
--set rust.debug-assertions=false \
92+
--set rust.jemalloc \
93+
--set rust.use-lld=true \
94+
--set rust.codegen-units=1
95+
96+
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
97+
98+
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=clang
99+
ENV LIBCURL_NO_PKG_CONFIG 1
100+
ENV DIST_REQUIRE_ALL_TOOLS 1

src/ci/docker/host-x86_64/dist-aarch64-linux/Dockerfile

-32
This file was deleted.

src/ci/docker/host-x86_64/dist-aarch64-linux/aarch64-linux-gnu.defconfig

-10
This file was deleted.

src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile

+6-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ RUN yum upgrade -y && \
1919
gcc \
2020
gcc-c++ \
2121
git \
22+
binutils.i686 \
2223
glibc-devel.i686 \
2324
glibc-devel.x86_64 \
2425
libedit-devel \
@@ -46,19 +47,21 @@ ENV LD_LIBRARY_PATH=/rustroot/lib64:/rustroot/lib32:/rustroot/lib
4647
ENV PKG_CONFIG_PATH=/rustroot/lib/pkgconfig
4748
WORKDIR /tmp
4849
RUN mkdir /home/user
49-
COPY host-x86_64/dist-x86_64-linux/shared.sh /tmp/
50+
COPY scripts/shared.sh /tmp/
5051

5152
# Need at least GCC 5.1 to compile LLVM nowadays
52-
COPY host-x86_64/dist-x86_64-linux/build-gcc.sh /tmp/
53+
COPY scripts/build-gcc.sh /tmp/
5354
ENV GCC_VERSION=9.5.0
55+
ENV GCC_BUILD_TARGET=i686-pc-linux-gnu
5456
RUN ./build-gcc.sh && yum remove -y gcc gcc-c++
5557

5658
COPY scripts/cmake.sh /tmp/
5759
RUN ./cmake.sh
5860

5961
# Now build LLVM+Clang, afterwards configuring further compilations to use the
6062
# clang/clang++ compilers.
61-
COPY host-x86_64/dist-x86_64-linux/build-clang.sh /tmp/
63+
COPY scripts/build-clang.sh /tmp/
64+
ENV LLVM_BUILD_TARGETS=X86
6265
RUN ./build-clang.sh
6366
ENV CC=clang CXX=clang++
6467

src/ci/docker/host-x86_64/dist-powerpc64le-linux/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RUN /scripts/crosstool-ng-build.sh
1818
WORKDIR /build
1919

2020
RUN apt-get install -y --no-install-recommends rpm2cpio cpio
21-
COPY host-x86_64/dist-powerpc64le-linux/shared.sh host-x86_64/dist-powerpc64le-linux/build-powerpc64le-toolchain.sh /build/
21+
COPY scripts/shared.sh host-x86_64/dist-powerpc64le-linux/build-powerpc64le-toolchain.sh /build/
2222
RUN ./build-powerpc64le-toolchain.sh
2323

2424
COPY scripts/sccache.sh /scripts/

src/ci/docker/host-x86_64/dist-powerpc64le-linux/shared.sh

-16
This file was deleted.

src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile

+6-4
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,12 @@ ENV PKG_CONFIG_PATH=/rustroot/lib/pkgconfig
4747
# Clang needs to access GCC headers to enable linker plugin LTO
4848
WORKDIR /tmp
4949
RUN mkdir /home/user
50-
COPY host-x86_64/dist-x86_64-linux/shared.sh /tmp/
50+
COPY scripts/shared.sh /tmp/
5151

5252
# Need at least GCC 5.1 to compile LLVM nowadays
53-
COPY host-x86_64/dist-x86_64-linux/build-gcc.sh /tmp/
53+
COPY scripts/build-gcc.sh /tmp/
5454
ENV GCC_VERSION=9.5.0
55+
ENV GCC_BUILD_TARGET=x86_64-pc-linux-gnu
5556
RUN ./build-gcc.sh && yum remove -y gcc gcc-c++
5657

5758
# LLVM 17 needs cmake 3.20 or higher.
@@ -60,12 +61,13 @@ RUN ./cmake.sh
6061

6162
# Now build LLVM+Clang, afterwards configuring further compilations to use the
6263
# clang/clang++ compilers.
63-
COPY host-x86_64/dist-x86_64-linux/build-clang.sh /tmp/
64+
COPY scripts/build-clang.sh /tmp/
65+
ENV LLVM_BUILD_TARGETS=X86
6466
RUN ./build-clang.sh
6567
ENV CC=clang CXX=clang++
6668

6769
# Build zstd to enable `llvm.libzstd`.
68-
COPY host-x86_64/dist-x86_64-linux/build-zstd.sh /tmp/
70+
COPY scripts/build-zstd.sh /tmp/
6971
RUN ./build-zstd.sh
7072

7173
COPY scripts/sccache.sh /scripts/

src/ci/docker/host-x86_64/dist-x86_64-linux/shared.sh

-16
This file was deleted.

src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ ENV RUST_CONFIGURE_ARGS \
5454
--set rust.randomize-layout=true \
5555
--set rust.thin-lto-import-instr-limit=10
5656

57-
COPY host-x86_64/dist-x86_64-linux/shared.sh /scripts/
58-
COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/
57+
COPY scripts/shared.sh /scripts/
58+
COPY scripts/build-gccjit.sh /scripts/
5959

6060
RUN /scripts/build-gccjit.sh /scripts
6161

src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ ENV RUST_CONFIGURE_ARGS \
5454
--set rust.randomize-layout=true \
5555
--set rust.thin-lto-import-instr-limit=10
5656

57-
COPY host-x86_64/dist-x86_64-linux/shared.sh /scripts/
58-
COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/
57+
COPY scripts/shared.sh /scripts/
58+
COPY scripts/build-gccjit.sh /scripts/
5959

6060
RUN /scripts/build-gccjit.sh /scripts
6161

src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ ENV HOST_TARGET x86_64-unknown-linux-gnu
8989
# assertions enabled! Therefore, we cannot force download CI rustc.
9090
#ENV FORCE_CI_RUSTC 1
9191

92-
COPY host-x86_64/dist-x86_64-linux/shared.sh /scripts/
93-
COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/
92+
COPY scripts/shared.sh /scripts/
93+
COPY scripts/build-gccjit.sh /scripts/
9494

9595
RUN /scripts/build-gccjit.sh /scripts
9696

src/ci/docker/host-x86_64/dist-x86_64-linux/build-clang.sh src/ci/docker/scripts/build-clang.sh

+8-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ cd clang-build
2121
# include path, /rustroot/include, to clang's default include path.
2222
INC="/rustroot/include:/usr/include"
2323

24+
GCC_PLUGIN_TARGET=$GCC_BUILD_TARGET
25+
# We build gcc for the i686 job on x86_64 so the plugin will end up under an x86_64 path
26+
if [[ $GCC_PLUGIN_TARGET == "i686-pc-linux-gnu" ]]; then
27+
GCC_PLUGIN_TARGET=x86_64-pc-linux-gnu
28+
fi
29+
2430
# We need compiler-rt for the profile runtime (used later to PGO the LLVM build)
2531
# but sanitizers aren't currently building. Since we don't need those, just
2632
# disable them. BOLT is used for optimizing LLVM.
@@ -34,12 +40,12 @@ hide_output \
3440
-DCOMPILER_RT_BUILD_XRAY=OFF \
3541
-DCOMPILER_RT_BUILD_MEMPROF=OFF \
3642
-DCOMPILER_RT_BUILD_CTX_PROFILE=OFF \
37-
-DLLVM_TARGETS_TO_BUILD=X86 \
43+
-DLLVM_TARGETS_TO_BUILD=$LLVM_BUILD_TARGETS \
3844
-DLLVM_INCLUDE_BENCHMARKS=OFF \
3945
-DLLVM_INCLUDE_TESTS=OFF \
4046
-DLLVM_INCLUDE_EXAMPLES=OFF \
4147
-DLLVM_ENABLE_PROJECTS="clang;lld;compiler-rt;bolt" \
42-
-DLLVM_BINUTILS_INCDIR="/rustroot/lib/gcc/x86_64-pc-linux-gnu/$GCC_VERSION/plugin/include/" \
48+
-DLLVM_BINUTILS_INCDIR="/rustroot/lib/gcc/$GCC_PLUGIN_TARGET/$GCC_VERSION/plugin/include/" \
4349
-DC_INCLUDE_DIRS="$INC"
4450

4551
hide_output make -j$(nproc)

src/ci/docker/host-x86_64/dist-x86_64-linux/build-gcc.sh src/ci/docker/scripts/build-gcc.sh

+6-4
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ cd ..
5151
rm -rf gcc-build
5252
rm -rf gcc-$GCC
5353

54-
# FIXME: clang doesn't find 32-bit libraries in /rustroot/lib,
55-
# but it does look all the way under /rustroot/lib/[...]/32,
56-
# so we can link stuff there to help it out.
57-
ln /rustroot/lib/*.{a,so} -rst /rustroot/lib/gcc/x86_64-pc-linux-gnu/$GCC/32/
54+
if [[ $GCC_BUILD_TARGET == "i686-pc-linux-gnu" ]]; then
55+
# FIXME: clang doesn't find 32-bit libraries in /rustroot/lib,
56+
# but it does look all the way under /rustroot/lib/[...]/32,
57+
# so we can link stuff there to help it out.
58+
ln /rustroot/lib/*.{a,so} -rst /rustroot/lib/gcc/x86_64-pc-linux-gnu/$GCC/32/
59+
fi

src/ci/github-actions/jobs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ auto:
138138
- name: dist-aarch64-linux
139139
env:
140140
CODEGEN_BACKENDS: llvm,cranelift
141-
<<: *job-linux-4c
141+
<<: *job-aarch64-linux
142142

143143
- name: dist-android
144144
<<: *job-linux-4c

0 commit comments

Comments
 (0)