From fc83e01949198e10477020eaba560e91dc66054e Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Wed, 23 Nov 2022 19:00:57 +0900 Subject: [PATCH] chore: add tokio_no_atomic_u64 cfg (#5226) --- .github/workflows/ci.yml | 21 +++++++++++++ target-specs/i686-unknown-linux-gnu.json | 40 ++++++++++++++++++++++++ tokio/src/macros/cfg.rs | 26 ++++++++------- 3 files changed, 75 insertions(+), 12 deletions(-) create mode 100644 target-specs/i686-unknown-linux-gnu.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68817b2bd20..a109e9f0023 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,6 +44,7 @@ jobs: - asan - cross-check - cross-test + - no-atomic-u64 - features - minrust - minimal-versions @@ -288,6 +289,26 @@ jobs: env: RUSTFLAGS: --cfg tokio_unstable -Dwarnings --cfg tokio_no_ipv6 + # See https://github.com/tokio-rs/tokio/issues/5187 + no-atomic-u64: + name: Test i686-unknown-linux-gnu without AtomicU64 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install Rust ${{ env.rust_nightly }} + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ env.rust_nightly }} + components: rust-src + override: true + # Install linker and libraries for i686-unknown-linux-gnu + - uses: taiki-e/setup-cross-toolchain-action@v1 + with: + target: i686-unknown-linux-gnu + - run: cargo test -Zbuild-std --target target-specs/i686-unknown-linux-gnu.json -p tokio --all-features + env: + RUSTFLAGS: --cfg tokio_unstable -Dwarnings --cfg tokio_no_atomic_u64 + features: name: features runs-on: ubuntu-latest diff --git a/target-specs/i686-unknown-linux-gnu.json b/target-specs/i686-unknown-linux-gnu.json new file mode 100644 index 00000000000..4eebe7afb57 --- /dev/null +++ b/target-specs/i686-unknown-linux-gnu.json @@ -0,0 +1,40 @@ +{ + "arch": "x86", + "cpu": "pentium4", + "crt-static-respected": true, + "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128", + "dynamic-linking": true, + "env": "gnu", + "has-rpath": true, + "has-thread-local": true, + "llvm-target": "i686-unknown-linux-gnu", + "max-atomic-width": 32, + "os": "linux", + "position-independent-executables": true, + "pre-link-args": { + "gcc": [ + "-m32" + ] + }, + "relro-level": "full", + "stack-probes": { + "kind": "inline-or-call", + "min-llvm-version-for-inline": [ + 16, + 0, + 0 + ] + }, + "supported-sanitizers": [ + "address" + ], + "supported-split-debuginfo": [ + "packed", + "unpacked", + "off" + ], + "target-family": [ + "unix" + ], + "target-pointer-width": "32" +} diff --git a/tokio/src/macros/cfg.rs b/tokio/src/macros/cfg.rs index 4a77179974a..2eea344b516 100644 --- a/tokio/src/macros/cfg.rs +++ b/tokio/src/macros/cfg.rs @@ -462,12 +462,13 @@ macro_rules! cfg_has_atomic_u64 { ($($item:item)*) => { $( #[cfg(not(any( - target_arch = "arm", - target_arch = "mips", - target_arch = "powerpc", - target_arch = "riscv32", - tokio_wasm - )))] + target_arch = "arm", + target_arch = "mips", + target_arch = "powerpc", + target_arch = "riscv32", + tokio_wasm, + tokio_no_atomic_u64, + )))] $item )* } @@ -477,12 +478,13 @@ macro_rules! cfg_not_has_atomic_u64 { ($($item:item)*) => { $( #[cfg(any( - target_arch = "arm", - target_arch = "mips", - target_arch = "powerpc", - target_arch = "riscv32", - tokio_wasm - ))] + target_arch = "arm", + target_arch = "mips", + target_arch = "powerpc", + target_arch = "riscv32", + tokio_wasm, + tokio_no_atomic_u64, + ))] $item )* }