diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 971d8c655e..58f658d470 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -92,6 +92,7 @@ jobs: - thumbv7m-none-eabi - thumbv7em-none-eabi - thumbv7em-none-eabihf + - loongarch64-unknown-linux-gnu # macOS targets - x86_64-apple-darwin @@ -171,6 +172,8 @@ jobs: os: ubuntu-latest - target: riscv64gc-unknown-linux-gnu os: ubuntu-latest + - target: loongarch64-unknown-linux-gnu + os: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile b/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile new file mode 100644 index 0000000000..267523bbfd --- /dev/null +++ b/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile @@ -0,0 +1,16 @@ +FROM ubuntu:24.04 +RUN \ + apt-get update && \ + apt-get install -y --no-install-recommends gcc libc6-dev ca-certificates wget xz-utils && \ + wget "https://github.com/loongson/build-tools/releases/download/2024.08.08/x86_64-cross-tools-loongarch64-binutils_2.43-gcc_14.2.0.tar.xz" && \ + tar -xvf x86_64-cross-tools-loongarch64-binutils_2.43-gcc_14.2.0.tar.xz -C / && \ + rm x86_64-cross-tools-loongarch64-binutils_2.43-gcc_14.2.0.tar.xz && \ + wget "https://github.com/loongson/build-tools/releases/download/2024.08.08/x86_64-cross-tools-loongarch64-binutils_2.43-gcc_14.2.0-glibc_2.40.tar.xz" && \ + tar -xvf x86_64-cross-tools-loongarch64-binutils_2.43-gcc_14.2.0-glibc_2.40.tar.xz -C / && \ + rm x86_64-cross-tools-loongarch64-binutils_2.43-gcc_14.2.0-glibc_2.40.tar.xz && \ + wget "https://github.com/loongson/build-tools/releases/download/2023.08.08/qemu-loongarch64" && \ + install -m 755 qemu-loongarch64 /cross-tools/bin/qemu-loongarch64 && \ + rm qemu-loongarch64 +ENV \ + CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_GNU_LINKER="/cross-tools/bin/loongarch64-unknown-linux-gnu-gcc" \ + CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_GNU_RUNNER="/cross-tools/bin/qemu-loongarch64 -L /cross-tools/target -E LD_LIBRARY_PATH=/cross-tools/loongarch64-unknown-linux-gnu/lib" diff --git a/crates/core_arch/src/lib.rs b/crates/core_arch/src/lib.rs index 461c9c808c..068bce1b75 100644 --- a/crates/core_arch/src/lib.rs +++ b/crates/core_arch/src/lib.rs @@ -66,7 +66,11 @@ )] #![cfg_attr( test, - feature(stdarch_arm_feature_detection, stdarch_powerpc_feature_detection) + feature( + stdarch_arm_feature_detection, + stdarch_powerpc_feature_detection, + stdarch_loongarch_feature_detection + ) )] #[cfg(test)]