File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -333,9 +333,17 @@ fn make_module(sess: &Session, name: String) -> UnwindModule<ObjectModule> {
333333
334334    let  mut  builder =
335335        ObjectBuilder :: new ( isa,  name + ".o" ,  cranelift_module:: default_libcall_names ( ) ) . unwrap ( ) ; 
336+ 
337+     // Disable function sections by default on MSVC as it causes significant slowdowns with link.exe. 
338+     // Maybe link.exe has exponential behavior when there are many sections with the same name? Also 
339+     // explicitly disable it on MinGW as rustc already disables it by default on MinGW and as such 
340+     // isn't tested. If rustc enables it in the future on MinGW, we can re-enable it too once it has 
341+     // been on MinGW. 
342+     let  default_function_sections = sess. target . function_sections  && !sess. target . is_like_windows ; 
336343    builder. per_function_section ( 
337-         sess. opts . unstable_opts . function_sections . unwrap_or ( sess . target . function_sections ) , 
344+         sess. opts . unstable_opts . function_sections . unwrap_or ( default_function_sections ) , 
338345    ) ; 
346+ 
339347    UnwindModule :: new ( ObjectModule :: new ( builder) ,  true ) 
340348} 
341349
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments