Skip to content

Commit 8ee2c4c

Browse files
authored
feat: add loongarch64-unknown-linux-musl image (#1557)
Close #1556
2 parents d8631fe + 860ae2e commit 8ee2c4c

File tree

8 files changed

+122
-0
lines changed

8 files changed

+122
-0
lines changed

.changes/1557.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "added",
3+
"description": "add loongarch64-linux-musl support",
4+
"issues": [1556]
5+
}

.github/ISSUE_TEMPLATE/b_issue_report.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ body:
5353
- i686-unknown-linux-gnu
5454
- i686-unknown-linux-musl
5555
- loongarch64-unknown-linux-gnu
56+
- loongarch64-unknown-linux-musl
5657
- mips64el-unknown-linux-gnuabi64
5758
- mips64el-unknown-linux-muslabi64
5859
- mips64-unknown-linux-gnuabi64

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ terminate.
225225
| `i686-pc-windows-gnu` | N/A | 9.4 || N/A ||
226226
| `i686-unknown-linux-gnu` | 2.31 | 9.4.0 || 6.1.0 ||
227227
| `loongarch64-unknown-linux-gnu` | 2.36 | 14.2.0 || 8.2.2 ||
228+
| `loongarch64-unknown-linux-musl` | 1.2.5 | 14.2.0 || 8.2.2 ||
228229
| `mips-unknown-linux-gnu` | 2.30 | 9.4.0 || 6.1.0 ||
229230
| `mips-unknown-linux-musl` | 1.2.3 | 9.2.0 || 6.1.0 ||
230231
| `mips64-unknown-linux-gnuabi64` | 2.30 | 9.4.0 || 6.1.0 ||
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
CT_CONFIG_VERSION="4"
2+
CT_EXPERIMENTAL=y
3+
CT_PREFIX_DIR="/x-tools/${CT_TARGET}"
4+
CT_ARCH_LOONGARCH=y
5+
# CT_DEMULTILIB is not set
6+
CT_ARCH_USE_MMU=y
7+
CT_ARCH_ARCH="loongarch64"
8+
CT_KERNEL_LINUX=y
9+
%CT_LINUX_V%
10+
%CT_LINUX%
11+
CT_LIBC_MUSL=y
12+
%CT_MUSL_V%
13+
%CT_GCC_V%
14+
%CT_GCC%
15+
CT_CC_GCC_ENABLE_DEFAULT_PIE=y
16+
CT_CC_LANG_CXX=y
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
FROM ubuntu:20.04 as cross-base
2+
ENV DEBIAN_FRONTEND=noninteractive
3+
4+
COPY common.sh lib.sh /
5+
RUN /common.sh
6+
7+
COPY cmake.sh /
8+
RUN /cmake.sh
9+
10+
COPY xargo.sh /
11+
RUN /xargo.sh
12+
13+
FROM cross-base as build
14+
15+
ARG VERBOSE
16+
COPY crosstool-ng.sh /
17+
COPY crosstool-config/loongarch64-unknown-linux-musl.config /
18+
RUN /crosstool-ng.sh loongarch64-unknown-linux-musl.config 5 ed12fa68402f58e171a6f79500f73f4781fdc9e5
19+
20+
ENV PATH /x-tools/loongarch64-unknown-linux-musl/bin/:$PATH
21+
22+
COPY deny-debian-packages.sh /
23+
RUN TARGET_ARCH=loong64 /deny-debian-packages.sh
24+
25+
COPY qemu.sh /
26+
RUN /qemu.sh loongarch64
27+
28+
COPY qemu-runner base-runner.sh /
29+
COPY toolchain.cmake /opt/toolchain.cmake
30+
31+
ENV CROSS_TOOLCHAIN_PREFIX=loongarch64-unknown-linux-musl-
32+
ENV CROSS_SYSROOT=/x-tools/loongarch64-unknown-linux-musl/loongarch64-unknown-linux-musl/sysroot/
33+
ENV CROSS_TARGET_RUNNER="/qemu-runner loongarch64"
34+
ENV CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc \
35+
CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_RUNNER="$CROSS_TARGET_RUNNER" \
36+
AR_loongarch64_unknown_linux_musl="$CROSS_TOOLCHAIN_PREFIX"ar \
37+
CC_loongarch64_unknown_linux_musl="$CROSS_TOOLCHAIN_PREFIX"gcc \
38+
CXX_loongarch64_unknown_linux_musl="$CROSS_TOOLCHAIN_PREFIX"g++ \
39+
CMAKE_TOOLCHAIN_FILE_loongarch64_unknown_linux_musl=/opt/toolchain.cmake \
40+
BINDGEN_EXTRA_CLANG_ARGS_loongarch64_unknown_linux_musl="--sysroot=$CROSS_SYSROOT" \
41+
QEMU_LD_PREFIX="$CROSS_SYSROOT" \
42+
RUST_TEST_THREADS=1 \
43+
CROSS_CMAKE_SYSTEM_NAME=Linux \
44+
CROSS_CMAKE_SYSTEM_PROCESSOR=loongarch64 \
45+
CROSS_CMAKE_CRT=musl \
46+
CROSS_CMAKE_OBJECT_FLAGS="-ffunction-sections -fdata-sections -fPIC"
47+
48+
RUN sed -e "s#@DEFAULT_QEMU_LD_PREFIX@#$QEMU_LD_PREFIX#g" -i /qemu-runner
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
CT_CONFIG_VERSION="4"
2+
CT_EXPERIMENTAL=y
3+
CT_PREFIX_DIR="/x-tools/${CT_TARGET}"
4+
CT_ARCH_LOONGARCH=y
5+
# CT_DEMULTILIB is not set
6+
CT_ARCH_USE_MMU=y
7+
CT_ARCH_ARCH="loongarch64"
8+
CT_KERNEL_LINUX=y
9+
CT_LINUX_V_5_19=y
10+
# CT_LINUX_NO_VERSIONS is not set
11+
CT_LINUX_VERSION="5.19.16"
12+
CT_LINUX_later_than_4_8=y
13+
CT_LINUX_4_8_or_later=y
14+
CT_LINUX_later_than_3_7=y
15+
CT_LINUX_3_7_or_later=y
16+
CT_LINUX_later_than_3_2=y
17+
CT_LINUX_3_2_or_later=y
18+
CT_LIBC_MUSL=y
19+
CT_MUSL_V_1_2_5=y
20+
# CT_MUSL_NO_VERSIONS is not set
21+
CT_MUSL_VERSION="1.2.5"
22+
CT_GCC_V_14=y
23+
# CT_GCC_NO_VERSIONS is not set
24+
CT_GCC_VERSION="14.2.0"
25+
CT_GCC_later_than_7=y
26+
CT_GCC_7_or_later=y
27+
CT_GCC_later_than_6=y
28+
CT_GCC_6_or_later=y
29+
CT_GCC_later_than_5=y
30+
CT_GCC_5_or_later=y
31+
CT_GCC_later_than_4_9=y
32+
CT_GCC_4_9_or_later=y
33+
CT_GCC_later_than_4_8=y
34+
CT_GCC_4_8_or_later=y
35+
CT_CC_GCC_ENABLE_DEFAULT_PIE=y
36+
CT_CC_LANG_CXX=y
37+

src/docker/provided_images.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ pub static PROVIDED_IMAGES: &[ProvidedImage] = &[
6363
platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],
6464
sub: None
6565
},
66+
ProvidedImage {
67+
name: "loongarch64-unknown-linux-musl",
68+
platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],
69+
sub: None
70+
},
6671
ProvidedImage {
6772
name: "mips-unknown-linux-gnu",
6873
platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],

targets.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,15 @@ std = true
123123
run = true
124124
runners = "qemu-user"
125125

126+
[[target]]
127+
target = "loongarch64-unknown-linux-musl"
128+
os = "ubuntu-latest"
129+
cpp = true
130+
dylib = true
131+
std = true
132+
run = true
133+
runners = "qemu-user"
134+
126135
[[target]]
127136
target = "mips-unknown-linux-gnu"
128137
os = "ubuntu-latest"

0 commit comments

Comments
 (0)