From 8bcad03a5dd3f96fb3510fd0f1b4b987bc634b49 Mon Sep 17 00:00:00 2001 From: Sayantan Chakraborty <142906350+sayantn@users.noreply.github.com> Date: Sat, 14 Dec 2024 17:37:45 +0530 Subject: [PATCH 1/8] Enable `x86_64-pc-windows-msvc-dev` --- .github/workflows/main.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5e5e2e6c05..26c2bd5802 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -171,11 +171,6 @@ jobs: tuple: aarch64-pc-windows-msvc os: windows-latest norun: true - - target: - tuple: x86_64-pc-windows-msvc - os: windows-latest - profile: dev - norun: true # FIXME: why doesn't this work in debug mode? steps: - uses: actions/checkout@v4 From c0f62b47d14be28dd3865ef8fa29648d9d2e8070 Mon Sep 17 00:00:00 2001 From: sayantn Date: Thu, 19 Dec 2024 00:42:53 +0530 Subject: [PATCH 2/8] Re-enable the disabled PPC tests, Upgrade CPU --- ci/docker/powerpc64-unknown-linux-gnu/Dockerfile | 4 ++-- ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile | 4 ++-- ci/run.sh | 4 ---- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile b/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile index a9de944b0c..4764706558 100644 --- a/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile +++ b/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile @@ -3,9 +3,9 @@ FROM ubuntu:24.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ gcc-powerpc64-linux-gnu libc6-dev-ppc64-cross \ - qemu-system-ppc file make + file make ENV CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_LINKER=powerpc64-linux-gnu-gcc \ - CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc64 -cpu power9 -L /usr/powerpc64-linux-gnu" \ + CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc64 -cpu power10 -L /usr/powerpc64-linux-gnu" \ CC=powerpc64-linux-gnu-gcc \ OBJDUMP=powerpc64-linux-gnu-objdump diff --git a/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile b/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile index 66e7fd3b77..7c14663766 100644 --- a/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile +++ b/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile @@ -3,10 +3,10 @@ FROM ubuntu:24.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross \ - qemu-system-ppc file make + file make # Work around qemu triggering a sigill on vec_subs if the cpu target is not defined. ENV CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_LINKER=powerpc64le-linux-gnu-gcc \ - CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc64le -cpu power9 -L /usr/powerpc64le-linux-gnu" \ + CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc64le -cpu power10 -L /usr/powerpc64le-linux-gnu" \ CC=powerpc64le-linux-gnu-gcc \ OBJDUMP=powerpc64le-linux-gnu-objdump diff --git a/ci/run.sh b/ci/run.sh index 8cdc1d411a..28d53c5375 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -82,10 +82,6 @@ cargo_test() { wasm32*) cmd="$cmd --nocapture" ;; - # qemu has an erratic behavior on those tests - powerpc64*) - cmd="$cmd --skip test_vec_lde_u16 --skip test_vec_lde_u32 --skip test_vec_expte" - ;; esac if [ "$SKIP_TESTS" != "" ]; then From b8d5c28a0f17c7374ab15a5a6b0c2f7d4498d6ed Mon Sep 17 00:00:00 2001 From: sayantn Date: Thu, 19 Dec 2024 00:43:20 +0530 Subject: [PATCH 3/8] Remove `gba.json` as it was unused --- ci/gba.json | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 ci/gba.json diff --git a/ci/gba.json b/ci/gba.json deleted file mode 100644 index 5aece43af2..0000000000 --- a/ci/gba.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "abi-blacklist": [ - "stdcall", - "fastcall", - "vectorcall", - "thiscall", - "win64", - "sysv64" - ], - "arch": "arm", - "atomic-cas": false, - "cpu": "arm7tdmi", - "data-layout": "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", - "emit-debug-gdb-scripts": false, - "env": "agb", - "executables": true, - "features": "+soft-float,+strict-align", - "linker": "arm-none-eabi-ld", - "linker-flavor": "ld", - "linker-is-gnu": true, - "llvm-target": "thumbv4-none-agb", - "os": "none", - "panic-strategy": "abort", - "pre-link-args": { - "ld": [ - "-Tlinker.ld" - ] - }, - "relocation-model": "static", - "target-c-int-width": "32", - "target-endian": "little", - "target-pointer-width": "32", - "vendor": "nintendo" -} \ No newline at end of file From b4a1c14f2ff1151e4edb0f64695cea53ac52c974 Mon Sep 17 00:00:00 2001 From: sayantn Date: Thu, 19 Dec 2024 01:43:07 +0530 Subject: [PATCH 4/8] Add PowerPC (32-bit) to CI --- .github/workflows/main.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 26c2bd5802..8a6523e92c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -74,6 +74,8 @@ jobs: os: ubuntu-latest - tuple: riscv64gc-unknown-linux-gnu os: ubuntu-latest + - tuple: powerpc-unknown-linux-gnu + os: ubuntu-latest - tuple: powerpc64le-unknown-linux-gnu os: ubuntu-latest # MIPS targets disabled since they are dropped to tier 3. @@ -155,6 +157,10 @@ jobs: # tuple: mipsel-unknown-linux-musl # os: ubuntu-latest # norun: true + - target: + tuple: powerpc-unknown-linux-gnu + os: ubuntu-latest + disable_assert_instr: true - target: tuple: powerpc64le-unknown-linux-gnu os: ubuntu-latest From a9a18e8dc4206d89457f2279959185b599298436 Mon Sep 17 00:00:00 2001 From: sayantn Date: Thu, 19 Dec 2024 16:19:36 +0530 Subject: [PATCH 5/8] Upgrade Intel SDE --- ci/docker/x86_64-unknown-linux-gnu-emulated/Dockerfile | 6 +++--- ci/docker/x86_64-unknown-linux-gnu-emulated/cpuid.def | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ci/docker/x86_64-unknown-linux-gnu-emulated/Dockerfile b/ci/docker/x86_64-unknown-linux-gnu-emulated/Dockerfile index c4063924da..70ec5feecd 100644 --- a/ci/docker/x86_64-unknown-linux-gnu-emulated/Dockerfile +++ b/ci/docker/x86_64-unknown-linux-gnu-emulated/Dockerfile @@ -8,8 +8,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ wget \ xz-utils -RUN wget https://downloadmirror.intel.com/831748/sde-external-9.44.0-2024-08-22-lin.tar.xz -RUN tar -xJf sde-external-9.44.0-2024-08-22-lin.tar.xz -ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="/sde-external-9.44.0-2024-08-22-lin/sde64 \ +RUN wget https://downloadmirror.intel.com/843185/sde-external-9.48.0-2024-11-25-lin.tar.xz +RUN tar -xJf sde-external-9.48.0-2024-11-25-lin.tar.xz +ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="/sde-external-9.48.0-2024-11-25-lin/sde64 \ -cpuid-in /checkout/ci/docker/x86_64-unknown-linux-gnu-emulated/cpuid.def \ -rtm-mode full -tsx --" diff --git a/ci/docker/x86_64-unknown-linux-gnu-emulated/cpuid.def b/ci/docker/x86_64-unknown-linux-gnu-emulated/cpuid.def index 9d9c79ae52..4d0924c5a1 100644 --- a/ci/docker/x86_64-unknown-linux-gnu-emulated/cpuid.def +++ b/ci/docker/x86_64-unknown-linux-gnu-emulated/cpuid.def @@ -1,11 +1,11 @@ -# Copyright (C) 2017-2023 Intel Corporation. -# +# Copyright (C) 2017-2024 Intel Corporation. +# # This software and the related documents are Intel copyrighted materials, and your # use of them is governed by the express license under which they were provided to # you ("License"). Unless the License provides otherwise, you may not use, modify, # copy, publish, distribute, disclose or transmit this software or the related # documents without Intel's prior written permission. -# +# # This software and the related documents are provided as is, with no express or # implied warranties, other than those that are expressly stated in the License. # From 6cc55adbce175e188951d1e8f1eacd05a4404e7d Mon Sep 17 00:00:00 2001 From: sayantn Date: Thu, 19 Dec 2024 18:59:14 +0530 Subject: [PATCH 6/8] Refactor `dox.sh`, add `loongarch64` and `nvptx64` --- ci/dox.sh | 59 ++++++++++++++++++++++--------------------------------- 1 file changed, 23 insertions(+), 36 deletions(-) diff --git a/ci/dox.sh b/ci/dox.sh index cc207cb353..1ab0169097 100755 --- a/ci/dox.sh +++ b/ci/dox.sh @@ -6,47 +6,34 @@ set -ex -rm -rf target/doc -mkdir -p target/doc - dox() { - local arch=$1 - local target=$2 - - echo "documenting ${arch}" - if [ "$CI" != "" ]; then - rustup target add "${target}" || true + rustup target add "${1}" || true fi - rm -rf "target/doc/${arch}" - mkdir "target/doc/${arch}" + cargo clean --target "${1}" - cargo build --verbose --target "${target}" --manifest-path crates/core_arch/Cargo.toml - cargo build --verbose --target "${target}" --manifest-path crates/std_detect/Cargo.toml + cargo build --verbose --target "${1}" --manifest-path crates/core_arch/Cargo.toml + cargo build --verbose --target "${1}" --manifest-path crates/std_detect/Cargo.toml - rustdoc --verbose --target "${target}" \ - -o "target/doc/${arch}" crates/core_arch/src/lib.rs \ - --edition=2018 \ - --crate-name core_arch \ - --library-path "target/${target}/debug/deps" - rustdoc --verbose --target "${target}" \ - -o "target/doc/${arch}" crates/std_detect/src/lib.rs \ - --edition=2018 \ - --crate-name std_detect \ - --library-path "target/${target}/debug/deps" \ - --extern cfg_if="$(ls target/"${target}"/debug/deps/libcfg_if-*.rlib)" \ - --extern libc="$(ls target/"${target}"/debug/deps/liblibc-*.rlib)" + cargo doc --verbose --target "${1}" --manifest-path crates/core_arch/Cargo.toml + cargo doc --verbose --target "${1}" --manifest-path crates/std_detect/Cargo.toml } -dox i686 i686-unknown-linux-gnu -dox x86_64 x86_64-unknown-linux-gnu -dox arm armv7-unknown-linux-gnueabihf -dox aarch64 aarch64-unknown-linux-gnu -dox powerpc powerpc-unknown-linux-gnu -dox powerpc64le powerpc64le-unknown-linux-gnu -# MIPS targets disabled since they are dropped to tier 3. -# See https://github.com/rust-lang/compiler-team/issues/648 -#dox mips mips-unknown-linux-gnu -#dox mips64 mips64-unknown-linux-gnuabi64 -dox wasm32 wasm32-unknown-unknown +if [ -z "$1" ]; then + dox i686-unknown-linux-gnu + dox x86_64-unknown-linux-gnu + dox armv7-unknown-linux-gnueabihf + dox aarch64-unknown-linux-gnu + dox powerpc-unknown-linux-gnu + dox powerpc64le-unknown-linux-gnu + dox loongarch64-unknown-linux-gnu + # MIPS targets disabled since they are dropped to tier 3. + # See https://github.com/rust-lang/compiler-team/issues/648 + #dox mips-unknown-linux-gnu + #dox mips64-unknown-linux-gnuabi64 + dox wasm32-unknown-unknown + dox nvptx64-nvidia-cuda +else + dox "${1}" +fi \ No newline at end of file From 3c6b0b709377e5b4a47b7a299bfcc1f636a136d1 Mon Sep 17 00:00:00 2001 From: sayantn Date: Sat, 21 Dec 2024 13:54:12 +0530 Subject: [PATCH 7/8] Make `assert_instr` stricter --- crates/stdarch-test/src/disassembly.rs | 6 +++--- crates/stdarch-test/src/lib.rs | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/stdarch-test/src/disassembly.rs b/crates/stdarch-test/src/disassembly.rs index a7b46a73fc..6a3ca06cb6 100644 --- a/crates/stdarch-test/src/disassembly.rs +++ b/crates/stdarch-test/src/disassembly.rs @@ -140,7 +140,7 @@ fn parse(output: &str) -> HashSet { .filter(|&x| !x.is_empty()) .skip(1) .map(str::to_lowercase) - .skip_while(|s| *s == "lock") // skip x86-specific prefix + .skip_while(|s| matches!(&**s, "lock" | "vex")) // skip x86-specific prefix .collect::>() } else { // objdump with --no-show-raw-insn @@ -150,8 +150,8 @@ fn parse(output: &str) -> HashSet { instruction .split_whitespace() .skip(1) - .skip_while(|s| *s == "lock" || *s == "{evex}") // skip x86-specific prefix - .map(std::string::ToString::to_string) + .skip_while(|s| matches!(*s, "lock" | "{evex}" | "{vex}")) // skip x86-specific prefix + .map(ToString::to_string) .collect::>() }; diff --git a/crates/stdarch-test/src/lib.rs b/crates/stdarch-test/src/lib.rs index 3248de8f3a..41af91e8a5 100644 --- a/crates/stdarch-test/src/lib.rs +++ b/crates/stdarch-test/src/lib.rs @@ -84,7 +84,12 @@ pub fn assert(shim_addr: usize, fnname: &str, expected: &str) { // 2. It is a mark, indicating that the instruction will be // compiled into other instructions - mainly because of llvm // optimization. - let found = expected == "nop" || instrs.iter().any(|s| s.contains(expected)); + let expected = if expected == "unknown" { + "" // Workaround for rust-lang/stdarch#1674, todo: remove when the issue is fixed + } else { + expected + }; + let found = expected == "nop" || instrs.iter().any(|s| s.starts_with(expected)); // Look for subroutine call instructions in the disassembly to detect whether // inlining failed: all intrinsics are `#[inline(always)]`, so calling one From adb96e074c4040e827ae01fea55dad3ead957ef0 Mon Sep 17 00:00:00 2001 From: sayantn Date: Sat, 21 Dec 2024 13:54:49 +0530 Subject: [PATCH 8/8] Disable `armv7-unknown-linux-gnueabihf` `dox.sh` CI temporarily --- ci/dox.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ci/dox.sh b/ci/dox.sh index 1ab0169097..0e4f24e864 100755 --- a/ci/dox.sh +++ b/ci/dox.sh @@ -23,7 +23,9 @@ dox() { if [ -z "$1" ]; then dox i686-unknown-linux-gnu dox x86_64-unknown-linux-gnu - dox armv7-unknown-linux-gnueabihf + # Disabled temporarily, + # See https://github.com/rust-lang/rust/issues/134511 + #dox armv7-unknown-linux-gnueabihf dox aarch64-unknown-linux-gnu dox powerpc-unknown-linux-gnu dox powerpc64le-unknown-linux-gnu