Skip to content

Commit e2d65a8

Browse files
Fix UEFI compilation for cranelift-jit
1 parent f641800 commit e2d65a8

4 files changed

Lines changed: 22 additions & 5 deletions

File tree

Cargo.lock

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cranelift/jit/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ cranelift-entity = { workspace = true }
2121
cranelift-control = { workspace = true }
2222
wasmtime-unwinder = { workspace = true, optional = true, features = ["cranelift"] }
2323
anyhow = { workspace = true }
24-
region = "3.0.2"
24+
region = { git = "https://github.com/RossComputerGuy/region-rs", branch = "fix/uefi" }
2525
libc = { workspace = true }
2626
target-lexicon = { workspace = true }
2727
memmap2 = { version = "0.2.1", optional = true }

cranelift/jit/src/backend.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use cranelift_module::{
1717
use log::info;
1818
use std::cell::RefCell;
1919
use std::collections::HashMap;
20+
#[cfg(not(target_os = "uefi"))]
2021
use std::ffi::CString;
2122
use std::io::Write;
2223
use target_lexicon::PointerWidth;
@@ -88,7 +89,13 @@ impl JITBuilder {
8889
libcall_names: Box<dyn Fn(ir::LibCall) -> String + Send + Sync>,
8990
) -> Self {
9091
let symbols = HashMap::new();
92+
93+
#[cfg(not(target_os = "uefi"))]
9194
let lookup_symbols = vec![Box::new(lookup_with_dlsym) as Box<_>];
95+
96+
#[cfg(target_os = "uefi")]
97+
let lookup_symbols = vec![];
98+
9299
Self {
93100
isa,
94101
symbols,
@@ -656,7 +663,7 @@ impl Module for JITModule {
656663
}
657664
}
658665

659-
#[cfg(not(windows))]
666+
#[cfg(all(not(windows), not(target_os = "uefi")))]
660667
fn lookup_with_dlsym(name: &str) -> Option<*const u8> {
661668
let c_str = CString::new(name).unwrap();
662669
let c_str_ptr = c_str.as_ptr();

cranelift/jit/src/memory/system.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
use cranelift_module::{ModuleError, ModuleResult};
22

3-
#[cfg(all(not(target_os = "windows"), feature = "selinux-fix"))]
3+
#[cfg(all(
4+
not(target_os = "windows"),
5+
not(target_os = "uefi"),
6+
feature = "selinux-fix"
7+
))]
48
use memmap2::MmapMut;
59

610
#[cfg(not(any(feature = "selinux-fix", windows)))]

0 commit comments

Comments
 (0)