Add test for unwinding past terminating POF

This commit is contained in:
Gary Guo 2023-04-07 17:15:41 +01:00
parent 37f7d322b8
commit ecd04fd1b5
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,9 @@
# ignore-cross-compile
# only-linux
include ../tools.mk
all: foo
$(call RUN,foo) | $(CGREP) -v "cannot unwind"
foo: foo.rs
$(RUSTC) $<

View File

@ -0,0 +1,17 @@
// Tests that forced unwind through POF Rust frames wouldn't trigger our terminating guards.
#![feature(c_unwind)]
#![no_main]
extern "C-unwind" {
fn pthread_exit(v: *mut core::ffi::c_void) -> !;
}
unsafe extern "C" fn call_pthread_exit() {
pthread_exit(core::ptr::null_mut());
}
#[no_mangle]
unsafe extern "C-unwind" fn main(_argc: core::ffi::c_int, _argv: *mut *mut core::ffi::c_char) {
call_pthread_exit();
}