From fa108d9a86827a28c7bfb8ff98033734b2a5fd33 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 30 Sep 2021 06:11:29 -0700 Subject: [PATCH] Remove the rsix dependency in cranelift-native. (#3395) Revert the part of 47490b4383bf48cbde8b1c33301a7f7d326ee7cc which changed cranelift-native to use rsix. It's just one call, and this lets Cranelift users that don't otherwise depend on rsix to avoid it. --- Cargo.lock | 2 +- cranelift/native/Cargo.toml | 2 +- cranelift/native/src/lib.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a2e80da3ea..6823f1b335 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -696,7 +696,7 @@ name = "cranelift-native" version = "0.77.0" dependencies = [ "cranelift-codegen", - "rsix", + "libc", "target-lexicon", ] diff --git a/cranelift/native/Cargo.toml b/cranelift/native/Cargo.toml index 96fe91f665..493778a463 100644 --- a/cranelift/native/Cargo.toml +++ b/cranelift/native/Cargo.toml @@ -15,7 +15,7 @@ cranelift-codegen = { path = "../codegen", version = "0.77.0", default-features target-lexicon = "0.12" [target.'cfg(target_arch = "s390x")'.dependencies] -rsix = "0.23.0" +libc = "0.2.95" [features] default = ["std"] diff --git a/cranelift/native/src/lib.rs b/cranelift/native/src/lib.rs index b2364c6ad9..cac50dee4e 100644 --- a/cranelift/native/src/lib.rs +++ b/cranelift/native/src/lib.rs @@ -126,7 +126,7 @@ pub fn builder_with_options( } // There is no is_s390x_feature_detected macro yet, so for now - // we use linux_hwcap from the rsix crate directly. + // we use getauxval from the libc crate directly. #[cfg(all(target_arch = "s390x", target_os = "linux"))] { use cranelift_codegen::settings::Configurable; @@ -135,8 +135,8 @@ pub fn builder_with_options( return Ok(isa_builder); } - let v = rsix::process::linux_hwcap().0; - const HWCAP_S390X_VXRS_EXT2: usize = 32768; + let v = unsafe { libc::getauxval(libc::AT_HWCAP) }; + const HWCAP_S390X_VXRS_EXT2: libc::c_ulong = 32768; if (v & HWCAP_S390X_VXRS_EXT2) != 0 { isa_builder.enable("has_vxrs_ext2").unwrap(); // There is no separate HWCAP bit for mie2, so assume