Skip to content

Commit

Permalink
Stop exporting rust_eh_personality and friends from cdylib
Browse files Browse the repository at this point in the history
  • Loading branch information
nbdd0121 committed Apr 25, 2022
1 parent 1af3e0a commit 6f9b2b3
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions compiler/rustc_codegen_ssa/src/back/symbol_export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,24 +105,18 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, cnum: CrateNum) -> DefIdMap<
}
})
.map(|def_id| {
let export_level = if special_runtime_crate {
let (export_level, used) = if special_runtime_crate {
let name = tcx.symbol_name(Instance::mono(tcx, def_id.to_def_id())).name;
// We can probably do better here by just ensuring that
// it has hidden visibility rather than public
// visibility, as this is primarily here to ensure it's
// not stripped during LTO.
//
// In general though we won't link right if these
// symbols are stripped, and LTO currently strips them.
match 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" =>
SymbolExportLevel::C,
_ => SymbolExportLevel::Rust,
}
| "rust_eh_unregister_frames" => true,
_ => false,
};
(SymbolExportLevel::Rust, used)
} else {
symbol_export_level(tcx, def_id.to_def_id())
(symbol_export_level(tcx, def_id.to_def_id()), false)
};
let codegen_attrs = tcx.codegen_fn_attrs(def_id.to_def_id());
debug!(
Expand All @@ -142,7 +136,7 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, cnum: CrateNum) -> DefIdMap<
SymbolExportKind::Text
},
used: codegen_attrs.flags.contains(CodegenFnAttrFlags::USED)
|| codegen_attrs.flags.contains(CodegenFnAttrFlags::USED_LINKER),
|| codegen_attrs.flags.contains(CodegenFnAttrFlags::USED_LINKER) || used,
})
})
.collect();
Expand Down

0 comments on commit 6f9b2b3

Please sign in to comment.