Skip to content

Commit 6f9b2b3

Browse files
committed
Stop exporting rust_eh_personality and friends from cdylib
1 parent 1af3e0a commit 6f9b2b3

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

compiler/rustc_codegen_ssa/src/back/symbol_export.rs

+9-15
Original file line numberDiff line numberDiff line change
@@ -105,24 +105,18 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, cnum: CrateNum) -> DefIdMap<
105105
}
106106
})
107107
.map(|def_id| {
108-
let export_level = if special_runtime_crate {
108+
let (export_level, used) = if special_runtime_crate {
109109
let name = tcx.symbol_name(Instance::mono(tcx, def_id.to_def_id())).name;
110-
// We can probably do better here by just ensuring that
111-
// it has hidden visibility rather than public
112-
// visibility, as this is primarily here to ensure it's
113-
// not stripped during LTO.
114-
//
115-
// In general though we won't link right if these
116-
// symbols are stripped, and LTO currently strips them.
117-
match name {
110+
// We won't link right if these symbols are stripped during LTO.
111+
let used = match name {
118112
"rust_eh_personality"
119113
| "rust_eh_register_frames"
120-
| "rust_eh_unregister_frames" =>
121-
SymbolExportLevel::C,
122-
_ => SymbolExportLevel::Rust,
123-
}
114+
| "rust_eh_unregister_frames" => true,
115+
_ => false,
116+
};
117+
(SymbolExportLevel::Rust, used)
124118
} else {
125-
symbol_export_level(tcx, def_id.to_def_id())
119+
(symbol_export_level(tcx, def_id.to_def_id()), false)
126120
};
127121
let codegen_attrs = tcx.codegen_fn_attrs(def_id.to_def_id());
128122
debug!(
@@ -142,7 +136,7 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, cnum: CrateNum) -> DefIdMap<
142136
SymbolExportKind::Text
143137
},
144138
used: codegen_attrs.flags.contains(CodegenFnAttrFlags::USED)
145-
|| codegen_attrs.flags.contains(CodegenFnAttrFlags::USED_LINKER),
139+
|| codegen_attrs.flags.contains(CodegenFnAttrFlags::USED_LINKER) || used,
146140
})
147141
})
148142
.collect();

0 commit comments

Comments
 (0)