@@ -68,10 +68,6 @@ pub enum BitcodeSection {
68
68
// No bitcode section.
69
69
None ,
70
70
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
-
75
71
// A full, uncompressed bitcode section.
76
72
Full ,
77
73
}
@@ -148,16 +144,8 @@ impl ModuleConfig {
148
144
|| sess. opts . cg . linker_plugin_lto . enabled ( )
149
145
{
150
146
EmitObj :: Bitcode
151
- } else if sess. target . target . options . forces_embed_bitcode {
147
+ } else if need_bitcode_in_object ( sess) {
152
148
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
- }
161
149
} else {
162
150
EmitObj :: ObjectCode ( BitcodeSection :: None )
163
151
} ;
@@ -376,10 +364,12 @@ pub struct CompiledModules {
376
364
pub allocator_module : Option < CompiledModule > ,
377
365
}
378
366
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
381
369
&& 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
383
373
}
384
374
385
375
fn need_pre_lto_bitcode_for_incr_comp ( sess : & Session ) -> bool {
0 commit comments