about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2025-06-24 09:03:16 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2025-06-24 09:06:49 +0000
commitfcb718b25fbda2bec2255babe212654ba2f4e8c9 (patch)
treef28bdb57f4e5383cd9ed7edde55a0eba9de6e779
parent77232fb9350dbe09821df27f184301475829f1e4 (diff)
downloadrust-fcb718b25fbda2bec2255babe212654ba2f4e8c9.tar.gz
rust-fcb718b25fbda2bec2255babe212654ba2f4e8c9.zip
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.
-rw-r--r--tests/run-make/bin-emit-no-symbols/app.rs10
-rw-r--r--tests/run-make/crate-circular-deps-link/a.rs8
-rw-r--r--tests/run-make/no-alloc-shim/foo.rs8
-rw-r--r--tests/ui/allocator/no_std-alloc-error-handler-custom.rs10
-rw-r--r--tests/ui/allocator/no_std-alloc-error-handler-default.rs10
-rw-r--r--tests/ui/extern-flag/auxiliary/panic_handler.rs10
-rw-r--r--tests/ui/panic-runtime/incompatible-type.rs10
7 files changed, 59 insertions, 7 deletions
diff --git a/tests/run-make/bin-emit-no-symbols/app.rs b/tests/run-make/bin-emit-no-symbols/app.rs
index e9dc1e9744f..ad74fcc43dc 100644
--- a/tests/run-make/bin-emit-no-symbols/app.rs
+++ b/tests/run-make/bin-emit-no-symbols/app.rs
@@ -12,7 +12,15 @@ fn panic(_: &PanicInfo) -> ! {
 }
 
 #[lang = "eh_personality"]
-fn eh() {}
+fn eh(
+    _version: i32,
+    _actions: i32,
+    _exception_class: u64,
+    _exception_object: *mut (),
+    _context: *mut (),
+) -> i32 {
+    loop {}
+}
 
 #[alloc_error_handler]
 fn oom(_: Layout) -> ! {
diff --git a/tests/run-make/crate-circular-deps-link/a.rs b/tests/run-make/crate-circular-deps-link/a.rs
index a54f429550e..99b2b65049d 100644
--- a/tests/run-make/crate-circular-deps-link/a.rs
+++ b/tests/run-make/crate-circular-deps-link/a.rs
@@ -21,6 +21,12 @@ extern "C" fn __rust_foreign_exception() -> ! {
 }
 
 #[lang = "eh_personality"]
-fn eh_personality() {
+fn eh_personality(
+    _version: i32,
+    _actions: i32,
+    _exception_class: u64,
+    _exception_object: *mut (),
+    _context: *mut (),
+) -> i32 {
     loop {}
 }
diff --git a/tests/run-make/no-alloc-shim/foo.rs b/tests/run-make/no-alloc-shim/foo.rs
index b5d0d394d2b..a22307f41b3 100644
--- a/tests/run-make/no-alloc-shim/foo.rs
+++ b/tests/run-make/no-alloc-shim/foo.rs
@@ -12,7 +12,13 @@ fn panic_handler(_: &core::panic::PanicInfo) -> ! {
 }
 
 #[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 {}
 }
 
diff --git a/tests/ui/allocator/no_std-alloc-error-handler-custom.rs b/tests/ui/allocator/no_std-alloc-error-handler-custom.rs
index 6bbfb72510d..5b232e667a0 100644
--- a/tests/ui/allocator/no_std-alloc-error-handler-custom.rs
+++ b/tests/ui/allocator/no_std-alloc-error-handler-custom.rs
@@ -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
 // unwind. So, for this test case we will define the symbol.
 #[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)]
 struct Page(#[allow(dead_code)] [[u64; 32]; 16]);
diff --git a/tests/ui/allocator/no_std-alloc-error-handler-default.rs b/tests/ui/allocator/no_std-alloc-error-handler-default.rs
index 8bcf054ac85..b9289d9fb81 100644
--- a/tests/ui/allocator/no_std-alloc-error-handler-default.rs
+++ b/tests/ui/allocator/no_std-alloc-error-handler-default.rs
@@ -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
 // unwind. So, for this test case we will define the symbol.
 #[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)]
 struct Page(#[allow(dead_code)] [[u64; 32]; 16]);
diff --git a/tests/ui/extern-flag/auxiliary/panic_handler.rs b/tests/ui/extern-flag/auxiliary/panic_handler.rs
index 9140ceed229..9607f0ed013 100644
--- a/tests/ui/extern-flag/auxiliary/panic_handler.rs
+++ b/tests/ui/extern-flag/auxiliary/panic_handler.rs
@@ -12,4 +12,12 @@ pub fn begin_panic_handler(_info: &core::panic::PanicInfo<'_>) -> ! {
 }
 
 #[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 {}
+}
diff --git a/tests/ui/panic-runtime/incompatible-type.rs b/tests/ui/panic-runtime/incompatible-type.rs
index 4cbcfec11c9..f82c23d68c2 100644
--- a/tests/ui/panic-runtime/incompatible-type.rs
+++ b/tests/ui/panic-runtime/incompatible-type.rs
@@ -21,4 +21,12 @@ pub fn test(_: DropMe) {
 }
 
 #[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 {}
+}