Skip to content

Commit 2cb937d

Browse files
committed
Update documentation
1 parent 8168431 commit 2cb937d

File tree

3 files changed

+29
-8
lines changed

3 files changed

+29
-8
lines changed

src/doc/rustc/src/codegen-options/index.md

+25-4
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,22 @@ coverage measurement. Its use is not recommended.
218218

219219
## link-self-contained
220220

221-
On `windows-gnu`, `linux-musl`, and `wasi` targets, this flag controls whether the
222-
linker will use libraries and objects shipped with Rust instead of those in the system.
223-
It takes one of the following values:
221+
This flag controls whether the linker will use libraries and objects shipped with Rust instead
222+
of those in the system. This allows overriding cases when detection fails or user wants to use shipped
223+
libraries.
224+
225+
You can enable or disable the usage of any self-contained objects using one of the following values:
224226

225227
* no value: rustc will use heuristic to disable self-contained mode if system has necessary tools.
226228
* `y`, `yes`, `on`, `true`: use only libraries/objects shipped with Rust.
227229
* `n`, `no`, `off` or `false`: rely on the user or the linker to provide non-Rust libraries/objects.
228230

229-
This allows overriding cases when detection fails or user wants to use shipped libraries.
231+
It is also possible to enable or disable specific self-contained objects in a more granular way.
232+
You can pass a comma-separated list of self-contained objects, individually enabled (`+object`) or
233+
disabled (`-object`).
234+
235+
Currently, only the `linker` granular option is stabilized:
236+
- `linker`: toggle the usage of self-contained linker objects (linker, dlltool, and their necessary libraries)
230237

231238
## linker
232239

@@ -235,6 +242,20 @@ path to the linker executable. If this flag is not specified, the linker will
235242
be inferred based on the target. See also the [linker-flavor](#linker-flavor)
236243
flag for another way to specify the linker.
237244

245+
## linker-features
246+
247+
This flag allows enabling or disabling specific features used during linking.
248+
249+
The flag accepts a comma-separated list of features, individually enabled (`+feature`) or disabled
250+
(`-feature`).
251+
252+
Currently, only one such feature is stable:
253+
- `lld`: toggles the usage of the lld linker, either the system-installed binary, or the self-contained
254+
`rust-lld` linker.
255+
256+
If you want to opt out of the usage of the `lld` linker (for targets where it is configured as the default linker),
257+
use `-Clinker-features=-lld`.
258+
238259
## linker-flavor
239260

240261
This flag controls the linker flavor used by `rustc`. If a linker is given with

src/doc/unstable-book/src/compiler-flags/codegen-options.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ instead of those in the system. The stable boolean values for this flag are coar
5151
- `mingw`: other MinGW libs and Windows import libs
5252

5353
Out of the above self-contained linking components, `linker` is the only one currently implemented
54-
(beyond parsing the CLI options).
54+
(beyond parsing the CLI options) and stabilized.
5555

5656
It refers to the LLD linker, built from the same LLVM revision used by rustc (named `rust-lld` to
5757
avoid naming conflicts), that is distributed via `rustup` with the compiler (and is used by default
58-
for the wasm targets). One can also opt-in to use it by combining this flag with an appropriate
58+
for the wasm targets). One can also opt in to use it by combining this flag with an appropriate
5959
linker flavor: for example, `-Clinker-flavor=gnu-lld-cc -Clink-self-contained=+linker` will use the
6060
toolchain's `rust-lld` as the linker.

src/doc/unstable-book/src/compiler-flags/linker-features.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
--------------------
44

5-
The `-Zlinker-features` compiler flag allows enabling or disabling specific features used during
6-
linking, and is intended to be stabilized under the codegen options as `-Clinker-features`.
5+
The `-Clinker-features` compiler flag allows enabling or disabling specific features used during
6+
linking.
77

88
These feature flags are a flexible extension mechanism that is complementary to linker flavors,
99
designed to avoid the combinatorial explosion of having to create a new set of flavors for each

0 commit comments

Comments
 (0)