@@ -49,6 +49,7 @@ struct LtoData {
49
49
50
50
fn prepare_lto (
51
51
cgcx : & CodegenContext < GccCodegenBackend > ,
52
+ each_linked_rlib_for_lto : & [ PathBuf ] ,
52
53
dcx : DiagCtxtHandle < ' _ > ,
53
54
) -> Result < LtoData , FatalError > {
54
55
let tmp_path = match tempdir ( ) {
@@ -67,7 +68,7 @@ fn prepare_lto(
67
68
// with either fat or thin LTO
68
69
let mut upstream_modules = Vec :: new ( ) ;
69
70
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 {
71
72
let archive_data = unsafe {
72
73
Mmap :: map ( File :: open ( path) . expect ( "couldn't open rlib" ) ) . expect ( "couldn't map rlib" )
73
74
} ;
@@ -111,11 +112,12 @@ fn save_as_file(obj: &[u8], path: &Path) -> Result<(), LtoBitcodeFromRlib> {
111
112
/// for further optimization.
112
113
pub ( crate ) fn run_fat (
113
114
cgcx : & CodegenContext < GccCodegenBackend > ,
115
+ each_linked_rlib_for_lto : & [ PathBuf ] ,
114
116
modules : Vec < FatLtoInput < GccCodegenBackend > > ,
115
117
) -> Result < ModuleCodegen < GccContext > , FatalError > {
116
118
let dcx = cgcx. create_dcx ( ) ;
117
119
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) ?;
119
121
/*let symbols_below_threshold =
120
122
lto_data.symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::<Vec<_>>();*/
121
123
fat_lto (
@@ -281,12 +283,13 @@ impl ModuleBufferMethods for ModuleBuffer {
281
283
/// can simply be copied over from the incr. comp. cache.
282
284
pub ( crate ) fn run_thin (
283
285
cgcx : & CodegenContext < GccCodegenBackend > ,
286
+ each_linked_rlib_for_lto : & [ PathBuf ] ,
284
287
modules : Vec < ( String , ThinBuffer ) > ,
285
288
cached_modules : Vec < ( SerializedModule < ModuleBuffer > , WorkProduct ) > ,
286
289
) -> Result < ( Vec < ThinModule < GccCodegenBackend > > , Vec < WorkProduct > ) , FatalError > {
287
290
let dcx = cgcx. create_dcx ( ) ;
288
291
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) ?;
290
293
if cgcx. opts . cg . linker_plugin_lto . enabled ( ) {
291
294
unreachable ! (
292
295
"We should never reach this case if the LTO step \
0 commit comments