Skip to content

Commit e8d88c0

Browse files
committed
Remove special case for the panic runtime from reachable_non_generics
The panic runtime uses #[rustc_std_internal_symbol] which has the same effect as this special case with respect to symbol visibility.
1 parent 964d3af commit e8d88c0

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

compiler/rustc_codegen_ssa/src/back/symbol_export.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,7 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> DefIdMap<S
5151
return Default::default();
5252
}
5353

54-
// Check to see if this crate is a "special runtime crate". These
55-
// crates, implementation details of the standard library, typically
56-
// have a bunch of `pub extern` and `#[no_mangle]` functions as the
57-
// ABI between them. We don't want their symbols to have a `C`
58-
// export level, however, as they're just implementation details.
59-
// Down below we'll hardwire all of the symbols to the `Rust` export
60-
// level instead.
61-
let special_runtime_crate =
62-
tcx.is_panic_runtime(LOCAL_CRATE) || tcx.is_compiler_builtins(LOCAL_CRATE);
54+
let is_compiler_builtins = tcx.is_compiler_builtins(LOCAL_CRATE);
6355

6456
let mut reachable_non_generics: DefIdMap<_> = tcx
6557
.reachable_set(())
@@ -104,7 +96,12 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> DefIdMap<S
10496
if tcx.cross_crate_inlinable(def_id) { None } else { Some(def_id) }
10597
})
10698
.map(|def_id| {
107-
let export_level = if special_runtime_crate {
99+
let export_level = if is_compiler_builtins {
100+
// We don't want to export compiler-builtins symbols from any
101+
// dylibs, even rust dylibs. Unlike all other crates it gets
102+
// duplicated in every linker invocation and it may otherwise
103+
// unintentionally override definitions of these symbols by
104+
// libgcc or compiler-rt for C code.
108105
SymbolExportLevel::Rust
109106
} else {
110107
symbol_export_level(tcx, def_id.to_def_id())

0 commit comments

Comments
 (0)