This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-26
lines changed
compiler/rustc_codegen_llvm/src/back
src/doc/rustc/src/codegen-options Expand file tree Collapse file tree 2 files changed +6
-26
lines changed Original file line number Diff line number Diff line change @@ -955,24 +955,7 @@ pub(crate) fn bitcode_section_name(cgcx: &CodegenContext<LlvmCodegenBackend>) ->
955955 }
956956}
957957
958- /// Embed the bitcode of an LLVM module in the LLVM module itself.
959- ///
960- /// This is done primarily for iOS where it appears to be standard to compile C
961- /// code at least with `-fembed-bitcode` which creates two sections in the
962- /// executable:
963- ///
964- /// * __LLVM,__bitcode
965- /// * __LLVM,__cmdline
966- ///
967- /// It appears *both* of these sections are necessary to get the linker to
968- /// recognize what's going on. A suitable cmdline value is taken from the
969- /// target spec.
970- ///
971- /// Furthermore debug/O1 builds don't actually embed bitcode but rather just
972- /// embed an empty section.
973- ///
974- /// Basically all of this is us attempting to follow in the footsteps of clang
975- /// on iOS. See #35968 for lots more info.
958+ /// Embed the bitcode of an LLVM module for LTO in the LLVM module itself.
976959unsafe fn embed_bitcode (
977960 cgcx : & CodegenContext < LlvmCodegenBackend > ,
978961 llcx : & llvm:: Context ,
Original file line number Diff line number Diff line change @@ -119,17 +119,14 @@ files. It takes one of the following values:
119119* ` n ` , ` no ` , ` off ` or ` false ` : omit bitcode from rlibs.
120120
121121LLVM bitcode is required when rustc is performing link-time optimization (LTO).
122- It is also required on some targets like iOS ones where vendors look for LLVM
123- bitcode. Embedded bitcode will appear in rustc-generated object files inside of
124- a section whose name is defined by the target platform. Most of the time this is
125- ` .llvmbc ` .
122+ Embedded bitcode will appear in rustc-generated object files inside of a section
123+ whose name is defined by the target platform. Most of the time this is ` .llvmbc ` .
126124
127125The use of ` -C embed-bitcode=no ` can significantly improve compile times and
128126reduce generated file sizes if your compilation does not actually need bitcode
129- (e.g. if you're not compiling for iOS or you're not performing LTO). For these
130- reasons, Cargo uses ` -C embed-bitcode=no ` whenever possible. Likewise, if you
131- are building directly with ` rustc ` we recommend using ` -C embed-bitcode=no `
132- whenever you are not using LTO.
127+ (e.g. if you're not performing LTO). For these reasons, Cargo uses ` -C embed-bitcode=no `
128+ whenever possible. Likewise, if you are building directly with ` rustc ` we recommend
129+ using ` -C embed-bitcode=no ` whenever you are not using LTO.
133130
134131If combined with ` -C lto ` , ` -C embed-bitcode=no ` will cause ` rustc ` to abort
135132at start-up, because the combination is invalid.
You can’t perform that action at this time.
0 commit comments