Skip to content

Commit ca0738f

Browse files
committed
Consider only #[no_mangle] as builtin functions
1 parent 9ed0d11 commit ca0738f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/rustc_codegen_ssa/src/back/symbol_export.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -105,20 +105,21 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> DefIdMap<S
105105
}
106106
})
107107
.map(|def_id| {
108+
let codegen_attrs = tcx.codegen_fn_attrs(def_id.to_def_id());
108109
// We won't link right if this symbol is stripped during LTO.
109110
let name = tcx.symbol_name(Instance::mono(tcx, def_id.to_def_id())).name;
110111
// We have to preserve the symbols of the built-in functions during LTO.
111112
let is_builtin_fn = is_compiler_builtins
112113
&& symbol_export_level(tcx, def_id.to_def_id())
113-
.is_below_threshold(SymbolExportLevel::C);
114+
.is_below_threshold(SymbolExportLevel::C)
115+
&& codegen_attrs.flags.contains(CodegenFnAttrFlags::NO_MANGLE);
114116
let used = name == "rust_eh_personality";
115117

116118
let export_level = if special_runtime_crate {
117119
SymbolExportLevel::Rust
118120
} else {
119121
symbol_export_level(tcx, def_id.to_def_id())
120122
};
121-
let codegen_attrs = tcx.codegen_fn_attrs(def_id.to_def_id());
122123
debug!(
123124
"EXPORTED SYMBOL (local): {} ({:?})",
124125
tcx.symbol_name(Instance::mono(tcx, def_id.to_def_id())),

0 commit comments

Comments
 (0)