@@ -326,10 +326,12 @@ pub struct CodegenContext<B: WriteBackendMethods> {
326326 // Resources needed when running LTO
327327 pub prof : SelfProfilerRef ,
328328 pub lto : Lto ,
329+ pub use_linker_plugin_lto : bool ,
330+ pub dylib_lto : bool ,
331+ pub prefer_dynamic : bool ,
329332 pub save_temps : bool ,
330333 pub fewer_names : bool ,
331334 pub time_trace : bool ,
332- pub opts : Arc < config:: Options > ,
333335 pub crate_types : Vec < CrateType > ,
334336 pub output_filenames : Arc < OutputFilenames > ,
335337 pub invocation_temp : Option < String > ,
@@ -796,13 +798,12 @@ pub(crate) enum ComputedLtoType {
796798
797799pub ( crate ) fn compute_per_cgu_lto_type (
798800 sess_lto : & Lto ,
799- opts : & config :: Options ,
801+ linker_does_lto : bool ,
800802 sess_crate_types : & [ CrateType ] ,
801803) -> ComputedLtoType {
802804 // If the linker does LTO, we don't have to do it. Note that we
803805 // keep doing full LTO, if it is requested, as not to break the
804806 // assumption that the output will be a single module.
805- let linker_does_lto = opts. cg . linker_plugin_lto . enabled ( ) ;
806807
807808 // We ignore a request for full crate graph LTO if the crate type
808809 // is only an rlib, as there is no full crate graph to process,
@@ -838,7 +839,8 @@ fn execute_optimize_work_item<B: ExtraBackendMethods>(
838839 // back to the coordinator thread for further LTO processing (which
839840 // has to wait for all the initial modules to be optimized).
840841
841- let lto_type = compute_per_cgu_lto_type ( & cgcx. lto , & cgcx. opts , & cgcx. crate_types ) ;
842+ let lto_type =
843+ compute_per_cgu_lto_type ( & cgcx. lto , cgcx. use_linker_plugin_lto , & cgcx. crate_types ) ;
842844
843845 // If we're doing some form of incremental LTO then we need to be sure to
844846 // save our module to disk first.
@@ -1279,10 +1281,12 @@ fn start_executing_work<B: ExtraBackendMethods>(
12791281 let cgcx = CodegenContext :: < B > {
12801282 crate_types : tcx. crate_types ( ) . to_vec ( ) ,
12811283 lto : sess. lto ( ) ,
1284+ use_linker_plugin_lto : sess. opts . cg . linker_plugin_lto . enabled ( ) ,
1285+ dylib_lto : sess. opts . unstable_opts . dylib_lto ,
1286+ prefer_dynamic : sess. opts . cg . prefer_dynamic ,
12821287 fewer_names : sess. fewer_names ( ) ,
12831288 save_temps : sess. opts . cg . save_temps ,
12841289 time_trace : sess. opts . unstable_opts . llvm_time_trace ,
1285- opts : Arc :: new ( sess. opts . clone ( ) ) ,
12861290 prof : sess. prof . clone ( ) ,
12871291 remark : sess. opts . cg . remark . clone ( ) ,
12881292 remark_dir,
0 commit comments