diff --git a/Cargo.lock b/Cargo.lock index be667f8883d8..f716ba850e4c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2869,6 +2869,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + [[package]] name = "rand" version = "0.8.5" @@ -3087,12 +3093,12 @@ dependencies = [ [[package]] name = "region" version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6b6ebd13bc009aef9cd476c1310d49ac354d36e240cf1bd753290f3dc7199a7" +source = "git+https://github.com/RossComputerGuy/region-rs?branch=fix%2Fuefi#8f86bd4cd9951e61c20b9c2ed1048fd3f5e5955f" dependencies = [ "bitflags 1.3.2", "libc", "mach2", + "r-efi", "windows-sys 0.52.0", ] diff --git a/cranelift/jit/Cargo.toml b/cranelift/jit/Cargo.toml index 4fc6e79a2d37..8e0124fcbd59 100644 --- a/cranelift/jit/Cargo.toml +++ b/cranelift/jit/Cargo.toml @@ -21,7 +21,7 @@ cranelift-entity = { workspace = true } cranelift-control = { workspace = true } wasmtime-unwinder = { workspace = true, optional = true, features = ["cranelift"] } anyhow = { workspace = true } -region = "3.0.2" +region = { git = "https://github.com/RossComputerGuy/region-rs", branch = "fix/uefi" } libc = { workspace = true } target-lexicon = { workspace = true } memmap2 = { version = "0.2.1", optional = true } diff --git a/cranelift/jit/src/backend.rs b/cranelift/jit/src/backend.rs index cbed2c3217bf..2eb430c39c71 100644 --- a/cranelift/jit/src/backend.rs +++ b/cranelift/jit/src/backend.rs @@ -17,6 +17,7 @@ use cranelift_module::{ use log::info; use std::cell::RefCell; use std::collections::HashMap; +#[cfg(not(target_os = "uefi"))] use std::ffi::CString; use std::io::Write; use target_lexicon::PointerWidth; @@ -88,7 +89,13 @@ impl JITBuilder { libcall_names: Box String + Send + Sync>, ) -> Self { let symbols = HashMap::new(); + + #[cfg(not(target_os = "uefi"))] let lookup_symbols = vec![Box::new(lookup_with_dlsym) as Box<_>]; + + #[cfg(target_os = "uefi")] + let lookup_symbols = vec![]; + Self { isa, symbols, @@ -656,7 +663,7 @@ impl Module for JITModule { } } -#[cfg(not(windows))] +#[cfg(all(not(windows), not(target_os = "uefi")))] fn lookup_with_dlsym(name: &str) -> Option<*const u8> { let c_str = CString::new(name).unwrap(); let c_str_ptr = c_str.as_ptr(); diff --git a/cranelift/jit/src/memory/system.rs b/cranelift/jit/src/memory/system.rs index bd845aef4a17..1b5f7e68cfc0 100644 --- a/cranelift/jit/src/memory/system.rs +++ b/cranelift/jit/src/memory/system.rs @@ -1,6 +1,10 @@ use cranelift_module::{ModuleError, ModuleResult}; -#[cfg(all(not(target_os = "windows"), feature = "selinux-fix"))] +#[cfg(all( + not(target_os = "windows"), + not(target_os = "uefi"), + feature = "selinux-fix" +))] use memmap2::MmapMut; #[cfg(not(any(feature = "selinux-fix", windows)))]