Skip to content

Commit fcb718b

Browse files
committed
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.
1 parent 77232fb commit fcb718b

File tree

7 files changed

+59
-7
lines changed

7 files changed

+59
-7
lines changed

tests/run-make/bin-emit-no-symbols/app.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,15 @@ fn panic(_: &PanicInfo) -> ! {
1212
}
1313

1414
#[lang = "eh_personality"]
15-
fn eh() {}
15+
fn eh(
16+
_version: i32,
17+
_actions: i32,
18+
_exception_class: u64,
19+
_exception_object: *mut (),
20+
_context: *mut (),
21+
) -> i32 {
22+
loop {}
23+
}
1624

1725
#[alloc_error_handler]
1826
fn oom(_: Layout) -> ! {

tests/run-make/crate-circular-deps-link/a.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ extern "C" fn __rust_foreign_exception() -> ! {
2121
}
2222

2323
#[lang = "eh_personality"]
24-
fn eh_personality() {
24+
fn eh_personality(
25+
_version: i32,
26+
_actions: i32,
27+
_exception_class: u64,
28+
_exception_object: *mut (),
29+
_context: *mut (),
30+
) -> i32 {
2531
loop {}
2632
}

tests/run-make/no-alloc-shim/foo.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ fn panic_handler(_: &core::panic::PanicInfo) -> ! {
1212
}
1313

1414
#[no_mangle]
15-
extern "C" fn rust_eh_personality() {
15+
extern "C" fn rust_eh_personality(
16+
_version: i32,
17+
_actions: i32,
18+
_exception_class: u64,
19+
_exception_object: *mut (),
20+
_context: *mut (),
21+
) -> i32 {
1622
loop {}
1723
}
1824

tests/ui/allocator/no_std-alloc-error-handler-custom.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,15 @@ fn panic(panic_info: &core::panic::PanicInfo) -> ! {
7070
// in these libraries will refer to `rust_eh_personality` if LLVM can not *prove* the contents won't
7171
// unwind. So, for this test case we will define the symbol.
7272
#[lang = "eh_personality"]
73-
extern "C" fn rust_eh_personality() {}
73+
extern "C" fn rust_eh_personality(
74+
_version: i32,
75+
_actions: i32,
76+
_exception_class: u64,
77+
_exception_object: *mut (),
78+
_context: *mut (),
79+
) -> i32 {
80+
loop {}
81+
}
7482

7583
#[derive(Default, Debug)]
7684
struct Page(#[allow(dead_code)] [[u64; 32]; 16]);

tests/ui/allocator/no_std-alloc-error-handler-default.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,15 @@ fn panic(panic_info: &core::panic::PanicInfo) -> ! {
5757
// in these libraries will refer to `rust_eh_personality` if LLVM can not *prove* the contents won't
5858
// unwind. So, for this test case we will define the symbol.
5959
#[lang = "eh_personality"]
60-
extern "C" fn rust_eh_personality() {}
60+
extern "C" fn rust_eh_personality(
61+
_version: i32,
62+
_actions: i32,
63+
_exception_class: u64,
64+
_exception_object: *mut (),
65+
_context: *mut (),
66+
) -> i32 {
67+
loop {}
68+
}
6169

6270
#[derive(Default, Debug)]
6371
struct Page(#[allow(dead_code)] [[u64; 32]; 16]);

tests/ui/extern-flag/auxiliary/panic_handler.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,12 @@ pub fn begin_panic_handler(_info: &core::panic::PanicInfo<'_>) -> ! {
1212
}
1313

1414
#[lang = "eh_personality"]
15-
extern "C" fn eh_personality() {}
15+
extern "C" fn eh_personality(
16+
_version: i32,
17+
_actions: i32,
18+
_exception_class: u64,
19+
_exception_object: *mut (),
20+
_context: *mut (),
21+
) -> i32 {
22+
loop {}
23+
}

tests/ui/panic-runtime/incompatible-type.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,12 @@ pub fn test(_: DropMe) {
2121
}
2222

2323
#[rustc_std_internal_symbol]
24-
pub unsafe extern "C" fn rust_eh_personality() {}
24+
pub unsafe extern "C" fn rust_eh_personality(
25+
_version: i32,
26+
_actions: i32,
27+
_exception_class: u64,
28+
_exception_object: *mut (),
29+
_context: *mut (),
30+
) -> i32 {
31+
loop {}
32+
}

0 commit comments

Comments
 (0)