Skip to content

Commit 38d9265

Browse files
committed
Clarify lto setting passing -Clinker-plugin-lto
Previously this document implied that the `lto` setting only controlled `-C lto` but in some cases it can also pass `-C linker-plugin-lto` https://github.com/rust-lang/cargo/blob/1b3eb297f946779b1ede257074afff62d854ff79/src/cargo/core/compiler/mod.rs#L1234
1 parent 1b3eb29 commit 38d9265

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/doc/src/reference/profiles.md

+10-5
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,10 @@ The valid options are:
155155

156156
#### lto
157157

158-
The `lto` setting controls the [`-C lto` flag] which controls LLVM's [link
159-
time optimizations]. LTO can produce better optimized code, using
160-
whole-program analysis, at the cost of longer linking time.
158+
The `lto` setting controls `rustc`'s [`-C lto`], [`-C linker-plugin-lto`], and
159+
[`-C embed-bitcode`] options, which control LLVM's [link time optimizations].
160+
LTO can produce better optimized code, using whole-program analysis, at the cost
161+
of longer linking time.
161162

162163
The valid options are:
163164

@@ -171,11 +172,15 @@ The valid options are:
171172
similar to "fat".
172173
* `"off"`: Disables LTO.
173174

174-
See also the [`-C linker-plugin-lto`] `rustc` flag for cross-language LTO.
175+
See the [linker-plugin-lto chapter] if you are interested in cross-language LTO.
176+
This is not yet supported natively in Cargo, but can be performed via
177+
`RUSTFLAGS`.
175178

176-
[`-C lto` flag]: ../../rustc/codegen-options/index.html#lto
179+
[`-C lto`]: ../../rustc/codegen-options/index.html#lto
177180
[link time optimizations]: https://llvm.org/docs/LinkTimeOptimization.html
178181
[`-C linker-plugin-lto`]: ../../rustc/codegen-options/index.html#linker-plugin-lto
182+
[`-C embed-bitcode`]: ../../rustc/codegen-options/index.html#embed-bitcode
183+
[linker-plugin-lto chapter]: ../../rustc/linker-plugin-lto.html
179184
["thin" LTO]: http://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html
180185

181186
#### panic

0 commit comments

Comments
 (0)