@@ -231,15 +231,22 @@ coverage measurement. Its use is not recommended.
231231
232232## link-self-contained
233233
234- On ` windows-gnu ` , ` linux-musl ` , and ` wasi ` targets, this flag controls whether the
235- linker will use libraries and objects shipped with Rust instead of those in the system.
236- It takes one of the following values:
234+ This flag controls whether the linker will use libraries and objects shipped with Rust instead of
235+ those in the system. It also controls which binary is used for the linker itself. This allows
236+ overriding cases when detection fails or the user wants to use shipped libraries.
237+
238+ You can enable or disable the usage of any self-contained components using one of the following values:
237239
238240* no value: rustc will use heuristic to disable self-contained mode if system has necessary tools.
239241* ` y ` , ` yes ` , ` on ` , ` true ` : use only libraries/objects shipped with Rust.
240242* ` n ` , ` no ` , ` off ` or ` false ` : rely on the user or the linker to provide non-Rust libraries/objects.
241243
242- This allows overriding cases when detection fails or user wants to use shipped libraries.
244+ It is also possible to enable or disable specific self-contained components in a more granular way.
245+ You can pass a comma-separated list of self-contained components, individually enabled
246+ (` +component ` ) or disabled (` -component ` ).
247+
248+ Currently, only the ` linker ` granular option is stabilized:
249+ - ` linker ` : toggle the usage of self-contained linker binaries (linker, dlltool, and their necessary libraries)
243250
244251## linker
245252
@@ -248,6 +255,25 @@ path to the linker executable. If this flag is not specified, the linker will
248255be inferred based on the target. See also the [ linker-flavor] ( #linker-flavor )
249256flag for another way to specify the linker.
250257
258+ ## linker-features
259+
260+ The ` -Clinker-features ` flag allows enabling or disabling specific features used during linking.
261+
262+ These feature flags are a flexible extension mechanism that is complementary to linker flavors,
263+ designed to avoid the combinatorial explosion of having to create a new set of flavors for each
264+ linker feature we'd want to use.
265+
266+ The flag accepts a comma-separated list of features, individually enabled (` +feature ` ) or disabled
267+ (` -feature ` ).
268+
269+ Currently only one is stable, and only on the ` x86_64-unknown-linux-gnu ` target:
270+ - ` lld ` : to toggle using the lld linker, either the system-installed binary, or the self-contained
271+ ` rust-lld ` linker (via the ` -Clink-self-contained=+linker ` flag).
272+
273+ For example, use:
274+ - ` -Clinker-features=+lld ` to opt in to using the ` lld ` linker
275+ - ` -Clinker-features=-lld ` to opt out instead, for targets where it is configured as the default linker
276+
251277## linker-flavor
252278
253279This flag controls the linker flavor used by ` rustc ` . If a linker is given with
0 commit comments