Move dummy personality to libunwind
This commit is contained in:
parent
bf908d9562
commit
e205fb9e64
@ -18,6 +18,7 @@ fde-phdr = ["libc"]
|
||||
fde-registry = ["alloc"]
|
||||
dwarf-expr = []
|
||||
hide-trace = []
|
||||
personality-dummy = []
|
||||
system-alloc = []
|
||||
default = ["dwarf-expr", "hide-trace", "fde-phdr", "fde-registry"]
|
||||
|
||||
|
@ -8,5 +8,5 @@ edition = "2018"
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
unwind = { path = "../", features = ["system-alloc"] }
|
||||
unwind = { path = "../", features = ["system-alloc", "personality-dummy"] }
|
||||
libc = "0.2"
|
||||
|
@ -9,25 +9,9 @@
|
||||
extern crate unwind;
|
||||
|
||||
use core::panic::PanicInfo;
|
||||
use libc::c_int;
|
||||
pub use unwind::*;
|
||||
|
||||
#[panic_handler]
|
||||
fn panic(_info: &PanicInfo<'_>) -> ! {
|
||||
// `unwind` crate should never panic.
|
||||
unsafe { core::hint::unreachable_unchecked() }
|
||||
}
|
||||
|
||||
#[lang = "eh_personality"]
|
||||
extern "C" fn personality(
|
||||
version: c_int,
|
||||
_actions: UnwindAction,
|
||||
_exception_class: u64,
|
||||
_exception: &mut UnwindException,
|
||||
_ctx: &mut UnwindContext<'_>,
|
||||
) -> UnwindReasonCode {
|
||||
if version != 1 {
|
||||
return UnwindReasonCode::FATAL_PHASE1_ERROR;
|
||||
}
|
||||
UnwindReasonCode::CONTINUE_UNWIND
|
||||
}
|
||||
|
@ -14,6 +14,9 @@ mod find_fde;
|
||||
mod frame;
|
||||
mod util;
|
||||
|
||||
#[cfg(feature = "personality-dummy")]
|
||||
mod personality_dummy;
|
||||
|
||||
#[cfg(feature = "system-alloc")]
|
||||
mod system_alloc;
|
||||
|
||||
|
16
src/personality_dummy.rs
Normal file
16
src/personality_dummy.rs
Normal file
@ -0,0 +1,16 @@
|
||||
use crate::abi::*;
|
||||
use crate::util::*;
|
||||
|
||||
#[lang = "eh_personality"]
|
||||
extern "C" fn personality(
|
||||
version: c_int,
|
||||
_actions: UnwindAction,
|
||||
_exception_class: u64,
|
||||
_exception: &mut UnwindException,
|
||||
_ctx: &mut UnwindContext<'_>,
|
||||
) -> UnwindReasonCode {
|
||||
if version != 1 {
|
||||
return UnwindReasonCode::FATAL_PHASE1_ERROR;
|
||||
}
|
||||
UnwindReasonCode::CONTINUE_UNWIND
|
||||
}
|
Loading…
Reference in New Issue
Block a user