@@ -333,7 +333,7 @@ pub struct CodegenContext {
333333 pub no_landing_pads : bool ,
334334 pub save_temps : bool ,
335335 pub fewer_names : bool ,
336- pub exported_symbols : Arc < ExportedSymbols > ,
336+ pub exported_symbols : Option < Arc < ExportedSymbols > > ,
337337 pub opts : Arc < config:: Options > ,
338338 pub crate_types : Vec < config:: CrateType > ,
339339 pub each_linked_rlib_for_lto : Vec < ( CrateNum , PathBuf ) > ,
@@ -1394,14 +1394,25 @@ fn start_executing_work(tcx: TyCtxt,
13941394 allocator_config : Arc < ModuleConfig > )
13951395 -> thread:: JoinHandle < Result < CompiledModules , ( ) > > {
13961396 let coordinator_send = tcx. tx_to_llvm_workers . clone ( ) ;
1397- let mut exported_symbols = FxHashMap ( ) ;
1398- exported_symbols. insert ( LOCAL_CRATE , tcx. exported_symbols ( LOCAL_CRATE ) ) ;
1399- for & cnum in tcx. crates ( ) . iter ( ) {
1400- exported_symbols. insert ( cnum, tcx. exported_symbols ( cnum) ) ;
1401- }
1402- let exported_symbols = Arc :: new ( exported_symbols) ;
14031397 let sess = tcx. sess ;
14041398
1399+ let exported_symbols = match sess. lto ( ) {
1400+ Lto :: No => None ,
1401+ Lto :: ThinLocal => {
1402+ let mut exported_symbols = FxHashMap ( ) ;
1403+ exported_symbols. insert ( LOCAL_CRATE , tcx. exported_symbols ( LOCAL_CRATE ) ) ;
1404+ Some ( Arc :: new ( exported_symbols) )
1405+ }
1406+ Lto :: Yes | Lto :: Fat | Lto :: Thin => {
1407+ let mut exported_symbols = FxHashMap ( ) ;
1408+ exported_symbols. insert ( LOCAL_CRATE , tcx. exported_symbols ( LOCAL_CRATE ) ) ;
1409+ for & cnum in tcx. crates ( ) . iter ( ) {
1410+ exported_symbols. insert ( cnum, tcx. exported_symbols ( cnum) ) ;
1411+ }
1412+ Some ( Arc :: new ( exported_symbols) )
1413+ }
1414+ } ;
1415+
14051416 // First up, convert our jobserver into a helper thread so we can use normal
14061417 // mpsc channels to manage our messages and such.
14071418 // After we've requested tokens then we'll, when we can,
0 commit comments