@@ -49,6 +49,7 @@ struct LtoData {
4949
5050fn prepare_lto (
5151 cgcx : & CodegenContext < GccCodegenBackend > ,
52+ each_linked_rlib_for_lto : & [ PathBuf ] ,
5253 dcx : DiagCtxtHandle < ' _ > ,
5354) -> Result < LtoData , FatalError > {
5455 let tmp_path = match tempdir ( ) {
@@ -67,7 +68,7 @@ fn prepare_lto(
6768 // with either fat or thin LTO
6869 let mut upstream_modules = Vec :: new ( ) ;
6970 if cgcx. lto != Lto :: ThinLocal {
70- for & ( _cnum , ref path) in cgcx . each_linked_rlib_for_lto . iter ( ) {
71+ for path in each_linked_rlib_for_lto {
7172 let archive_data = unsafe {
7273 Mmap :: map ( File :: open ( path) . expect ( "couldn't open rlib" ) ) . expect ( "couldn't map rlib" )
7374 } ;
@@ -111,11 +112,12 @@ fn save_as_file(obj: &[u8], path: &Path) -> Result<(), LtoBitcodeFromRlib> {
111112/// for further optimization.
112113pub ( crate ) fn run_fat (
113114 cgcx : & CodegenContext < GccCodegenBackend > ,
115+ each_linked_rlib_for_lto : & [ PathBuf ] ,
114116 modules : Vec < FatLtoInput < GccCodegenBackend > > ,
115117) -> Result < ModuleCodegen < GccContext > , FatalError > {
116118 let dcx = cgcx. create_dcx ( ) ;
117119 let dcx = dcx. handle ( ) ;
118- let lto_data = prepare_lto ( cgcx, dcx) ?;
120+ let lto_data = prepare_lto ( cgcx, each_linked_rlib_for_lto , dcx) ?;
119121 /*let symbols_below_threshold =
120122 lto_data.symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::<Vec<_>>();*/
121123 fat_lto (
@@ -281,12 +283,13 @@ impl ModuleBufferMethods for ModuleBuffer {
281283/// can simply be copied over from the incr. comp. cache.
282284pub ( crate ) fn run_thin (
283285 cgcx : & CodegenContext < GccCodegenBackend > ,
286+ each_linked_rlib_for_lto : & [ PathBuf ] ,
284287 modules : Vec < ( String , ThinBuffer ) > ,
285288 cached_modules : Vec < ( SerializedModule < ModuleBuffer > , WorkProduct ) > ,
286289) -> Result < ( Vec < ThinModule < GccCodegenBackend > > , Vec < WorkProduct > ) , FatalError > {
287290 let dcx = cgcx. create_dcx ( ) ;
288291 let dcx = dcx. handle ( ) ;
289- let lto_data = prepare_lto ( cgcx, dcx) ?;
292+ let lto_data = prepare_lto ( cgcx, each_linked_rlib_for_lto , dcx) ?;
290293 if cgcx. opts . cg . linker_plugin_lto . enabled ( ) {
291294 unreachable ! (
292295 "We should never reach this case if the LTO step \
0 commit comments