Skip to content

rust_eh_personality exported in cdylibs #100774

Description

@dkg

If i have two shared objects, each created by rust using a cdylib crate, and they are both invoked from an external (non-rust) executable, it's unusual that both of these libraries will implement and export a rust_eh_personality symbol.

If, for whatever reason, the external executable tries to invoke rust_eh_personality, which library's function call will be invoked?

If the two dylibs are built by different versions of rust, or with different options, presumably the rust_eh_personality function will differ.

(even worse would be if any internal code in either shared object invoked rust_eh_personality by the process's symbol table, but i'm assuming that internal code references its own rust_eh_personality internally)

Unless there is a clear reason to export the rust_eh_personality symbol, it ought to be non-exported by default so that multiple cdylib objects can be loaded without colliding symbols.

I note #92102 raises the same concern, but it seems to be resolved without having stopped exporting rust_eh_personality.

https://users.rust-lang.org/t/hiding-rust-eh-personality-symbol-in-cdylib/60490 also discusses the matter, but i don't see how it is resolved in the general case.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-linkageArea: linking into static, shared libraries and binaries

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions