Fix function signature for rust_eh_personality

While cg_llvm is very lax about mismatched function signatures, cg_clif
will crash when there is any mismatch. It could be turned into an error,
but without Cranelift changes can't just be ignored.
This commit is contained in:
bjorn3
2025-06-24 09:03:16 +00:00
parent 77232fb935
commit fcb718b25f
7 changed files with 59 additions and 7 deletions

View File

@@ -12,7 +12,15 @@ fn panic(_: &PanicInfo) -> ! {
} }
#[lang = "eh_personality"] #[lang = "eh_personality"]
fn eh() {} fn eh(
_version: i32,
_actions: i32,
_exception_class: u64,
_exception_object: *mut (),
_context: *mut (),
) -> i32 {
loop {}
}
#[alloc_error_handler] #[alloc_error_handler]
fn oom(_: Layout) -> ! { fn oom(_: Layout) -> ! {

View File

@@ -21,6 +21,12 @@ extern "C" fn __rust_foreign_exception() -> ! {
} }
#[lang = "eh_personality"] #[lang = "eh_personality"]
fn eh_personality() { fn eh_personality(
_version: i32,
_actions: i32,
_exception_class: u64,
_exception_object: *mut (),
_context: *mut (),
) -> i32 {
loop {} loop {}
} }

View File

@@ -12,7 +12,13 @@ fn panic_handler(_: &core::panic::PanicInfo) -> ! {
} }
#[no_mangle] #[no_mangle]
extern "C" fn rust_eh_personality() { extern "C" fn rust_eh_personality(
_version: i32,
_actions: i32,
_exception_class: u64,
_exception_object: *mut (),
_context: *mut (),
) -> i32 {
loop {} loop {}
} }

View File

@@ -70,7 +70,15 @@ fn panic(panic_info: &core::panic::PanicInfo) -> ! {
// in these libraries will refer to `rust_eh_personality` if LLVM can not *prove* the contents won't // in these libraries will refer to `rust_eh_personality` if LLVM can not *prove* the contents won't
// unwind. So, for this test case we will define the symbol. // unwind. So, for this test case we will define the symbol.
#[lang = "eh_personality"] #[lang = "eh_personality"]
extern "C" fn rust_eh_personality() {} extern "C" fn rust_eh_personality(
_version: i32,
_actions: i32,
_exception_class: u64,
_exception_object: *mut (),
_context: *mut (),
) -> i32 {
loop {}
}
#[derive(Default, Debug)] #[derive(Default, Debug)]
struct Page(#[allow(dead_code)] [[u64; 32]; 16]); struct Page(#[allow(dead_code)] [[u64; 32]; 16]);

View File

@@ -57,7 +57,15 @@ fn panic(panic_info: &core::panic::PanicInfo) -> ! {
// in these libraries will refer to `rust_eh_personality` if LLVM can not *prove* the contents won't // in these libraries will refer to `rust_eh_personality` if LLVM can not *prove* the contents won't
// unwind. So, for this test case we will define the symbol. // unwind. So, for this test case we will define the symbol.
#[lang = "eh_personality"] #[lang = "eh_personality"]
extern "C" fn rust_eh_personality() {} extern "C" fn rust_eh_personality(
_version: i32,
_actions: i32,
_exception_class: u64,
_exception_object: *mut (),
_context: *mut (),
) -> i32 {
loop {}
}
#[derive(Default, Debug)] #[derive(Default, Debug)]
struct Page(#[allow(dead_code)] [[u64; 32]; 16]); struct Page(#[allow(dead_code)] [[u64; 32]; 16]);

View File

@@ -12,4 +12,12 @@ pub fn begin_panic_handler(_info: &core::panic::PanicInfo<'_>) -> ! {
} }
#[lang = "eh_personality"] #[lang = "eh_personality"]
extern "C" fn eh_personality() {} extern "C" fn eh_personality(
_version: i32,
_actions: i32,
_exception_class: u64,
_exception_object: *mut (),
_context: *mut (),
) -> i32 {
loop {}
}

View File

@@ -21,4 +21,12 @@ pub fn test(_: DropMe) {
} }
#[rustc_std_internal_symbol] #[rustc_std_internal_symbol]
pub unsafe extern "C" fn rust_eh_personality() {} pub unsafe extern "C" fn rust_eh_personality(
_version: i32,
_actions: i32,
_exception_class: u64,
_exception_object: *mut (),
_context: *mut (),
) -> i32 {
loop {}
}