Force embed-bitcode on non-simulator iOS/tvOS targets
At this time Apple recommends Bitcode be included for iOS apps, and requires it for tvOS. It is unlikely that a developer would want to disable bitcode when building for these targets, yet by default it will not be generated. This presents a papercut for developers on those platforms. Introduces a new TargetOption boolean key for specific triples to indicate that bitcode should be generated, even if cargo attempts to optimise with -Cembed-bitcode=no.
This commit is contained in:
parent
43271a39ad
commit
342aad1d1b
4 changed files with 9 additions and 0 deletions
|
@ -147,6 +147,8 @@ impl ModuleConfig {
|
|||
|| sess.opts.cg.linker_plugin_lto.enabled()
|
||||
{
|
||||
EmitObj::Bitcode
|
||||
} else if sess.target.target.options.forces_embed_bitcode {
|
||||
EmitObj::ObjectCode(BitcodeSection::Full)
|
||||
} else if need_crate_bitcode_for_rlib(sess) {
|
||||
let force_full = need_crate_bitcode_for_rlib(sess);
|
||||
match sess.opts.optimize {
|
||||
|
|
|
@ -19,6 +19,7 @@ pub fn target() -> TargetResult {
|
|||
eliminate_frame_pointer: false,
|
||||
max_atomic_width: Some(128),
|
||||
abi_blacklist: super::arm_base::abi_blacklist(),
|
||||
forces_embed_bitcode: true,
|
||||
..base
|
||||
},
|
||||
})
|
||||
|
|
|
@ -19,6 +19,7 @@ pub fn target() -> TargetResult {
|
|||
eliminate_frame_pointer: false,
|
||||
max_atomic_width: Some(128),
|
||||
abi_blacklist: super::arm_base::abi_blacklist(),
|
||||
forces_embed_bitcode: true,
|
||||
..base
|
||||
},
|
||||
})
|
||||
|
|
|
@ -783,6 +783,8 @@ pub struct TargetOptions {
|
|||
// If we give emcc .o files that are actually .bc files it
|
||||
// will 'just work'.
|
||||
pub obj_is_bitcode: bool,
|
||||
/// Whether the target requires that emitted object code includes bitcode.
|
||||
pub forces_embed_bitcode: bool,
|
||||
|
||||
/// Don't use this field; instead use the `.min_atomic_width()` method.
|
||||
pub min_atomic_width: Option<u64>,
|
||||
|
@ -939,6 +941,7 @@ impl Default for TargetOptions {
|
|||
allow_asm: true,
|
||||
has_elf_tls: false,
|
||||
obj_is_bitcode: false,
|
||||
forces_embed_bitcode: false,
|
||||
min_atomic_width: None,
|
||||
max_atomic_width: None,
|
||||
atomic_cas: true,
|
||||
|
@ -1278,6 +1281,7 @@ impl Target {
|
|||
key!(main_needs_argc_argv, bool);
|
||||
key!(has_elf_tls, bool);
|
||||
key!(obj_is_bitcode, bool);
|
||||
key!(forces_embed_bitcode, bool);
|
||||
key!(max_atomic_width, Option<u64>);
|
||||
key!(min_atomic_width, Option<u64>);
|
||||
key!(atomic_cas, bool);
|
||||
|
@ -1505,6 +1509,7 @@ impl ToJson for Target {
|
|||
target_option_val!(main_needs_argc_argv);
|
||||
target_option_val!(has_elf_tls);
|
||||
target_option_val!(obj_is_bitcode);
|
||||
target_option_val!(forces_embed_bitcode);
|
||||
target_option_val!(min_atomic_width);
|
||||
target_option_val!(max_atomic_width);
|
||||
target_option_val!(atomic_cas);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue