Mark #[rustc_std_internal_symbol] as extern indicator
It currently implies #[no_mangle] which is alread an extern indicator, but this will change in a future commit.
This commit is contained in:
parent
98b9d0232f
commit
60b785fc8d
2 changed files with 2 additions and 4 deletions
|
@ -174,6 +174,7 @@ impl CodegenFnAttrs {
|
||||||
/// * `#[linkage]` is present
|
/// * `#[linkage]` is present
|
||||||
pub fn contains_extern_indicator(&self) -> bool {
|
pub fn contains_extern_indicator(&self) -> bool {
|
||||||
self.flags.contains(CodegenFnAttrFlags::NO_MANGLE)
|
self.flags.contains(CodegenFnAttrFlags::NO_MANGLE)
|
||||||
|
|| self.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL)
|
||||||
|| self.export_name.is_some()
|
|| self.export_name.is_some()
|
||||||
|| match self.linkage {
|
|| match self.linkage {
|
||||||
// These are private, so make sure we don't try to consider
|
// These are private, so make sure we don't try to consider
|
||||||
|
|
|
@ -184,9 +184,7 @@ impl<'tcx> ReachableContext<'tcx> {
|
||||||
CodegenFnAttrs::EMPTY
|
CodegenFnAttrs::EMPTY
|
||||||
};
|
};
|
||||||
let is_extern = codegen_attrs.contains_extern_indicator();
|
let is_extern = codegen_attrs.contains_extern_indicator();
|
||||||
let std_internal =
|
if is_extern {
|
||||||
codegen_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL);
|
|
||||||
if is_extern || std_internal {
|
|
||||||
self.reachable_symbols.insert(search_item);
|
self.reachable_symbols.insert(search_item);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -426,7 +424,6 @@ fn has_custom_linkage(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
|
||||||
}
|
}
|
||||||
let codegen_attrs = tcx.codegen_fn_attrs(def_id);
|
let codegen_attrs = tcx.codegen_fn_attrs(def_id);
|
||||||
codegen_attrs.contains_extern_indicator()
|
codegen_attrs.contains_extern_indicator()
|
||||||
|| codegen_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL)
|
|
||||||
// FIXME(nbdd0121): `#[used]` are marked as reachable here so it's picked up by
|
// FIXME(nbdd0121): `#[used]` are marked as reachable here so it's picked up by
|
||||||
// `linked_symbols` in cg_ssa. They won't be exported in binary or cdylib due to their
|
// `linked_symbols` in cg_ssa. They won't be exported in binary or cdylib due to their
|
||||||
// `SymbolExportLevel::Rust` export level but may end up being exported in dylibs.
|
// `SymbolExportLevel::Rust` export level but may end up being exported in dylibs.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue