• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Codegen Options
2
3All of these options are passed to `rustc` via the `-C` flag, short for "codegen." You can see
4a version of this list for your exact compiler by running `rustc -C help`.
5
6## ar
7
8This option is deprecated and does nothing.
9
10## code-model
11
12This option lets you choose which code model to use. \
13Code models put constraints on address ranges that the program and its symbols may use. \
14With smaller address ranges machine instructions
15may be able to use more compact addressing modes.
16
17The specific ranges depend on target architectures and addressing modes available to them. \
18For x86 more detailed description of its code models can be found in
19[System V Application Binary Interface](https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-1.0.pdf)
20specification.
21
22Supported values for this option are:
23
24- `tiny` - Tiny code model.
25- `small` - Small code model. This is the default model for majority of supported targets.
26- `kernel` - Kernel code model.
27- `medium` - Medium code model.
28- `large` - Large code model.
29
30Supported values can also be discovered by running `rustc --print code-models`.
31
32## codegen-units
33
34This flag controls the maximum number of code generation units the crate is
35split into. It takes an integer greater than 0.
36
37When a crate is split into multiple codegen units, LLVM is able to process
38them in parallel. Increasing parallelism may speed up compile times, but may
39also produce slower code. Setting this to 1 may improve the performance of
40generated code, but may be slower to compile.
41
42The default value, if not specified, is 16 for non-incremental builds. For
43incremental builds the default is 256 which allows caching to be more granular.
44
45## control-flow-guard
46
47This flag controls whether LLVM enables the Windows [Control Flow
48Guard](https://docs.microsoft.com/en-us/windows/win32/secbp/control-flow-guard)
49platform security feature. This flag is currently ignored for non-Windows targets.
50It takes one of the following values:
51
52* `y`, `yes`, `on`, `true`, `checks`, or no value: enable Control Flow Guard.
53* `nochecks`: emit Control Flow Guard metadata without runtime enforcement checks (this
54should only be used for testing purposes as it does not provide security enforcement).
55* `n`, `no`, `off`, `false`: do not enable Control Flow Guard (the default).
56
57## debug-assertions
58
59This flag lets you turn `cfg(debug_assertions)` [conditional
60compilation](../../reference/conditional-compilation.md#debug_assertions) on
61or off. It takes one of the following values:
62
63* `y`, `yes`, `on`, `true`, or no value: enable debug-assertions.
64* `n`, `no`, `off` or `false`: disable debug-assertions.
65
66If not specified, debug assertions are automatically enabled only if the
67[opt-level](#opt-level) is 0.
68
69## debuginfo
70
71This flag controls the generation of debug information. It takes one of the
72following values:
73
74* `0` or `none`: no debug info at all (the default).
75* `line-directives-only`: line info directives only. For the nvptx* targets this enables [profiling](https://reviews.llvm.org/D46061). For other use cases, `line-tables-only` is the better, more compatible choice.
76* `line-tables-only`: line tables only. Generates the minimal amount of debug info for backtraces with filename/line number info, but not anything else, i.e. no variable or function parameter info.
77* `1` or `limited`: debug info without type or variable-level information.
78* `2` or `full`: full debug info.
79
80Note: The [`-g` flag][option-g-debug] is an alias for `-C debuginfo=2`.
81
82## default-linker-libraries
83
84This flag controls whether or not the linker includes its default libraries.
85It takes one of the following values:
86
87* `y`, `yes`, `on`, `true`: include default libraries.
88* `n`, `no`, `off` or `false` or no value: exclude default libraries (the default).
89
90For example, for gcc flavor linkers, this issues the `-nodefaultlibs` flag to
91the linker.
92
93## dlltool
94
95On `windows-gnu` targets, this flag controls which dlltool `rustc` invokes to
96generate import libraries when using the [`raw-dylib` link kind](../../reference/items/external-blocks.md#the-link-attribute).
97It takes a path to [the dlltool executable](https://sourceware.org/binutils/docs/binutils/dlltool.html).
98If this flag is not specified, a dlltool executable will be inferred based on
99the host environment and target.
100
101## embed-bitcode
102
103This flag controls whether or not the compiler embeds LLVM bitcode into object
104files. It takes one of the following values:
105
106* `y`, `yes`, `on`, `true` or no value: put bitcode in rlibs (the default).
107* `n`, `no`, `off` or `false`: omit bitcode from rlibs.
108
109LLVM bitcode is required when rustc is performing link-time optimization (LTO).
110It is also required on some targets like iOS ones where vendors look for LLVM
111bitcode. Embedded bitcode will appear in rustc-generated object files inside of
112a section whose name is defined by the target platform. Most of the time this is
113`.llvmbc`.
114
115The use of `-C embed-bitcode=no` can significantly improve compile times and
116reduce generated file sizes if your compilation does not actually need bitcode
117(e.g. if you're not compiling for iOS or you're not performing LTO). For these
118reasons, Cargo uses `-C embed-bitcode=no` whenever possible. Likewise, if you
119are building directly with `rustc` we recommend using `-C embed-bitcode=no`
120whenever you are not using LTO.
121
122If combined with `-C lto`, `-C embed-bitcode=no` will cause `rustc` to abort
123at start-up, because the combination is invalid.
124
125> **Note**: if you're building Rust code with LTO then you probably don't even
126> need the `embed-bitcode` option turned on. You'll likely want to use
127> `-Clinker-plugin-lto` instead which skips generating object files entirely and
128> simply replaces object files with LLVM bitcode. The only purpose for
129> `-Cembed-bitcode` is when you're generating an rlib that is both being used
130> with and without LTO. For example Rust's standard library ships with embedded
131> bitcode since users link to it both with and without LTO.
132>
133> This also may make you wonder why the default is `yes` for this option. The
134> reason for that is that it's how it was for rustc 1.44 and prior. In 1.45 this
135> option was added to turn off what had always been the default.
136
137## extra-filename
138
139This option allows you to put extra data in each output filename. It takes a
140string to add as a suffix to the filename. See the [`--emit`
141flag][option-emit] for more information.
142
143## force-frame-pointers
144
145This flag forces the use of frame pointers. It takes one of the following
146values:
147
148* `y`, `yes`, `on`, `true` or no value: force-enable frame pointers.
149* `n`, `no`, `off` or `false`: do not force-enable frame pointers. This does
150  not necessarily mean frame pointers will be removed.
151
152The default behaviour, if frame pointers are not force-enabled, depends on the
153target.
154
155## force-unwind-tables
156
157This flag forces the generation of unwind tables. It takes one of the following
158values:
159
160* `y`, `yes`, `on`, `true` or no value: Unwind tables are forced to be generated.
161* `n`, `no`, `off` or `false`: Unwind tables are not forced to be generated. If unwind
162  tables are required by the target an error will be emitted.
163
164The default if not specified depends on the target.
165
166## incremental
167
168This flag allows you to enable incremental compilation, which allows `rustc`
169to save information after compiling a crate to be reused when recompiling the
170crate, improving re-compile times. This takes a path to a directory where
171incremental files will be stored.
172
173## inline-threshold
174
175This option lets you set the default threshold for inlining a function. It
176takes an unsigned integer as a value. Inlining is based on a cost model, where
177a higher threshold will allow more inlining.
178
179The default depends on the [opt-level](#opt-level):
180
181| opt-level | Threshold |
182|-----------|-----------|
183| 0         | N/A, only inlines always-inline functions |
184| 1         | N/A, only inlines always-inline functions and LLVM lifetime intrinsics |
185| 2         | 225 |
186| 3         | 275 |
187| s         | 75 |
188| z         | 25 |
189
190## instrument-coverage
191
192This option enables instrumentation-based code coverage support. See the
193chapter on [instrumentation-based code coverage] for more information.
194
195Note that while the `-C instrument-coverage` option is stable, the profile data
196format produced by the resulting instrumentation may change, and may not work
197with coverage tools other than those built and shipped with the compiler.
198
199## link-arg
200
201This flag lets you append a single extra argument to the linker invocation.
202
203"Append" is significant; you can pass this flag multiple times to add multiple arguments.
204
205## link-args
206
207This flag lets you append multiple extra arguments to the linker invocation. The
208options should be separated by spaces.
209
210## link-dead-code
211
212This flag controls whether the linker will keep dead code. It takes one of
213the following values:
214
215* `y`, `yes`, `on`, `true` or no value: keep dead code.
216* `n`, `no`, `off` or `false`: remove dead code (the default).
217
218An example of when this flag might be useful is when trying to construct code coverage
219metrics.
220
221## link-self-contained
222
223On `windows-gnu`, `linux-musl`, and `wasi` targets, this flag controls whether the
224linker will use libraries and objects shipped with Rust instead or those in the system.
225It takes one of the following values:
226
227* no value: rustc will use heuristic to disable self-contained mode if system has necessary tools.
228* `y`, `yes`, `on`, `true`: use only libraries/objects shipped with Rust.
229* `n`, `no`, `off` or `false`: rely on the user or the linker to provide non-Rust libraries/objects.
230
231This allows overriding cases when detection fails or user wants to use shipped libraries.
232
233## linker
234
235This flag controls which linker `rustc` invokes to link your code. It takes a
236path to the linker executable. If this flag is not specified, the linker will
237be inferred based on the target. See also the [linker-flavor](#linker-flavor)
238flag for another way to specify the linker.
239
240## linker-flavor
241
242This flag controls the linker flavor used by `rustc`. If a linker is given with
243the [`-C linker` flag](#linker), then the linker flavor is inferred from the
244value provided. If no linker is given then the linker flavor is used to
245determine the linker to use. Every `rustc` target defaults to some linker
246flavor. Valid options are:
247
248* `em`: use [Emscripten `emcc`](https://emscripten.org/docs/tools_reference/emcc.html).
249* `gcc`: use the `cc` executable, which is typically gcc or clang on many systems.
250* `ld`: use the `ld` executable.
251* `msvc`: use the `link.exe` executable from Microsoft Visual Studio MSVC.
252* `ptx-linker`: use
253  [`rust-ptx-linker`](https://github.com/denzp/rust-ptx-linker) for Nvidia
254  NVPTX GPGPU support.
255* `bpf-linker`: use
256  [`bpf-linker`](https://github.com/alessandrod/bpf-linker) for eBPF support.
257* `wasm-ld`: use the [`wasm-ld`](https://lld.llvm.org/WebAssembly.html)
258  executable, a port of LLVM `lld` for WebAssembly.
259* `ld64.lld`: use the LLVM `lld` executable with the [`-flavor darwin`
260  flag][lld-flavor] for Apple's `ld`.
261* `ld.lld`: use the LLVM `lld` executable with the [`-flavor gnu`
262  flag][lld-flavor] for GNU binutils' `ld`.
263* `lld-link`: use the LLVM `lld` executable with the [`-flavor link`
264  flag][lld-flavor] for Microsoft's `link.exe`.
265
266[lld-flavor]: https://lld.llvm.org/Driver.html
267
268## linker-plugin-lto
269
270This flag defers LTO optimizations to the linker. See
271[linker-plugin-LTO](../linker-plugin-lto.md) for more details. It takes one of
272the following values:
273
274* `y`, `yes`, `on`, `true` or no value: enable linker plugin LTO.
275* `n`, `no`, `off` or `false`: disable linker plugin LTO (the default).
276* A path to the linker plugin.
277
278More specifically this flag will cause the compiler to replace its typical
279object file output with LLVM bitcode files. For example an rlib produced with
280`-Clinker-plugin-lto` will still have `*.o` files in it, but they'll all be LLVM
281bitcode instead of actual machine code. It is expected that the native platform
282linker is capable of loading these LLVM bitcode files and generating code at
283link time (typically after performing optimizations).
284
285Note that rustc can also read its own object files produced with
286`-Clinker-plugin-lto`. If an rlib is only ever going to get used later with a
287`-Clto` compilation then you can pass `-Clinker-plugin-lto` to speed up
288compilation and avoid generating object files that aren't used.
289
290## llvm-args
291
292This flag can be used to pass a list of arguments directly to LLVM.
293
294The list must be separated by spaces.
295
296Pass `--help` to see a list of options.
297
298## lto
299
300This flag controls whether LLVM uses [link time
301optimizations](https://llvm.org/docs/LinkTimeOptimization.html) to produce
302better optimized code, using whole-program analysis, at the cost of longer
303linking time. It takes one of the following values:
304
305* `y`, `yes`, `on`, `true`, `fat`, or no value: perform "fat" LTO which attempts to
306  perform optimizations across all crates within the dependency graph.
307* `n`, `no`, `off`, `false`: disables LTO.
308* `thin`: perform ["thin"
309  LTO](http://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html).
310  This is similar to "fat", but takes substantially less time to run while
311  still achieving performance gains similar to "fat".
312
313If `-C lto` is not specified, then the compiler will attempt to perform "thin
314local LTO" which performs "thin" LTO on the local crate only across its
315[codegen units](#codegen-units). When `-C lto` is not specified, LTO is
316disabled if codegen units is 1 or optimizations are disabled ([`-C
317opt-level=0`](#opt-level)). That is:
318
319* When `-C lto` is not specified:
320  * `codegen-units=1`: disable LTO.
321  * `opt-level=0`: disable LTO.
322* When `-C lto` is specified:
323  * `lto`: 16 codegen units, perform fat LTO across crates.
324  * `codegen-units=1` + `lto`: 1 codegen unit, fat LTO across crates.
325
326See also [linker-plugin-lto](#linker-plugin-lto) for cross-language LTO.
327
328## metadata
329
330This option allows you to control the metadata used for symbol mangling. This
331takes a space-separated list of strings. Mangled symbols will incorporate a
332hash of the metadata. This may be used, for example, to differentiate symbols
333between two different versions of the same crate being linked.
334
335## no-prepopulate-passes
336
337This flag tells the pass manager to use an empty list of passes, instead of the
338usual pre-populated list of passes.
339
340## no-redzone
341
342This flag allows you to disable [the
343red zone](https://en.wikipedia.org/wiki/Red_zone_\(computing\)). It takes one
344of the following values:
345
346* `y`, `yes`, `on`, `true` or no value: disable the red zone.
347* `n`, `no`, `off` or `false`: enable the red zone.
348
349The default behaviour, if the flag is not specified, depends on the target.
350
351## no-stack-check
352
353This option is deprecated and does nothing.
354
355## no-vectorize-loops
356
357This flag disables [loop
358vectorization](https://llvm.org/docs/Vectorizers.html#the-loop-vectorizer).
359
360## no-vectorize-slp
361
362This flag disables vectorization using
363[superword-level
364parallelism](https://llvm.org/docs/Vectorizers.html#the-slp-vectorizer).
365
366## opt-level
367
368This flag controls the optimization level.
369
370* `0`: no optimizations, also turns on
371  [`cfg(debug_assertions)`](#debug-assertions) (the default).
372* `1`: basic optimizations.
373* `2`: some optimizations.
374* `3`: all optimizations.
375* `s`: optimize for binary size.
376* `z`: optimize for binary size, but also turn off loop vectorization.
377
378Note: The [`-O` flag][option-o-optimize] is an alias for `-C opt-level=2`.
379
380The default is `0`.
381
382## overflow-checks
383
384This flag allows you to control the behavior of [runtime integer
385overflow](../../reference/expressions/operator-expr.md#overflow). When
386overflow-checks are enabled, a panic will occur on overflow. This flag takes
387one of the following values:
388
389* `y`, `yes`, `on`, `true` or no value: enable overflow checks.
390* `n`, `no`, `off` or `false`: disable overflow checks.
391
392If not specified, overflow checks are enabled if
393[debug-assertions](#debug-assertions) are enabled, disabled otherwise.
394
395## panic
396
397This option lets you control what happens when the code panics.
398
399* `abort`: terminate the process upon panic
400* `unwind`: unwind the stack upon panic
401
402If not specified, the default depends on the target.
403
404## passes
405
406This flag can be used to add extra [LLVM
407passes](http://llvm.org/docs/Passes.html) to the compilation.
408
409The list must be separated by spaces.
410
411See also the [`no-prepopulate-passes`](#no-prepopulate-passes) flag.
412
413## prefer-dynamic
414
415By default, `rustc` prefers to statically link dependencies. This option will
416indicate that dynamic linking should be used if possible if both a static and
417dynamic versions of a library are available. There is an internal algorithm
418for determining whether or not it is possible to statically or dynamically
419link with a dependency. For example, `cdylib` crate types may only use static
420linkage. This flag takes one of the following values:
421
422* `y`, `yes`, `on`, `true` or no value: use dynamic linking.
423* `n`, `no`, `off` or `false`: use static linking (the default).
424
425## profile-generate
426
427This flag allows for creating instrumented binaries that will collect
428profiling data for use with profile-guided optimization (PGO). The flag takes
429an optional argument which is the path to a directory into which the
430instrumented binary will emit the collected data. See the chapter on
431[profile-guided optimization] for more information.
432
433## profile-use
434
435This flag specifies the profiling data file to be used for profile-guided
436optimization (PGO). The flag takes a mandatory argument which is the path
437to a valid `.profdata` file. See the chapter on
438[profile-guided optimization] for more information.
439
440## relocation-model
441
442This option controls generation of
443[position-independent code (PIC)](https://en.wikipedia.org/wiki/Position-independent_code).
444
445Supported values for this option are:
446
447#### Primary relocation models
448
449- `static` - non-relocatable code, machine instructions may use absolute addressing modes.
450
451- `pic` - fully relocatable position independent code,
452machine instructions need to use relative addressing modes.  \
453Equivalent to the "uppercase" `-fPIC` or `-fPIE` options in other compilers,
454depending on the produced crate types.  \
455This is the default model for majority of supported targets.
456
457- `pie` - position independent executable, relocatable code but without support for symbol
458interpositioning (replacing symbols by name using `LD_PRELOAD` and similar). Equivalent to the "uppercase" `-fPIE` option in other compilers. `pie`
459code cannot be linked into shared libraries (you'll get a linking error on attempt to do this).
460
461#### Special relocation models
462
463- `dynamic-no-pic` - relocatable external references, non-relocatable code.  \
464Only makes sense on Darwin and is rarely used.  \
465If StackOverflow tells you to use this as an opt-out of PIC or PIE, don't believe it,
466use `-C relocation-model=static` instead.
467- `ropi`, `rwpi` and `ropi-rwpi` - relocatable code and read-only data, relocatable read-write data,
468and combination of both, respectively.  \
469Only makes sense for certain embedded ARM targets.
470- `default` - relocation model default to the current target.  \
471Only makes sense as an override for some other explicitly specified relocation model
472previously set on the command line.
473
474Supported values can also be discovered by running `rustc --print relocation-models`.
475
476#### Linking effects
477
478In addition to codegen effects, `relocation-model` has effects during linking.
479
480If the relocation model is `pic` and the current target supports position-independent executables
481(PIE), the linker will be instructed (`-pie`) to produce one.  \
482If the target doesn't support both position-independent and statically linked executables,
483then `-C target-feature=+crt-static` "wins" over `-C relocation-model=pic`,
484and the linker is instructed (`-static`) to produce a statically linked
485but not position-independent executable.
486
487## relro-level
488
489This flag controls what level of RELRO (Relocation Read-Only) is enabled. RELRO is an exploit
490mitigation which makes the Global Offset Table (GOT) read-only.
491
492Supported values for this option are:
493
494- `off`: Dynamically linked functions are resolved lazily and the GOT is writable.
495- `partial`: Dynamically linked functions are resolved lazily and written into the Procedure
496  Linking Table (PLT) part of the GOT (`.got.plt`). The non-PLT part of the GOT (`.got`) is made
497  read-only and both are moved to prevent writing from buffer overflows.
498- `full`: Dynamically linked functions are resolved at the start of program execution and the
499  Global Offset Table (`.got`/`.got.plt`) is populated eagerly and then made read-only. The GOT is
500  also moved to prevent writing from buffer overflows. Full RELRO uses more memory and increases
501  process startup time.
502
503This flag is ignored on platforms where RELRO is not supported (targets which do not use the ELF
504binary format), such as Windows or macOS. Each rustc target has its own default for RELRO. rustc
505enables Full RELRO by default on platforms where it is supported.
506
507## remark
508
509This flag lets you print remarks for optimization passes.
510
511The list of passes should be separated by spaces.
512
513`all` will remark on every pass.
514
515## rpath
516
517This flag controls whether [`rpath`](https://en.wikipedia.org/wiki/Rpath) is
518enabled. It takes one of the following values:
519
520* `y`, `yes`, `on`, `true` or no value: enable rpath.
521* `n`, `no`, `off` or `false`: disable rpath (the default).
522
523## save-temps
524
525This flag controls whether temporary files generated during compilation are
526deleted once compilation finishes. It takes one of the following values:
527
528* `y`, `yes`, `on`, `true` or no value: save temporary files.
529* `n`, `no`, `off` or `false`: delete temporary files (the default).
530
531## soft-float
532
533This option controls whether `rustc` generates code that emulates floating
534point instructions in software. It takes one of the following values:
535
536* `y`, `yes`, `on`, `true` or no value: use soft floats.
537* `n`, `no`, `off` or `false`: use hardware floats (the default).
538
539## split-debuginfo
540
541This option controls the emission of "split debuginfo" for debug information
542that `rustc` generates. The default behavior of this option is
543platform-specific, and not all possible values for this option work on all
544platforms. Possible values are:
545
546* `off` - This is the default for platforms with ELF binaries and windows-gnu
547  (not Windows MSVC and not macOS). This typically means that DWARF debug
548  information can be found in the final artifact in sections of the executable.
549  This option is not supported on Windows MSVC. On macOS this options prevents
550  the final execution of `dsymutil` to generate debuginfo.
551
552* `packed` - This is the default for Windows MSVC and macOS. The term
553  "packed" here means that all the debug information is packed into a separate
554  file from the main executable. On Windows MSVC this is a `*.pdb` file, on
555  macOS this is a `*.dSYM` folder, and on other platforms this is a `*.dwp`
556  file.
557
558* `unpacked` - This means that debug information will be found in separate
559  files for each compilation unit (object file). This is not supported on
560  Windows MSVC. On macOS this means the original object files will contain
561  debug information. On other Unix platforms this means that `*.dwo` files will
562  contain debug information.
563
564Note that all three options are supported on Linux and Apple platforms,
565`packed` is supported on Windows-MSVC, and all other platforms support `off`.
566Attempting to use an unsupported option requires using the nightly channel
567with the `-Z unstable-options` flag.
568
569## strip
570
571The option `-C strip=val` controls stripping of debuginfo and similar auxiliary
572data from binaries during linking.
573
574Supported values for this option are:
575
576- `none` - debuginfo and symbols (if they exist) are copied to the produced
577  binary or separate files depending on the target (e.g. `.pdb` files in case
578  of MSVC).
579- `debuginfo` - debuginfo sections and debuginfo symbols from the symbol table
580  section are stripped at link time and are not copied to the produced binary
581  or separate files.
582- `symbols` - same as `debuginfo`, but the rest of the symbol table section is
583  stripped as well if the linker supports it.
584
585## symbol-mangling-version
586
587This option controls the [name mangling] format for encoding Rust item names
588for the purpose of generating object code and linking.
589
590Supported values for this option are:
591
592* `v0` — The "v0" mangling scheme. The specific format is not specified at
593  this time.
594
595The default, if not specified, will use a compiler-chosen default which may
596change in the future.
597
598[name mangling]: https://en.wikipedia.org/wiki/Name_mangling
599
600## target-cpu
601
602This instructs `rustc` to generate code specifically for a particular processor.
603
604You can run `rustc --print target-cpus` to see the valid options to pass
605and the default target CPU for the current buid target.
606Each target has a default base CPU. Special values include:
607
608* `native` can be passed to use the processor of the host machine.
609* `generic` refers to an LLVM target with minimal features but modern tuning.
610
611## target-feature
612
613Individual targets will support different features; this flag lets you control
614enabling or disabling a feature. Each feature should be prefixed with a `+` to
615enable it or `-` to disable it.
616
617Features from multiple `-C target-feature` options are combined. \
618Multiple features can be specified in a single option by separating them
619with commas - `-C target-feature=+x,-y`. \
620If some feature is specified more than once with both `+` and `-`,
621then values passed later override values passed earlier. \
622For example, `-C target-feature=+x,-y,+z -Ctarget-feature=-x,+y`
623is equivalent to `-C target-feature=-x,+y,+z`.
624
625To see the valid options and an example of use, run `rustc --print
626target-features`.
627
628Using this flag is unsafe and might result in [undefined runtime
629behavior](../targets/known-issues.md).
630
631See also the [`target_feature`
632attribute](../../reference/attributes/codegen.md#the-target_feature-attribute)
633for controlling features per-function.
634
635This also supports the feature `+crt-static` and `-crt-static` to control
636[static C runtime linkage](../../reference/linkage.html#static-and-dynamic-c-runtimes).
637
638Each target and [`target-cpu`](#target-cpu) has a default set of enabled
639features.
640
641## tune-cpu
642
643This instructs `rustc` to schedule code specifically for a particular
644processor. This does not affect the compatibility (instruction sets or ABI),
645but should make your code slightly more efficient on the selected CPU.
646
647The valid options are the same as those for [`target-cpu`](#target-cpu).
648The default is `None`, which LLVM translates as the `target-cpu`.
649
650This is an unstable option. Use `-Z tune-cpu=machine` to specify a value.
651
652Due to limitations in LLVM (12.0.0-git9218f92), this option is currently
653effective only for x86 targets.
654
655[option-emit]: ../command-line-arguments.md#option-emit
656[option-o-optimize]: ../command-line-arguments.md#option-o-optimize
657[instrumentation-based code coverage]: ../instrument-coverage.md
658[profile-guided optimization]: ../profile-guided-optimization.md
659[option-g-debug]: ../command-line-arguments.md#option-g-debug
660