Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust_eh_personality exported by cdylibs #92102

Closed
bjorn3 opened this issue Dec 19, 2021 · 2 comments
Closed

rust_eh_personality exported by cdylibs #92102

bjorn3 opened this issue Dec 19, 2021 · 2 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@bjorn3
Copy link
Member

bjorn3 commented Dec 19, 2021

I tried this:

$ echo | rustc - --crate-type cdylib
$ bingrep librust_out.so
[...]
Dyn Syms(13):
               Addr   Bind       Type        Symbol                            Size     Section     Other
[...]
              1300    GLOBAL     FUNC        rust_eh_personality               0x2e5    .text(11)   0x0
[...]

I expected to see this happen: No symbols are exported as there are no #[no_mangle] symbols in the crate source.

Instead, this happened: rust_eh_personality is exported. This means that different rustc versions could potentially interfere with unwinding of code compiled by the other rustc version by overriding this symbol.

Meta

rustc --version --verbose:

rustc 1.59.0-nightly (91a0600a5 2021-12-18)
binary: rustc
commit-hash: 91a0600a5c22b9d159e3c57526af83e71d1120f8
commit-date: 2021-12-18
host: x86_64-unknown-linux-gnu
release: 1.59.0-nightly
LLVM version: 13.0.0

and

rustc 1.56.0 (09c42c458 2021-10-18)
binary: rustc
commit-hash: 09c42c45858d5f3aedfa670698275303a3d19afa
commit-date: 2021-10-18
host: x86_64-unknown-linux-gnu
release: 1.56.0
LLVM version: 13.0.0
@bjorn3 bjorn3 added A-linkage Area: linking into static, shared libraries and binaries T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Dec 19, 2021
@bjorn3
Copy link
Member Author

bjorn3 commented Mar 11, 2022

Weak lang items should be marked with #[rustc_std_internal_symbol] already which should hide it from cdylibs:

if tcx.is_weak_lang_item(id) {
codegen_fn_attrs.flags |= CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL;
}

@petrochenkov
Copy link
Contributor

Fixed in #95604.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants