diff --git a/cranelift/filetests/Cargo.toml b/cranelift/filetests/Cargo.toml index c143c763473..7b8ce9b1d5c 100644 --- a/cranelift/filetests/Cargo.toml +++ b/cranelift/filetests/Cargo.toml @@ -16,7 +16,7 @@ cranelift-interpreter = { workspace = true } cranelift-native = { workspace = true } cranelift-reader = { workspace = true } cranelift-preopt = { workspace = true } -cranelift-jit = { workspace = true } +cranelift-jit = { workspace = true, features = ["selinux-fix"] } cranelift-module = { workspace = true } file-per-thread-logger = "0.1.2" filecheck = "0.5.0" diff --git a/cranelift/jit/src/memory.rs b/cranelift/jit/src/memory.rs index 08518b3c8e6..6fa369b7329 100644 --- a/cranelift/jit/src/memory.rs +++ b/cranelift/jit/src/memory.rs @@ -1,6 +1,6 @@ use cranelift_module::{ModuleError, ModuleResult}; -#[cfg(feature = "selinux-fix")] +#[cfg(all(not(target_os = "windows"), feature = "selinux-fix"))] use memmap2::MmapMut; #[cfg(not(any(feature = "selinux-fix", windows)))] @@ -14,7 +14,7 @@ use wasmtime_jit_icache_coherence as icache_coherence; /// A simple struct consisting of a pointer and length. struct PtrLen { - #[cfg(feature = "selinux-fix")] + #[cfg(all(not(target_os = "windows"), feature = "selinux-fix"))] map: Option, ptr: *mut u8, @@ -25,7 +25,7 @@ impl PtrLen { /// Create a new empty `PtrLen`. fn new() -> Self { Self { - #[cfg(feature = "selinux-fix")] + #[cfg(all(not(target_os = "windows"), feature = "selinux-fix"))] map: None, ptr: ptr::null_mut(), @@ -250,10 +250,10 @@ impl Memory { fn non_protected_allocations_iter(&self) -> impl Iterator { let iter = self.allocations[self.already_protected..].iter(); - #[cfg(feature = "selinux-fix")] - return iter.filter(|&PtrLen { ref map, len, .. }| len != 0 && map.is_some()); + #[cfg(all(not(target_os = "windows"), feature = "selinux-fix"))] + return iter.filter(|&PtrLen { ref map, len, .. }| *len != 0 && map.is_some()); - #[cfg(not(feature = "selinux-fix"))] + #[cfg(any(target_os = "windows", not(feature = "selinux-fix")))] return iter.filter(|&PtrLen { len, .. }| *len != 0); }