Where is eh_personality called?

I am trying to implement an OS in Rust using libcore. The documentation says that the eh_personality function must be implemented .

However, I do not see the use of this function in libcore itself , and I can compile, run, and panic without it.

Is there something I am missing here? Where is eh_personality called during the panic!() Loop?

+7
rust
source share
1 answer

See erratic book: lang_items :

The first of these rust_eh_personality functions rust_eh_personality used by compiler failure mechanisms. This is often mapped to a GCC function (see the libstd implementation for more information), but mailboxes that don't panic can be sure that this function is never called. The name of the language element is eh_personality .

As far as I can tell, it is required to create information for unwinding; if you panic_fmt or loop on a panic_fmt language panic_fmt ( panic_fmt function), it probably won't be called.

Also see internal comments in libpanic_abort / lib.rs.

If you are looking for rust_eh_personality , you will find use in librustc_trans / context.rs: CodegenCx::eh_personality . The eh_personality search should show the locations called by this function. (It is used to generate code, not a direct call.)

The search #[lang = "eh_personality"] shows only the places where the personality is determined, not the usage.

+4
source share

All Articles