|
1 | 1 | # GCC codegen backend |
2 | 2 |
|
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: |
| 3 | +We run a subset of the compiler test suite with the GCC codegen backend on our CI, to help find changes that could break the integration of this backend with the compiler. |
| 4 | + |
| 5 | +If you encounter any bugs or problems with the GCC codegen backend in general, don't hesitate to open issues on the |
| 6 | +[`rustc_codegen_gcc` repository](https://github.com/rust-lang/rustc_codegen_gcc). |
| 7 | + |
| 8 | +Note that the backend currently only supports the `x86_64-unknown-linux-gnu` target. |
| 9 | + |
| 10 | +## Running into GCC backend CI errors |
| 11 | + |
| 12 | +If you ran into an error related to tests executed with the GCC codegen backend on CI in the `x86_64-gnu-gcc` job, |
| 13 | +you can use the following command to run UI tests locally using the GCC backend, which reproduces what happens on CI: |
5 | 14 |
|
6 | 15 | ```bash |
7 | | -./x test tests/ui --set 'rust.codegen-backends = ["llvm", "gcc"]' --test-codegen-backend gcc |
| 16 | +./x test tests/ui \ |
| 17 | + --set 'rust.codegen-backends = ["llvm", "gcc"]' \ |
| 18 | + --set 'rust.debug-assertions = false' \ |
| 19 | + --test-codegen-backend gcc |
8 | 20 | ``` |
9 | 21 |
|
10 | | -Below, you can find more information about how to configure the GCC backend in bootstrap. |
| 22 | +If a different test suite has failed on CI, you will have to modify the `tests/ui` part. |
| 23 | + |
| 24 | +To reproduce the whole CI job locally, you can run `cargo run --manifest-path src/ci/citool/Cargo.toml run-local x86_64-gnu-gcc`. See [Testing with Docker](../docker.md) for more information. |
| 25 | + |
| 26 | +### What to do in case of a GCC job failure? |
| 27 | + |
| 28 | +If the GCC job test fails and it seems like the failure could be caused by the GCC backend, you can ping the [cg-gcc working group](https://github.com/orgs/rust-lang/teams/wg-gcc-backend) using `@rust-lang/wg-gcc-backend` |
| 29 | + |
| 30 | +If fixing a compiler test that fails with the GCC backend is non-trivial, you can ignore that test when executed with `cg_gcc` using the `//@ ignore-backends: gcc` [compiletest directive](../directives.md). |
11 | 31 |
|
12 | 32 | ## Choosing which codegen backends are built |
13 | 33 |
|
@@ -44,13 +64,22 @@ To run compiler tests with the GCC codegen backend being used to build the test |
44 | 64 | ./x test tests/ui --test-codegen-backend gcc |
45 | 65 | ``` |
46 | 66 |
|
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). |
| 67 | +Note that in order for this to work, the tested compiler must have the GCC codegen backend [available](#choosing-which-codegen-backends-are-built) in its sysroot directory. |
49 | 68 |
|
50 | 69 | ## Downloading GCC from CI |
51 | 70 |
|
52 | 71 | The `gcc.download-ci-gcc` bootstrap option controls if GCC (which is a dependency of the GCC codegen backend) |
53 | 72 | will be downloaded from CI or built locally. The default value is `true`, which will download GCC from CI |
54 | 73 | if there are no local changes to the GCC sources and the given host target is available on CI. |
55 | 74 |
|
56 | | -Note that GCC can currently only be downloaded from CI for the `x86_64-unknown-linux-gnu` target. |
| 75 | +## Running tests of the backend itself |
| 76 | + |
| 77 | +In addition to running the compiler's test suites using the GCC codegen backend, you can also run the test suite of the backend itself. |
| 78 | + |
| 79 | +Now you do that using the following command: |
| 80 | + |
| 81 | +```text |
| 82 | +./x test rustc_codegen_gcc |
| 83 | +``` |
| 84 | + |
| 85 | +The backend needs to be [enabled](#choosing-which-codegen-backends-are-built) for this to work. |
0 commit comments