@@ -341,7 +341,6 @@ pub struct CodegenContext<B: WriteBackendMethods> {
341341 pub opts : Arc < config:: Options > ,
342342 pub crate_types : Vec < CrateType > ,
343343 pub each_linked_rlib_for_lto : Vec < ( CrateNum , PathBuf ) > ,
344- pub exported_symbols_for_lto : Arc < Vec < String > > ,
345344 pub output_filenames : Arc < OutputFilenames > ,
346345 pub invocation_temp : Option < String > ,
347346 pub regular_module_config : Arc < ModuleConfig > ,
@@ -396,13 +395,15 @@ impl<B: WriteBackendMethods> CodegenContext<B> {
396395
397396fn generate_thin_lto_work < B : ExtraBackendMethods > (
398397 cgcx : & CodegenContext < B > ,
398+ exported_symbols_for_lto : & [ String ] ,
399399 needs_thin_lto : Vec < ( String , B :: ThinBuffer ) > ,
400400 import_only_modules : Vec < ( SerializedModule < B :: ModuleBuffer > , WorkProduct ) > ,
401401) -> Vec < ( WorkItem < B > , u64 ) > {
402402 let _prof_timer = cgcx. prof . generic_activity ( "codegen_thin_generate_lto_work" ) ;
403403
404404 let ( lto_modules, copy_jobs) =
405- B :: run_thin_lto ( cgcx, needs_thin_lto, import_only_modules) . unwrap_or_else ( |e| e. raise ( ) ) ;
405+ B :: run_thin_lto ( cgcx, exported_symbols_for_lto, needs_thin_lto, import_only_modules)
406+ . unwrap_or_else ( |e| e. raise ( ) ) ;
406407 lto_modules
407408 . into_iter ( )
408409 . map ( |module| {
@@ -718,6 +719,7 @@ pub(crate) enum WorkItem<B: WriteBackendMethods> {
718719 CopyPostLtoArtifacts ( CachedModuleCodegen ) ,
719720 /// Performs fat LTO on the given module.
720721 FatLto {
722+ exported_symbols_for_lto : Arc < Vec < String > > ,
721723 needs_fat_lto : Vec < FatLtoInput < B > > ,
722724 import_only_modules : Vec < ( SerializedModule < B :: ModuleBuffer > , WorkProduct ) > ,
723725 autodiff : Vec < AutoDiffItem > ,
@@ -990,6 +992,7 @@ fn execute_copy_from_cache_work_item<B: ExtraBackendMethods>(
990992
991993fn execute_fat_lto_work_item < B : ExtraBackendMethods > (
992994 cgcx : & CodegenContext < B > ,
995+ exported_symbols_for_lto : & [ String ] ,
993996 mut needs_fat_lto : Vec < FatLtoInput < B > > ,
994997 import_only_modules : Vec < ( SerializedModule < B :: ModuleBuffer > , WorkProduct ) > ,
995998 autodiff : Vec < AutoDiffItem > ,
@@ -999,7 +1002,8 @@ fn execute_fat_lto_work_item<B: ExtraBackendMethods>(
9991002 needs_fat_lto. push ( FatLtoInput :: Serialized { name : wp. cgu_name , buffer : module } )
10001003 }
10011004
1002- let module = B :: run_and_optimize_fat_lto ( cgcx, needs_fat_lto, autodiff) ?;
1005+ let module =
1006+ B :: run_and_optimize_fat_lto ( cgcx, exported_symbols_for_lto, needs_fat_lto, autodiff) ?;
10031007 let module = B :: codegen ( cgcx, module, module_config) ?;
10041008 Ok ( WorkItemResult :: Finished ( module) )
10051009}
@@ -1160,7 +1164,6 @@ fn start_executing_work<B: ExtraBackendMethods>(
11601164 let cgcx = CodegenContext :: < B > {
11611165 crate_types : tcx. crate_types ( ) . to_vec ( ) ,
11621166 each_linked_rlib_for_lto,
1163- exported_symbols_for_lto,
11641167 lto : sess. lto ( ) ,
11651168 fewer_names : sess. fewer_names ( ) ,
11661169 save_temps : sess. opts . cg . save_temps ,
@@ -1441,6 +1444,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
14411444
14421445 work_items. push ( (
14431446 WorkItem :: FatLto {
1447+ exported_symbols_for_lto : Arc :: clone ( & exported_symbols_for_lto) ,
14441448 needs_fat_lto,
14451449 import_only_modules,
14461450 autodiff : autodiff_items. clone ( ) ,
@@ -1456,9 +1460,12 @@ fn start_executing_work<B: ExtraBackendMethods>(
14561460 dcx. handle ( ) . emit_fatal ( AutodiffWithoutLto { } ) ;
14571461 }
14581462
1459- for ( work, cost) in
1460- generate_thin_lto_work ( & cgcx, needs_thin_lto, import_only_modules)
1461- {
1463+ for ( work, cost) in generate_thin_lto_work (
1464+ & cgcx,
1465+ & exported_symbols_for_lto,
1466+ needs_thin_lto,
1467+ import_only_modules,
1468+ ) {
14621469 let insertion_index = work_items
14631470 . binary_search_by_key ( & cost, |& ( _, cost) | cost)
14641471 . unwrap_or_else ( |e| e) ;
@@ -1797,12 +1804,18 @@ fn spawn_work<'a, B: ExtraBackendMethods>(
17971804 ) ;
17981805 Ok ( execute_copy_from_cache_work_item ( & cgcx, m, module_config) )
17991806 }
1800- WorkItem :: FatLto { needs_fat_lto, import_only_modules, autodiff } => {
1807+ WorkItem :: FatLto {
1808+ exported_symbols_for_lto,
1809+ needs_fat_lto,
1810+ import_only_modules,
1811+ autodiff,
1812+ } => {
18011813 let _timer = cgcx
18021814 . prof
18031815 . generic_activity_with_arg ( "codegen_module_perform_lto" , "everything" ) ;
18041816 execute_fat_lto_work_item (
18051817 & cgcx,
1818+ & exported_symbols_for_lto,
18061819 needs_fat_lto,
18071820 import_only_modules,
18081821 autodiff,
0 commit comments