@@ -62,24 +62,40 @@ the linker.
6262
6363## embed-bitcode
6464
65- This flag controls whether or not the compiler puts LLVM bitcode into generated
66- rlibs . It takes one of the following values:
65+ This flag controls whether or not the compiler embeds LLVM bitcode into object
66+ files . It takes one of the following values:
6767
6868* ` y ` , ` yes ` , ` on ` , or no value: put bitcode in rlibs (the default).
6969* ` n ` , ` no ` , or ` off ` : omit bitcode from rlibs.
7070
71- LLVM bitcode is only needed when link-time optimization (LTO) is being
72- performed, but it is enabled by default for backwards compatibility reasons.
71+ LLVM bitcode is required when rustc is performing link-time optimization (LTO).
72+ It is also required on some targets like iOS ones where vendors look for LLVM
73+ bitcode. Embedded bitcode will appear in rustc-generated object files inside of
74+ a section whose name is defined by the target platform. Most of the time this is
75+ ` .llvmbc ` .
7376
7477The use of ` -C embed-bitcode=no ` can significantly improve compile times and
75- reduce generated file sizes. For these reasons, Cargo uses `-C
76- embed-bitcode=no` whenever possible. Likewise, if you are building directly
77- with ` rustc ` we recommend using ` -C embed-bitcode=no ` whenever you are not
78- using LTO.
78+ reduce generated file sizes if your compilation does not actually need bitcode
79+ (e.g. if you're not compiling for iOS or you're not performing LTO). For these
80+ reasons, Cargo uses ` -C embed-bitcode=no ` whenever possible. Likewise, if you
81+ are building directly with ` rustc ` we recommend using ` -C embed-bitcode=no `
82+ whenever you are not using LTO.
7983
8084If combined with ` -C lto ` , ` -C embed-bitcode=no ` will cause ` rustc ` to abort
8185at start-up, because the combination is invalid.
8286
87+ > ** Note** : if you're building Rust code with LTO then you probably don't even
88+ > need the ` embed-bitcode ` option turned on. You'll likely want to use
89+ > ` -Clinker-plugin-lto ` instead which skips generating object files entirely and
90+ > simply replaces object files with LLVM bitcode. The only purpose for
91+ > ` -Cembed-bitcode ` is when you're generating an rlib that is both being used
92+ > with and without LTO. For example Rust's standard library ships with embedded
93+ > bitcode since users link to it both with and without LTO.
94+ >
95+ > This also may make you wonder why the default is ` yes ` for this option. The
96+ > reason for that is that it's how it was for rustc 1.44 and prior. In 1.45 this
97+ > option was added to turn off what had always been the default.
98+
8399## extra-filename
84100
85101This option allows you to put extra data in each output filename. It takes a
@@ -98,6 +114,18 @@ values:
98114The default behaviour, if frame pointers are not force-enabled, depends on the
99115target.
100116
117+ ## force-unwind-tables
118+
119+ This flag forces the generation of unwind tables. It takes one of the following
120+ values:
121+
122+ * ` y ` , ` yes ` , ` on ` , or no value: Unwind tables are forced to be generated.
123+ * ` n ` , ` no ` , or ` off ` : Unwind tables are not forced to be generated. If unwind
124+ tables are required by the target or ` -C panic=unwind ` , an error will be
125+ emitted.
126+
127+ The default if not specified depends on the target.
128+
101129## incremental
102130
103131This flag allows you to enable incremental compilation, which allows ` rustc `
@@ -187,6 +215,18 @@ the following values:
187215* ` n ` , ` no ` , or ` off ` : disable linker plugin LTO (the default).
188216* A path to the linker plugin.
189217
218+ More specifically this flag will cause the compiler to replace its typical
219+ object file output with LLVM bitcode files. For example an rlib produced with
220+ ` -Clinker-plugin-lto ` will still have ` *.o ` files in it, but they'll all be LLVM
221+ bitcode instead of actual machine code. It is expected that the native platform
222+ linker is capable of loading these LLVM bitcode files and generating code at
223+ link time (typically after performing optimizations).
224+
225+ Note that rustc can also read its own object files produced with
226+ ` -Clinker-plugin-lto ` . If an rlib is only ever going to get used later with a
227+ ` -Clto ` compilation then you can pass ` -Clinker-plugin-lto ` to speed up
228+ compilation and avoid generating object files that aren't used.
229+
190230## llvm-args
191231
192232This flag can be used to pass a list of arguments directly to LLVM.
0 commit comments