From aee78b17729bcb2d9b0465cdb8c196aa496f61b9 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Thu, 12 Sep 2024 15:22:33 -0700 Subject: [PATCH] Cranelift: Add a cargo feature to enable support for all native ISAs (#9237) That is, all architectures other than Pulley. Fixes #9229 --- cranelift/Cargo.toml | 1 + cranelift/codegen/Cargo.toml | 8 +++++++- cranelift/codegen/build.rs | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cranelift/Cargo.toml b/cranelift/Cargo.toml index 74cff6db2e09..cb1dda5c0bc4 100644 --- a/cranelift/Cargo.toml +++ b/cranelift/Cargo.toml @@ -54,3 +54,4 @@ default = ["disas", "cranelift-codegen/all-arch", "cranelift-codegen/trace-log", disas = ["capstone"] souper-harvest = ["cranelift-codegen/souper-harvest", "rayon"] all-arch = ["cranelift-codegen/all-arch"] +all-native-arch = ["cranelift-codegen/all-native-arch"] diff --git a/cranelift/codegen/Cargo.toml b/cranelift/codegen/Cargo.toml index 0d7b284f694f..e7ccb588243c 100644 --- a/cranelift/codegen/Cargo.toml +++ b/cranelift/codegen/Cargo.toml @@ -88,11 +88,17 @@ host-arch = [] # Option to enable all architectures. all-arch = [ + "all-native-arch", + "pulley", +] + +# Option to enable all architectures that correspond to an actual native target +# (that is, exclude Pulley). +all-native-arch = [ "x86", "arm64", "s390x", "riscv64", - "pulley", ] # For dependent crates that want to serialize some parts of cranelift diff --git a/cranelift/codegen/build.rs b/cranelift/codegen/build.rs index 4bfc8ca237e0..50f067e1cfd7 100644 --- a/cranelift/codegen/build.rs +++ b/cranelift/codegen/build.rs @@ -31,6 +31,7 @@ fn main() { let target_triple = env::var("TARGET").expect("The TARGET environment variable must be set"); let all_arch = env::var("CARGO_FEATURE_ALL_ARCH").is_ok(); + let all_native_arch = env::var("CARGO_FEATURE_ALL_NATIVE_ARCH").is_ok(); let mut isas = meta::isa::Isa::all() .iter() @@ -47,7 +48,7 @@ fn main() { .collect::>(); // Don't require host isa if under 'all-arch' feature. - let host_isa = env::var("CARGO_FEATURE_HOST_ARCH").is_ok() && !all_arch; + let host_isa = env::var("CARGO_FEATURE_HOST_ARCH").is_ok() && !all_native_arch; if isas.is_empty() || host_isa { // Try to match native target.