Merge commit '3270432f4b0583104c8b9b6f695bf97d6bbf3ac2' into sync_cg_clif-2024-05-13
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
//! [`codegen_static`]: crate::constant::codegen_static
|
||||
|
||||
use rustc_data_structures::profiling::SelfProfilerRef;
|
||||
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
||||
use rustc_middle::mir::mono::{MonoItem, MonoItemData};
|
||||
|
||||
use crate::prelude::*;
|
||||
@@ -33,7 +34,20 @@ fn predefine_mono_items<'tcx>(
|
||||
data.visibility,
|
||||
is_compiler_builtins,
|
||||
);
|
||||
module.declare_function(name, linkage, &sig).unwrap();
|
||||
let is_naked = tcx
|
||||
.codegen_fn_attrs(instance.def_id())
|
||||
.flags
|
||||
.contains(CodegenFnAttrFlags::NAKED);
|
||||
module
|
||||
.declare_function(
|
||||
name,
|
||||
// Naked functions are defined in a separate object
|
||||
// file from the codegen unit rustc expects them to
|
||||
// be defined in.
|
||||
if is_naked { Linkage::Import } else { linkage },
|
||||
&sig,
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
MonoItem::Static(_) | MonoItem::GlobalAsm(_) => {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user