diff options
| author | DianQK <dianqk@dianqk.net> | 2024-11-20 22:45:32 +0800 |
|---|---|---|
| committer | DianQK <dianqk@dianqk.net> | 2024-11-24 15:51:47 +0800 |
| commit | 3a23669787db1e43a8bea7d71337f31325d00305 (patch) | |
| tree | 9cf5f409b83ffb4133dac3269e307e95db4543c3 | |
| parent | 0b1bf71a71c2a1d34c212285362530ec2c4e4775 (diff) | |
| download | rust-3a23669787db1e43a8bea7d71337f31325d00305.tar.gz rust-3a23669787db1e43a8bea7d71337f31325d00305.zip | |
embed-bitcode is no longer used in iOS
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/back/write.rs | 19 | ||||
| -rw-r--r-- | src/doc/rustc/src/codegen-options/index.md | 13 |
2 files changed, 6 insertions, 26 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index a65ae4df1e3..00f7b479fa7 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -955,24 +955,7 @@ pub(crate) fn bitcode_section_name(cgcx: &CodegenContext<LlvmCodegenBackend>) -> } } -/// 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. A suitable cmdline value is taken from the -/// target spec. -/// -/// 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. +/// Embed the bitcode of an LLVM module for LTO in the LLVM module itself. unsafe fn embed_bitcode( cgcx: &CodegenContext<LlvmCodegenBackend>, llcx: &llvm::Context, diff --git a/src/doc/rustc/src/codegen-options/index.md b/src/doc/rustc/src/codegen-options/index.md index cb43feca758..e987d06b0f3 100644 --- a/src/doc/rustc/src/codegen-options/index.md +++ b/src/doc/rustc/src/codegen-options/index.md @@ -119,17 +119,14 @@ files. It takes one of the following values: * `n`, `no`, `off` or `false`: omit bitcode from rlibs. LLVM bitcode is required when rustc is performing link-time optimization (LTO). -It is also required on some targets like iOS ones where vendors look for LLVM -bitcode. Embedded bitcode will appear in rustc-generated object files inside of -a section whose name is defined by the target platform. Most of the time this is -`.llvmbc`. +Embedded bitcode will appear in rustc-generated object files inside of a section +whose name is defined by the target platform. Most of the time this is `.llvmbc`. The use of `-C embed-bitcode=no` can significantly improve compile times and reduce generated file sizes if your compilation does not actually need bitcode -(e.g. if you're not compiling for iOS or you're not performing LTO). For these -reasons, Cargo uses `-C embed-bitcode=no` whenever possible. Likewise, if you -are building directly with `rustc` we recommend using `-C embed-bitcode=no` -whenever you are not using LTO. +(e.g. if you're not performing LTO). For these reasons, Cargo uses `-C embed-bitcode=no` +whenever possible. Likewise, if you are building directly with `rustc` we recommend +using `-C embed-bitcode=no` whenever you are not using LTO. If combined with `-C lto`, `-C embed-bitcode=no` will cause `rustc` to abort at start-up, because the combination is invalid. |
