File tree Expand file tree Collapse file tree 2 files changed +13
-19
lines changed
compiler/rustc_codegen_llvm/src Expand file tree Collapse file tree 2 files changed +13
-19
lines changed Original file line number Diff line number Diff line change @@ -464,6 +464,7 @@ pub(crate) fn add_module_flag_str(
464464 }
465465}
466466
467+ #[ allow( dead_code) ]
467468pub ( crate ) fn add_module_linker_option ( module : & Module , value : & str ) {
468469 unsafe {
469470 LLVMRustAddLinkerOptions ( module, value. as_c_char_ptr ( ) , value. len ( ) ) ;
Original file line number Diff line number Diff line change @@ -114,25 +114,18 @@ impl<'tcx> PreDefineCodegenMethods<'tcx> for CodegenCx<'_, 'tcx> {
114114 self . instances . borrow_mut ( ) . insert ( instance, lldecl) ;
115115 }
116116
117- fn weak_alias ( & self , aliasee : Self :: Function , aliasee_name : & str , name : & str ) {
118- if self . tcx . sess . target . is_like_msvc {
119- llvm:: add_module_linker_option (
120- self . llmod ,
121- & format ! ( "/alternatename:{name}={aliasee_name}" ) ,
122- ) ;
123- } else {
124- let ty = self . get_type_of_global ( aliasee) ;
125- let alias = llvm:: add_alias (
126- self . llmod ,
127- ty,
128- AddressSpace :: DATA ,
129- aliasee,
130- & CString :: new ( name) . unwrap ( ) ,
131- ) ;
132-
133- llvm:: set_linkage ( alias, llvm:: Linkage :: WeakAnyLinkage ) ;
134- self . add_compiler_used_global ( alias) ;
135- }
117+ fn weak_alias ( & self , aliasee : Self :: Function , _aliasee_name : & str , name : & str ) {
118+ let ty = self . get_type_of_global ( aliasee) ;
119+ let alias = llvm:: add_alias (
120+ self . llmod ,
121+ ty,
122+ AddressSpace :: DATA ,
123+ aliasee,
124+ & CString :: new ( name) . unwrap ( ) ,
125+ ) ;
126+
127+ llvm:: set_linkage ( alias, llvm:: Linkage :: WeakAnyLinkage ) ;
128+ self . add_compiler_used_global ( alias) ;
136129 }
137130}
138131
You can’t perform that action at this time.
0 commit comments