Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add support for loongarch64-unknown-linux-{gnu,musl} #2159

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ jobs:
- arm-unknown-linux-gnueabi
- armv7-linux-androideabi
- armv7-unknown-linux-musleabihf
- loongarch64-unknown-linux-gnu
- loongarch64-unknown-linux-musl
- i686-pc-windows-msvc
- i686-unknown-linux-gnu
- i686-unknown-linux-musl
Expand Down Expand Up @@ -257,6 +259,12 @@ jobs:
- target: armv7-unknown-linux-musleabihf
host_os: ubuntu-22.04

- target: loongarch64-unknown-linux-gnu
host_os: ubuntu-24.04

- target: loongarch64-unknown-linux-musl
host_os: ubuntu-24.04

- target: i686-pc-windows-msvc
host_os: windows-latest

Expand Down Expand Up @@ -322,6 +330,12 @@ jobs:
- target: x86_64-unknown-linux-gnu
host_os: ubuntu-22.04

exclude:
- target: loongarch64-unknown-linux-gnu
rust_channel: 1.63.0
- target: loongarch64-unknown-linux-musl
rust_channel: 1.63.0

steps:
- if: ${{ contains(matrix.host_os, 'ubuntu') }}
run: sudo apt-get update -y
Expand Down Expand Up @@ -578,6 +592,8 @@ jobs:
- aarch64-unknown-linux-gnu # Has assembly
- arm-unknown-linux-gnueabi # Has assembly
- armv7-unknown-linux-gnueabihf # Has assembly
- loongarch64-unknown-linux-gnu # Has assembly
- loongarch64-unknown-linux-musl # Has assembly
# - i686-unknown-linux-gnu # Has assembly; handled specially below.
- powerpc-unknown-linux-gnu # No assembly 32-bit big-endian with flags
- powerpc64-unknown-linux-gnu # No assembly 64-bit big-endian with flags
Expand Down Expand Up @@ -623,6 +639,12 @@ jobs:
rust_channel: nightly
host_os: ubuntu-22.04

- target: loongarch64-unknown-linux-gnu
host_os: ubuntu-24.04

- target: loongarch64-unknown-linux-musl
host_os: ubuntu-24.04

# TODO: Use the -musl target after
# https://github.com/rust-lang/rust/issues/79556 and
# https://github.com/rust-lang/rust/issues/79555 are fixed.
Expand Down
12 changes: 11 additions & 1 deletion mk/cargo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ rustflags_self_contained="-Clink-self-contained=yes -Clinker=rust-lld"
qemu_aarch64="qemu-aarch64 -L /usr/aarch64-linux-gnu"
qemu_arm_gnueabi="qemu-arm -L /usr/arm-linux-gnueabi"
qemu_arm_gnueabihf="qemu-arm -L /usr/arm-linux-gnueabihf"
qemu_loongarch64="qemu-loongarch64 -L /usr/loongarch64-linux-gnu"
qemu_mips="qemu-mips -L /usr/mips-linux-gnu"
qemu_mips64="qemu-mips64 -L /usr/mips64-linux-gnuabi64"
qemu_mips64el="qemu-mips64el -L /usr/mips64el-linux-gnuabi64"
Expand Down Expand Up @@ -201,7 +202,16 @@ case $target in
;;
loongarch64-unknown-linux-gnu)
use_clang=1
export CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_GNU_LINKER=clang-$llvm_version
export CC_loongarch64_unknown_linux_gnu=loongarch64-linux-gnu-gcc-14
export AR_loongarch64_unknown_linux_gnu=loongarch64-linux-gnu-gcc-ar
export CFLAGS_loongarch64_unknown_linux_gnu="--sysroot=/usr/loongarch64-linux-gnu"
export CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_GNU_LINKER=loongarch64-linux-gnu-gcc-14
export CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_GNU_RUNNER="$qemu_loongarch64"
;;
loongarch64-unknown-linux-musl)
use_clang=1
export CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Ctarget-feature=+crt-static $rustflags_self_contained"
export CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_RUNNER="$qemu_loongarch64"
;;
wasm32-unknown-unknown)
# The first two are only needed for when the "wasm_c" feature is enabled.
Expand Down
9 changes: 9 additions & 0 deletions mk/install-build-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ i686-unknown-linux-musl|x86_64-unknown-linux-musl)
;;
loongarch64-unknown-linux-gnu)
use_clang=1
install_packages \
gcc-14-loongarch64-linux-gnu \
libc6-dev-loong64-cross \
qemu-user
;;
loongarch64-unknown-linux-musl)
use_clang=1
install_packages \
qemu-user
;;
mips-unknown-linux-gnu)
install_packages \
Expand Down