@@ -68,10 +68,6 @@ pub enum BitcodeSection {
6868    // No bitcode section. 
6969    None , 
7070
71-     // An empty bitcode section (to placate tools such as the iOS linker that 
72-     // require this section even if they don't use it). 
73-     Marker , 
74- 
7571    // A full, uncompressed bitcode section. 
7672    Full , 
7773} 
@@ -148,16 +144,8 @@ impl ModuleConfig {
148144            || sess. opts . cg . linker_plugin_lto . enabled ( ) 
149145        { 
150146            EmitObj :: Bitcode 
151-         }  else  if  sess. target . target . options . forces_embed_bitcode  { 
147+         }  else  if  need_bitcode_in_object ( sess)  { 
152148            EmitObj :: ObjectCode ( BitcodeSection :: Full ) 
153-         }  else  if  need_crate_bitcode_for_rlib ( sess)  { 
154-             let  force_full = need_crate_bitcode_for_rlib ( sess) ; 
155-             match  sess. opts . optimize  { 
156-                 config:: OptLevel :: No  | config:: OptLevel :: Less  if  !force_full => { 
157-                     EmitObj :: ObjectCode ( BitcodeSection :: Marker ) 
158-                 } 
159-                 _ => EmitObj :: ObjectCode ( BitcodeSection :: Full ) , 
160-             } 
161149        }  else  { 
162150            EmitObj :: ObjectCode ( BitcodeSection :: None ) 
163151        } ; 
@@ -376,10 +364,12 @@ pub struct CompiledModules {
376364    pub  allocator_module :  Option < CompiledModule > , 
377365} 
378366
379- fn  need_crate_bitcode_for_rlib ( sess :  & Session )  -> bool  { 
380-     sess. opts . cg . embed_bitcode 
367+ fn  need_bitcode_in_object ( sess :  & Session )  -> bool  { 
368+     let  requested_for_rlib =  sess. opts . cg . embed_bitcode 
381369        && sess. crate_types . borrow ( ) . contains ( & CrateType :: Rlib ) 
382-         && sess. opts . output_types . contains_key ( & OutputType :: Exe ) 
370+         && sess. opts . output_types . contains_key ( & OutputType :: Exe ) ; 
371+     let  forced_by_target = sess. target . target . options . forces_embed_bitcode ; 
372+     requested_for_rlib || forced_by_target
383373} 
384374
385375fn  need_pre_lto_bitcode_for_incr_comp ( sess :  & Session )  -> bool  { 
0 commit comments