Skip to content

Commit d588c11

Browse files
committed
Restructure the docs
1 parent 82ff002 commit d588c11

File tree

1 file changed

+37
-15
lines changed
  • src/doc/rustc-dev-guide/src/tests/codegen-backend-tests

1 file changed

+37
-15
lines changed
Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,56 @@
1-
# GCC codegen backend tests
1+
# GCC codegen backend
22

3-
To test the GCC codegen backend, you need to add `"gcc"` into the `rust.codegen-backends`
4-
setting in `bootstrap.toml`:
3+
If you ran into an error related to tests executed with the GCC codegen backend on CI,
4+
you can use the following command to run tests locally using the GCC backend:
5+
6+
```bash
7+
./x test tests/ui --set 'rust.codegen-backends = ["llvm", "gcc"]' --test-codegen-backend gcc
8+
```
9+
10+
Below, you can find more information about how to configure the GCC backend in bootstrap.
11+
12+
## Choosing which codegen backends are built
13+
14+
The `rust.codegen-backends = [...]` bootstrap option affects which codegen backends will be built and
15+
included in the sysroot of the produced `rustc`. To use the GCC codegen backend, `"gcc"` has to
16+
be included in this array in `bootstrap.toml`:
517

618
```toml
719
rust.codegen-backends = ["llvm", "gcc"]
820
```
921

10-
If you don't want to change your `bootstrap.toml` file, you can alternatively run your `x.py`
22+
If you don't want to change your `bootstrap.toml` file, you can alternatively run your `x`
1123
commands with `--set rust.codegen-backends=["llvm", "gcc"]'`. For example:
1224

1325
```bash
14-
x.py test --set 'rust.codegen-backends=["llvm", "gcc"]'
26+
./x build --set 'rust.codegen-backends=["llvm", "gcc"]'
1527
```
1628

17-
If you don't want to build `gcc` yourself, you also need to set:
29+
The first backend in the `codegen-backends` array will determine which backend will be used as the
30+
*default backend* of the built `rustc`. This also determines which backend will be used to compile the
31+
stage 1 standard library (or anything built in stage 2+). To produce `rustc` that uses the GCC backend
32+
by default, you can thus put `"gcc"` as the first element of this array:
1833

19-
```toml
20-
gcc.download-ci-gcc = true
34+
```bash
35+
./x build --set 'rust.codegen-backends=["gcc"]' library
2136
```
2237

23-
Then when running tests, add the `--test-codegen-backend gcc` option. For example:
38+
## Choosing the codegen backend used in tests
39+
40+
To run compiler tests with the GCC codegen backend being used to build the test Rust programs, you can use the
41+
`--test-codegen-backend` flag:
2442

2543
```bash
26-
./x.py test tests/ui --test-codegen-backend gcc
44+
./x test tests/ui --test-codegen-backend gcc
2745
```
2846

29-
If you want to build the sysroot using the GCC backend, you need to set it first
30-
in `rust.codegen-backends`:
47+
Note that in order for this to work, the tested compiler must have the GCC codegen backend available in its sysroot
48+
directory. You can achieve that using the [instructions above](#choosing-which-codegen-backends-are-built).
3149

32-
```toml
33-
rust.codegen-backends = ["llvm", "gcc"]
34-
```
50+
## Downloading GCC from CI
51+
52+
The `gcc.download-ci-gcc` bootstrap option controls if GCC (which is a dependency of the GCC codegen backend)
53+
will be downloaded from CI or built locally. The default value is `true`, which will download GCC from CI
54+
if there are no local changes to the GCC sources and the given host target is available on CI.
55+
56+
Note that GCC can currently only be downloaded from CI for the `x86_64-unknown-linux-gnu` target.

0 commit comments

Comments
 (0)