Skip to content

Commit 5f173e9

Browse files
ci: Add support for dist-loongarch64-linux
Co-Authored-By: YANG Xiaojuan <[email protected]>
1 parent 0b79504 commit 5f173e9

File tree

7 files changed

+84
-0
lines changed

7 files changed

+84
-0
lines changed

.github/workflows/ci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ jobs:
201201
- name: dist-i686-linux
202202
os: ubuntu-20.04-8core-32gb
203203
env: {}
204+
- name: dist-loongarch64-linux
205+
os: ubuntu-20.04-8core-32gb
206+
env: {}
204207
- name: dist-mips-linux
205208
os: ubuntu-20.04-8core-32gb
206209
env: {}

src/ci/docker/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,22 @@ For targets: `i586-unknown-linux-gnu`
257257
(\*) Compressed debug is enabled by default for gas (assembly) on Linux/x86 targets,
258258
but that makes our `compiler_builtins` incompatible with binutils < 2.32.
259259
260+
### `loongarch64-linux-gnu.defconfig`
261+
262+
For targets: `loongarch64-unknown-linux-gnu`
263+
264+
- Path and misc options > Prefix directory = /x-tools/${CT\_TARGET}
265+
- Path and misc options > Use a mirror = ENABLE
266+
- Path and misc options > Base URL = https://ci-mirrors.rust-lang.org/rustc
267+
- Target options > Target Architecture = loongarch
268+
- Target options > Bitness = 64-bit
269+
- Operating System > Target OS = linux
270+
- Operating System > Linux kernel version = 5.19.16
271+
- Binary utilities > Version of binutils = 2.40
272+
- C-library > glibc version = 2.36
273+
- C compiler > gcc version = 12.2.0
274+
- C compiler > C++ = ENABLE -- to cross compile LLVM
275+
260276
### `mips-linux-gnu.defconfig`
261277
262278
For targets: `mips-unknown-linux-gnu`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FROM ubuntu:22.04
2+
3+
COPY scripts/cross-apt-packages.sh /scripts/
4+
RUN sh /scripts/cross-apt-packages.sh
5+
6+
# The latest released version does not support LoongArch.
7+
COPY scripts/crosstool-ng-git.sh /scripts/
8+
RUN sh /scripts/crosstool-ng-git.sh
9+
10+
COPY scripts/rustbuild-setup.sh /scripts/
11+
RUN sh /scripts/rustbuild-setup.sh
12+
WORKDIR /tmp
13+
14+
COPY scripts/crosstool-ng-build.sh /scripts/
15+
COPY host-x86_64/dist-loongarch64-linux/loongarch64-unknown-linux-gnu.defconfig /tmp/crosstool.defconfig
16+
RUN /scripts/crosstool-ng-build.sh
17+
18+
COPY scripts/sccache.sh /scripts/
19+
RUN sh /scripts/sccache.sh
20+
21+
ENV PATH=$PATH:/x-tools/loongarch64-unknown-linux-gnu/bin
22+
23+
ENV CC_loongarch64_unknown_linux_gnu=loongarch64-unknown-linux-gnu-gcc \
24+
AR_loongarch64_unknown_linux_gnu=loongarch64-unknown-linux-gnu-ar \
25+
CXX_loongarch64_unknown_linux_gnu=loongarch64-unknown-linux-gnu-g++
26+
27+
ENV HOSTS=loongarch64-unknown-linux-gnu
28+
29+
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
30+
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
CT_CONFIG_VERSION="4"
2+
CT_EXPERIMENTAL=y
3+
CT_PREFIX_DIR="/x-tools/${CT_TARGET}"
4+
CT_USE_MIRROR=y
5+
CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc"
6+
CT_ARCH_LOONGARCH=y
7+
# CT_DEMULTILIB is not set
8+
CT_ARCH_USE_MMU=y
9+
CT_ARCH_ARCH="loongarch64"
10+
CT_KERNEL_LINUX=y
11+
CT_LINUX_V_5_19=y
12+
CT_GLIBC_V_2_36=y
13+
CT_CC_GCC_ENABLE_DEFAULT_PIE=y
14+
CT_CC_LANG_CXX=y

src/ci/docker/scripts/cross-apt-packages.sh

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install
2222
patch \
2323
pkg-config \
2424
python3 \
25+
rsync \
2526
sudo \
2627
texinfo \
2728
unzip \
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
set -ex
3+
4+
URL=https://github.com/crosstool-ng/crosstool-ng
5+
REV=943364711a650d9b9e84c1b42c91cc0265b6ab5c
6+
7+
mkdir crosstool-ng
8+
cd crosstool-ng
9+
git init
10+
git fetch --depth=1 ${URL} ${REV}
11+
git reset --hard FETCH_HEAD
12+
./bootstrap
13+
./configure --prefix=/usr/local
14+
make -j$(nproc)
15+
make install
16+
cd ..
17+
rm -rf crosstool-ng

src/ci/github-actions/ci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,9 @@ jobs:
359359
- name: dist-i686-linux
360360
<<: *job-linux-8c
361361

362+
- name: dist-loongarch64-linux
363+
<<: *job-linux-8c
364+
362365
- name: dist-mips-linux
363366
<<: *job-linux-8c
364367

0 commit comments

Comments
 (0)