diff --git a/cranelift/native/src/lib.rs b/cranelift/native/src/lib.rs index 8250b1e524..8d2a3ca1cc 100644 --- a/cranelift/native/src/lib.rs +++ b/cranelift/native/src/lib.rs @@ -46,7 +46,12 @@ pub fn builder_with_options(infer_native_flags: bool) -> Result "unsupported architecture", })?; - #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + #[cfg(target_arch = "x86")] + { + compile_error!("Unsupported architecture"); + } + + #[cfg(target_arch = "x86_64")] { use cranelift_codegen::settings::Configurable; diff --git a/crates/jit/src/unwind.rs b/crates/jit/src/unwind.rs index feb37c50f3..72284872ce 100644 --- a/crates/jit/src/unwind.rs +++ b/crates/jit/src/unwind.rs @@ -2,9 +2,6 @@ cfg_if::cfg_if! { if #[cfg(all(windows, any(target_arch = "x86_64", target_arch = "aarch64")))] { mod winx64; pub use self::winx64::*; - } else if #[cfg(all(windows, target_arch = "x86"))] { - mod winx32; - pub use self::winx32::*; } else if #[cfg(unix)] { mod systemv; pub use self::systemv::*; diff --git a/crates/jit/src/unwind/winx32.rs b/crates/jit/src/unwind/winx32.rs deleted file mode 100644 index 25b887ce72..0000000000 --- a/crates/jit/src/unwind/winx32.rs +++ /dev/null @@ -1,20 +0,0 @@ -//! Stub unwind registry for Windows x32. - -use anyhow::{bail, Result}; -use cranelift_codegen::isa::{unwind::UnwindInfo, TargetIsa}; - -pub struct UnwindRegistry {} - -impl UnwindRegistry { - pub fn new(_base_address: usize) -> Self { - Self {} - } - - pub fn register(&mut self, _func_start: u32, _func_len: u32, _info: &UnwindInfo) -> Result<()> { - bail!("winx32 has no unwind registry") - } - - pub fn publish(&mut self, _isa: &dyn TargetIsa) -> Result<()> { - Ok(()) - } -} diff --git a/crates/runtime/src/traphandlers/macos.rs b/crates/runtime/src/traphandlers/macos.rs index 54f9d0269e..b8047e03a2 100644 --- a/crates/runtime/src/traphandlers/macos.rs +++ b/crates/runtime/src/traphandlers/macos.rs @@ -120,7 +120,7 @@ mod mach_addons { pub static ARM_THREAD_STATE64: thread_state_flavor_t = 6; - #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] + #[cfg(target_arch = "x86_64")] pub static THREAD_STATE_NONE: thread_state_flavor_t = 13; #[cfg(target_arch = "aarch64")] pub static THREAD_STATE_NONE: thread_state_flavor_t = 5; diff --git a/crates/runtime/src/traphandlers/unix.rs b/crates/runtime/src/traphandlers/unix.rs index 64dfe58f16..de7b335ce1 100644 --- a/crates/runtime/src/traphandlers/unix.rs +++ b/crates/runtime/src/traphandlers/unix.rs @@ -47,16 +47,18 @@ pub unsafe fn platform_init() { register(&mut PREV_SIGILL, libc::SIGILL); // x86 and s390x use SIGFPE to report division by zero - if cfg!(target_arch = "x86") || cfg!(target_arch = "x86_64") || cfg!(target_arch = "s390x") { + if cfg!(target_arch = "x86_64") || cfg!(target_arch = "s390x") { register(&mut PREV_SIGFPE, libc::SIGFPE); } // Sometimes we need to handle SIGBUS too: - // - On ARM, handle Unaligned Accesses. // - On Darwin, guard page accesses are raised as SIGBUS. - if cfg!(target_arch = "arm") || cfg!(target_os = "macos") || cfg!(target_os = "freebsd") { + if cfg!(target_os = "macos") || cfg!(target_os = "freebsd") { register(&mut PREV_SIGBUS, libc::SIGBUS); } + + // TODO(#1980): x86-32, if we support it, will also need a SIGFPE handler. + // TODO(#1173): ARM32, if we support it, will also need a SIGBUS handler. } unsafe extern "C" fn trap_handler( @@ -172,12 +174,6 @@ unsafe fn get_pc_and_fp(cx: *mut libc::c_void, _signum: libc::c_int) -> (*const cx.uc_mcontext.gregs[libc::REG_RIP as usize] as *const u8, cx.uc_mcontext.gregs[libc::REG_RBP as usize] as usize ) - } else if #[cfg(all(target_os = "linux", target_arch = "x86"))] { - let cx = &*(cx as *const libc::ucontext_t); - ( - cx.uc_mcontext.gregs[libc::REG_EIP as usize] as *const u8, - cx.uc_mcontext.gregs[libc::REG_EBP as usize] as usize, - ) } else if #[cfg(all(any(target_os = "linux", target_os = "android"), target_arch = "aarch64"))] { let cx = &*(cx as *const libc::ucontext_t); ( @@ -210,12 +206,6 @@ unsafe fn get_pc_and_fp(cx: *mut libc::c_void, _signum: libc::c_int) -> (*const (*cx.uc_mcontext).__ss.__rip as *const u8, (*cx.uc_mcontext).__ss.__rbp as usize, ) - } else if #[cfg(all(target_os = "macos", target_arch = "x86"))] { - let cx = &*(cx as *const libc::ucontext_t); - ( - (*cx.uc_mcontext).__ss.__eip as *const u8, - (*cx.uc_mcontext).__ss.__ebp as usize, - ) } else if #[cfg(all(target_os = "macos", target_arch = "aarch64"))] { let cx = &*(cx as *const libc::ucontext_t); ( diff --git a/crates/runtime/src/traphandlers/windows.rs b/crates/runtime/src/traphandlers/windows.rs index c76c1b0c06..a9c1b4f044 100644 --- a/crates/runtime/src/traphandlers/windows.rs +++ b/crates/runtime/src/traphandlers/windows.rs @@ -55,9 +55,6 @@ unsafe extern "system" fn exception_handler(exception_info: *mut EXCEPTION_POINT if #[cfg(target_arch = "x86_64")] { let ip = (*(*exception_info).ContextRecord).Rip as *const u8; let fp = (*(*exception_info).ContextRecord).Rbp as usize; - } else if #[cfg(target_arch = "x86")] { - let ip = (*(*exception_info).ContextRecord).Eip as *const u8; - let fp = (*(*exception_info).ContextRecord).Ebp as usize; } else if #[cfg(target_arch = "aarch64")] { let ip = (*(*exception_info).ContextRecord).Pc as *const u8; let fp = (*(*exception_info).ContextRecord).Anonymous.Anonymous.Fp as usize;