Skip to content

Personality function not required in no_std code that uses C_unwind FFI. #97568

Open
@nbdd0121

Description

@nbdd0121

Discovered when thinking about #97235. Exactly the same snippet of code:

extern "C-unwind" {
    fn foo();
}

fn bar() {
    unsafe { foo(); }
}

Compiling the above in -C panic=abort requires a personality function to turn unwind into abort. The current criteria for determining whether a personality function is needed just looks at the panic strategy, so rust_eh_personality isn't required, causing a linking error instead.

@rustbot label: F-c_unwind requires-nightly C-bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-c_unwind`#![feature(c_unwind)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions