@@ -333,7 +333,7 @@ pub struct CodegenContext {
333
333
pub no_landing_pads : bool ,
334
334
pub save_temps : bool ,
335
335
pub fewer_names : bool ,
336
- pub exported_symbols : Arc < ExportedSymbols > ,
336
+ pub exported_symbols : Option < Arc < ExportedSymbols > > ,
337
337
pub opts : Arc < config:: Options > ,
338
338
pub crate_types : Vec < config:: CrateType > ,
339
339
pub each_linked_rlib_for_lto : Vec < ( CrateNum , PathBuf ) > ,
@@ -1394,14 +1394,25 @@ fn start_executing_work(tcx: TyCtxt,
1394
1394
allocator_config : Arc < ModuleConfig > )
1395
1395
-> thread:: JoinHandle < Result < CompiledModules , ( ) > > {
1396
1396
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) ;
1403
1397
let sess = tcx. sess ;
1404
1398
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
+
1405
1416
// First up, convert our jobserver into a helper thread so we can use normal
1406
1417
// mpsc channels to manage our messages and such.
1407
1418
// After we've requested tokens then we'll, when we can,
0 commit comments