diff --git a/.cirrus.yml b/.cirrus.yml index 53fdf87100..a0ecc03b95 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -2,6 +2,10 @@ task: name: x86_64-unknown-freebsd freebsd_instance: image_family: freebsd-13-4 + env: + # FIXME(freebsd): FreeBSD has a segfault when `RUST_BACKTRACE` is set + # https://github.com/rust-lang/rust/issues/132185 + RUST_BACKTRACE: "0" setup_script: - curl https://sh.rustup.rs -sSf --output rustup.sh - sh rustup.sh --default-toolchain nightly -y diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 95b6f4afb9..2d0ee8dff9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -56,6 +56,8 @@ jobs: os: ubuntu-latest - tuple: aarch64-unknown-linux-gnu os: ubuntu-latest + - tuple: riscv32gc-unknown-linux-gnu + os: ubuntu-latest - tuple: riscv64gc-unknown-linux-gnu os: ubuntu-latest - tuple: powerpc-unknown-linux-gnu @@ -112,7 +114,7 @@ jobs: - tuple: i686-pc-windows-msvc os: windows-2025 - tuple: aarch64-pc-windows-msvc - os: windows-2025 + os: windows-11-arm - tuple: x86_64-pc-windows-gnu os: windows-2025 # - tuple: i686-pc-windows-gnu @@ -147,6 +149,11 @@ jobs: tuple: powerpc64le-unknown-linux-gnu os: ubuntu-latest test_everything: true + - target: + tuple: riscv32gc-unknown-linux-gnu + os: ubuntu-latest + test_everything: true + build_std: true - target: tuple: riscv64gc-unknown-linux-gnu os: ubuntu-latest @@ -185,21 +192,31 @@ jobs: tuple: aarch64-apple-ios-macabi os: macos-15 norun: true # https://github.com/rust-lang/stdarch/issues/1206 - - target: - tuple: aarch64-pc-windows-msvc - os: windows-2025 - norun: true steps: - uses: actions/checkout@v4 - with: - submodules: recursive + - name: Install Rust run: | rustup update nightly --no-self-update rustup default nightly + shell: bash + if: matrix.target.os != 'windows-11-arm' + - name: Install Rust for `windows-11-arm` runners + run: | + curl https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + shell: bash + if: matrix.target.os == 'windows-11-arm' + - run: rustup target add ${{ matrix.target.tuple }} - - run: cargo generate-lockfile + shell: bash + if: matrix.build_std == '' + - run: | + rustup component add rust-src + echo "CARGO_UNSTABLE_BUILD_STD=std" >> $GITHUB_ENV + shell: bash + if: matrix.build_std != '' # Configure some env vars based on matrix configuration - run: echo "PROFILE=--profile=${{matrix.profile}}" >> $GITHUB_ENV @@ -227,7 +244,7 @@ jobs: # ... while Linux goes to `run-docker.sh` - run: ./ci/run-docker.sh ${{ matrix.target.tuple }} shell: bash - if: "matrix.target.os == 'ubuntu-latest' && !startsWith(matrix.target.tuple, 'thumb')" + if: matrix.target.os == 'ubuntu-latest' && !startsWith(matrix.target.tuple, 'thumb') env: TARGET: ${{ matrix.target.tuple }} diff --git a/ci/docker/riscv32gc-unknown-linux-gnu/Dockerfile b/ci/docker/riscv32gc-unknown-linux-gnu/Dockerfile new file mode 100644 index 0000000000..81f7b6239a --- /dev/null +++ b/ci/docker/riscv32gc-unknown-linux-gnu/Dockerfile @@ -0,0 +1,15 @@ +FROM ubuntu:25.04 + +RUN apt-get update && apt-get install -y --no-install-recommends \ + gcc libc6-dev qemu-user ca-certificates \ + wget xz-utils make file llvm + +ENV VERSION=2025.01.20 + +RUN wget "https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/${VERSION}/riscv32-glibc-ubuntu-24.04-gcc-nightly-${VERSION}-nightly.tar.xz" \ + -O riscv-toolchain.tar.xz +RUN tar -xJf riscv-toolchain.tar.xz + +ENV CARGO_TARGET_RISCV32GC_UNKNOWN_LINUX_GNU_LINKER=/riscv/bin/riscv32-unknown-linux-gnu-gcc \ + CARGO_TARGET_RISCV32GC_UNKNOWN_LINUX_GNU_RUNNER="qemu-riscv32 -cpu max -L /riscv/sysroot" \ + OBJDUMP=llvm-objdump diff --git a/ci/run-docker.sh b/ci/run-docker.sh index af83a32eca..d7aa50a8c9 100755 --- a/ci/run-docker.sh +++ b/ci/run-docker.sh @@ -36,6 +36,7 @@ run() { --env NOSTD \ --env NORUN \ --env RUSTFLAGS \ + --env CARGO_UNSTABLE_BUILD_STD \ --volume "${HOME}/.cargo":/cargo \ --volume "$(rustc --print sysroot)":/rust:ro \ --volume "$(pwd)":/checkout:ro \ diff --git a/ci/run.sh b/ci/run.sh index f582602a8c..a9f473d25a 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -44,7 +44,7 @@ case ${TARGET} in ;; # Some of our test dependencies use the deprecated `gcc` crates which # doesn't detect RISC-V compilers automatically, so do it manually here. - riscv64*) + riscv*) export RUSTFLAGS="${RUSTFLAGS} -Ctarget-feature=+zk,+zks,+zbb,+zbc" export TARGET_CC="riscv64-linux-gnu-gcc" ;; diff --git a/crates/stdarch-test/src/disassembly.rs b/crates/stdarch-test/src/disassembly.rs index 49043eea80..f5167ea8d8 100644 --- a/crates/stdarch-test/src/disassembly.rs +++ b/crates/stdarch-test/src/disassembly.rs @@ -77,7 +77,7 @@ pub(crate) fn disassemble_myself() -> HashSet { let add_args = if cfg!(target_vendor = "apple") && cfg!(target_arch = "aarch64") { // Target features need to be enabled for LLVM objdump on Darwin ARM64 vec!["--mattr=+v8.6a,+crypto,+tme"] - } else if cfg!(target_arch = "riscv64") { + } else if cfg!(any(target_arch = "riscv32", target_arch = "riscv64")) { vec!["--mattr=+zk,+zks,+zbc,+zbb"] } else { vec![]