]> git.lizzy.rs Git - rust.git/blob - src/doc/rustc/src/targets/index.md
review comment
[rust.git] / src / doc / rustc / src / targets / index.md
1 # Targets
2
3 `rustc` is a cross-compiler by default. This means that you can use any compiler to build for any
4 architecture. The list of *targets* are the possible architectures that you can build for.
5
6 To see all the options that you can set with a target, see the docs
7 [here](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/spec/struct.Target.html).
8
9 To compile to a particular target, use the `--target` flag:
10
11 ```bash
12 $ rustc src/main.rs --target=wasm32-unknown-unknown
13 ```
14 ## Target Features
15 `x86`,  and `ARMv8` are two popular CPU architectures. Their instruction sets form a common baseline across most CPUs. However, some CPUs extend these with custom instruction sets, e.g. vector (`AVX`), bitwise manipulation (`BMI`) or cryptographic (`AES`).
16
17 Developers, who know on which CPUs their compiled code is going to run can choose to add (or remove) CPU specific instruction sets via the `-C target-feature=val` flag.
18
19 Please note, that this flag is generally considered as unsafe. More details can be found in [this section](known-issues.md).