Remove implicit #[no_mangle] for #[rustc_std_internal_symbol]
This commit is contained in:
parent
c0639ef8e4
commit
b754ef727c
17 changed files with 95 additions and 49 deletions
|
@ -7,6 +7,7 @@ use rustc_codegen_ssa::traits::BaseTypeCodegenMethods as _;
|
|||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::config::{DebugInfo, OomStrategy};
|
||||
use rustc_symbol_mangling::mangle_internal_symbol;
|
||||
|
||||
use crate::builder::SBuilder;
|
||||
use crate::declare::declare_simple_fn;
|
||||
|
@ -53,8 +54,8 @@ pub(crate) unsafe fn codegen(
|
|||
}
|
||||
};
|
||||
|
||||
let from_name = global_fn_name(method.name);
|
||||
let to_name = default_fn_name(method.name);
|
||||
let from_name = mangle_internal_symbol(tcx, &global_fn_name(method.name));
|
||||
let to_name = mangle_internal_symbol(tcx, &default_fn_name(method.name));
|
||||
|
||||
create_wrapper_function(tcx, &cx, &from_name, &to_name, &args, output, false);
|
||||
}
|
||||
|
@ -64,8 +65,8 @@ pub(crate) unsafe fn codegen(
|
|||
create_wrapper_function(
|
||||
tcx,
|
||||
&cx,
|
||||
"__rust_alloc_error_handler",
|
||||
alloc_error_handler_name(alloc_error_handler_kind),
|
||||
&mangle_internal_symbol(tcx, "__rust_alloc_error_handler"),
|
||||
&mangle_internal_symbol(tcx, alloc_error_handler_name(alloc_error_handler_kind)),
|
||||
&[usize, usize], // size, align
|
||||
None,
|
||||
true,
|
||||
|
@ -73,15 +74,15 @@ pub(crate) unsafe fn codegen(
|
|||
|
||||
unsafe {
|
||||
// __rust_alloc_error_handler_should_panic
|
||||
let name = OomStrategy::SYMBOL;
|
||||
let ll_g = cx.declare_global(name, i8);
|
||||
let name = mangle_internal_symbol(tcx, OomStrategy::SYMBOL);
|
||||
let ll_g = cx.declare_global(&name, i8);
|
||||
llvm::set_visibility(ll_g, llvm::Visibility::from_generic(tcx.sess.default_visibility()));
|
||||
let val = tcx.sess.opts.unstable_opts.oom.should_panic();
|
||||
let llval = llvm::LLVMConstInt(i8, val as u64, False);
|
||||
llvm::set_initializer(ll_g, llval);
|
||||
|
||||
let name = NO_ALLOC_SHIM_IS_UNSTABLE;
|
||||
let ll_g = cx.declare_global(name, i8);
|
||||
let name = mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE);
|
||||
let ll_g = cx.declare_global(&name, i8);
|
||||
llvm::set_visibility(ll_g, llvm::Visibility::from_generic(tcx.sess.default_visibility()));
|
||||
let llval = llvm::LLVMConstInt(i8, 0, False);
|
||||
llvm::set_initializer(ll_g, llval);
|
||||
|
|
|
@ -27,6 +27,7 @@ use rustc_session::config::{
|
|||
};
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::{DUMMY_SP, Span};
|
||||
use rustc_symbol_mangling::mangle_internal_symbol;
|
||||
use rustc_target::spec::{HasTargetSpec, RelocModel, SmallDataThresholdSupport, Target, TlsModel};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
|
@ -1199,7 +1200,7 @@ impl<'ll> CodegenCx<'ll, '_> {
|
|||
Some(def_id) => self.get_static(def_id),
|
||||
_ => {
|
||||
let ty = self.type_struct(&[self.type_ptr(), self.type_ptr()], false);
|
||||
self.declare_global("rust_eh_catch_typeinfo", ty)
|
||||
self.declare_global(&mangle_internal_symbol(self.tcx, "rust_eh_catch_typeinfo"), ty)
|
||||
}
|
||||
};
|
||||
self.eh_catch_typeinfo.set(Some(eh_catch_typeinfo));
|
||||
|
|
|
@ -14,6 +14,7 @@ use rustc_middle::ty::layout::{FnAbiOf, HasTyCtxt, HasTypingEnv, LayoutOf};
|
|||
use rustc_middle::ty::{self, GenericArgsRef, Ty};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_span::{Span, Symbol, sym};
|
||||
use rustc_symbol_mangling::mangle_internal_symbol;
|
||||
use rustc_target::callconv::{FnAbi, PassMode};
|
||||
use rustc_target::spec::{HasTargetSpec, PanicStrategy};
|
||||
use tracing::debug;
|
||||
|
@ -812,7 +813,10 @@ fn codegen_msvc_try<'ll>(
|
|||
let type_name = bx.const_bytes(b"rust_panic\0");
|
||||
let type_info =
|
||||
bx.const_struct(&[type_info_vtable, bx.const_null(bx.type_ptr()), type_name], false);
|
||||
let tydesc = bx.declare_global("__rust_panic_type_info", bx.val_ty(type_info));
|
||||
let tydesc = bx.declare_global(
|
||||
&mangle_internal_symbol(bx.tcx, "__rust_panic_type_info"),
|
||||
bx.val_ty(type_info),
|
||||
);
|
||||
|
||||
llvm::set_linkage(tydesc, llvm::Linkage::LinkOnceODRLinkage);
|
||||
if bx.cx.tcx.sess.target.supports_comdat() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue