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

Move EH personality functions to std #92845

Merged
merged 7 commits into from
Aug 28, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 7 additions & 11 deletions compiler/rustc_codegen_ssa/src/back/symbol_export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,14 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, cnum: CrateNum) -> DefIdMap<
}
})
.map(|def_id| {
let (export_level, used) = if special_runtime_crate {
let name = tcx.symbol_name(Instance::mono(tcx, def_id.to_def_id())).name;
// We won't link right if these symbols are stripped during LTO.
let used = match name {
"rust_eh_personality"
| "rust_eh_register_frames"
| "rust_eh_unregister_frames" => true,
_ => false,
};
(SymbolExportLevel::Rust, used)
// We won't link right if this symbol is stripped during LTO.
let name = tcx.symbol_name(Instance::mono(tcx, def_id.to_def_id())).name;
let used = name == "rust_eh_personality";

let export_level = if special_runtime_crate {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means that rust_eh_personality is now exported from cdylibs as it doesn't use SymbolExportLevel::Rust, right? That is going to give troubles when depending on two cdylibs compiled by different versions of rustc if we change the eh_personality implementation as one version of this symbol will override the other.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think symbol_export_level still returns Rust for rust_eh_personality since it doesn't have any attribute such as no_mangle that marks it as externally visible.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked it and you are indeed right. rust_eh_personality is not exported.

SymbolExportLevel::Rust
} else {
(symbol_export_level(tcx, def_id.to_def_id()), false)
symbol_export_level(tcx, def_id.to_def_id())
};
let codegen_attrs = tcx.codegen_fn_attrs(def_id.to_def_id());
debug!(
Expand Down