[−][src]Function rustc_codegen_llvm::back::write::embed_bitcode
unsafe fn embed_bitcode(
cgcx: &CodegenContext,
llcx: &Context,
llmod: &Module,
bitcode: Option<&[u8]>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Embed the bitcode of an LLVM module in the LLVM module itself.
This is done primarily for iOS where it appears to be standard to compile C
code at least with -fembed-bitcode
which creates two sections in the
executable:
- __LLVM,__bitcode
- __LLVM,__cmdline
It appears both of these sections are necessary to get the linker to recognize what's going on. For us though we just always throw in an empty cmdline section.
Furthermore debug/O1 builds don't actually embed bitcode but rather just embed an empty section.
Basically all of this is us attempting to follow in the footsteps of clang on iOS. See #35968 for lots more info.