@@ -231,15 +231,22 @@ coverage measurement. Its use is not recommended.
231
231
232
232
## link-self-contained
233
233
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
235
+ of those in the system. This allows overriding cases when detection fails or user wants to use shipped
236
+ libraries.
237
+
238
+ You can enable or disable the usage of any self-contained objects using one of the following values:
237
239
238
240
* no value: rustc will use heuristic to disable self-contained mode if system has necessary tools.
239
241
* ` y ` , ` yes ` , ` on ` , ` true ` : use only libraries/objects shipped with Rust.
240
242
* ` n ` , ` no ` , ` off ` or ` false ` : rely on the user or the linker to provide non-Rust libraries/objects.
241
243
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 objects in a more granular way.
245
+ You can pass a comma-separated list of self-contained objects, individually enabled (` +object ` ) or
246
+ disabled (` -object ` ).
247
+
248
+ Currently, only the ` linker ` granular option is stabilized:
249
+ - ` linker ` : toggle the usage of self-contained linker objects (linker, dlltool, and their necessary libraries)
243
250
244
251
## linker
245
252
@@ -248,6 +255,25 @@ path to the linker executable. If this flag is not specified, the linker will
248
255
be inferred based on the target. See also the [ linker-flavor] ( #linker-flavor )
249
256
flag for another way to specify the linker.
250
257
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
+
251
277
## linker-flavor
252
278
253
279
This flag controls the linker flavor used by ` rustc ` . If a linker is given with
0 commit comments