@@ -23,6 +23,7 @@ use crate::llvm;
2323use crate :: metadata;
2424use crate :: value:: Value ;
2525
26+ use log:: debug;
2627use rustc_codegen_ssa:: base:: maybe_create_entry_wrapper;
2728use rustc_codegen_ssa:: mono_item:: MonoItemExt ;
2829use rustc_codegen_ssa:: traits:: * ;
@@ -36,7 +37,6 @@ use rustc_middle::mir::mono::{Linkage, Visibility};
3637use rustc_middle:: ty:: TyCtxt ;
3738use rustc_session:: config:: DebugInfo ;
3839use rustc_span:: symbol:: Symbol ;
39- use log:: debug;
4040
4141use std:: ffi:: CString ;
4242use std:: time:: Instant ;
@@ -80,23 +80,23 @@ pub fn write_idata_sections<'tcx>(
8080 _tcx : TyCtxt < ' tcx > ,
8181 raw_dylibs : & [ RawDylibImports ] ,
8282 llvm_module : & mut ModuleLlvm ,
83- ) {
83+ ) {
8484 let ( idata_llctx, idata_llmod) = ( & * llvm_module. llcx , llvm_module. llmod ( ) ) ;
8585
86-
8786 let idata_7 = SmallCStr :: new ( ".idata$7" ) ;
8887 let idata_6 = SmallCStr :: new ( ".idata$6" ) ;
8988
9089 for raw_dylib in raw_dylibs {
91- debug ! ( "linking raw dylib - {:?}" , raw_dylib) ;
90+ debug ! ( "creating raw dylib idata secions - {:?}" , raw_dylib) ;
9291
9392 let name = CString :: new ( & * raw_dylib. name . as_str ( ) ) . unwrap ( ) ;
9493 let llname = common:: bytes_in_context ( idata_llctx, name. as_bytes ( ) ) ;
9594
96- let buf = CString :: new ( "dll_name" ) . unwrap ( ) ;
95+ let buf = format ! ( "import.{}.dll_name" , raw_dylib. name) ;
96+ let buf = CString :: new ( buf) . unwrap ( ) ;
9797 unsafe {
9898 let llglobal = llvm:: LLVMAddGlobal ( idata_llmod, common:: val_ty ( llname) , buf. as_ptr ( ) ) ;
99-
99+
100100 llvm:: LLVMSetInitializer ( llglobal, llname) ;
101101 llvm:: LLVMSetGlobalConstant ( & llglobal, 1 ) ;
102102 llvm:: LLVMRustSetLinkage ( llglobal, llvm:: Linkage :: PrivateLinkage ) ;
@@ -115,27 +115,24 @@ pub fn write_idata_sections<'tcx>(
115115 let llname = common:: bytes_in_context ( idata_llctx, & buf) ;
116116
117117 let global_name = format ! ( "import.{}.fn.{}" , raw_dylib. name, s) ;
118- let global_name = CString :: new ( global_name. as_str ( ) ) . unwrap ( ) ;
118+ let global_name = CString :: new ( global_name) . unwrap ( ) ;
119119
120120 let llglobal = llvm:: LLVMAddGlobal (
121- idata_llmod,
122- common:: val_ty ( llname) ,
123- global_name. as_ptr ( )
121+ idata_llmod,
122+ common:: val_ty ( llname) ,
123+ global_name. as_ptr ( ) ,
124124 ) ;
125-
125+
126126 llvm:: LLVMSetInitializer ( llglobal, llname) ;
127127 llvm:: LLVMSetGlobalConstant ( & llglobal, 1 ) ;
128128 llvm:: LLVMRustSetLinkage ( llglobal, llvm:: Linkage :: PrivateLinkage ) ;
129129 llvm:: LLVMSetSection ( llglobal, idata_6. as_ptr ( ) ) ;
130- } ,
131- _ => { } ,
130+ }
131+ _ => { }
132132 }
133133 }
134134 }
135-
136-
137135 }
138-
139136}
140137
141138pub struct ValueIter < ' ll > {
0 commit comments