Skip to content

Commit 0093837

Browse files
committed
Auto merge of #164195 - GuillaumeGomez:subtree-sync-2026-10-12, r=GuillaumeGomez
cg_gcc subtree sync cc @antoyo r? ghost
2 parents 34ca1df + 85bb284 commit 0093837

36 files changed

Lines changed: 1075 additions & 203 deletions
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Install recent binutils
2+
description: >
3+
Installs binutils >= 2.44 from Ubuntu plucky, for the instructions and directives (like
4+
`.base64`) that the assembler of ubuntu-24.04 does not know. Needs the apt-mirrors action first.
5+
6+
runs:
7+
using: composite
8+
steps:
9+
- shell: bash
10+
run: |
11+
echo "deb mirror+file:/etc/apt/apt-mirrors.txt plucky main universe" | sudo tee /etc/apt/sources.list.d/plucky-copies.list
12+
sudo apt-get update -o Acquire::Retries=3 -o Acquire::http::Timeout=30
13+
sudo apt-get install binutils
14+
installed="$(dpkg-query --showformat='${Version}' --show binutils)"
15+
echo "Installed binutils: $installed"
16+
if dpkg --compare-versions "$installed" lt "2.44"; then
17+
echo "::error::binutils upgrade failed (got $installed, need >= 2.44); the apt fetch probably failed"
18+
exit 1
19+
fi
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Remove rustc-dev
2+
description: >
3+
Removes the rustc-dev component, whose copies of the compiler dependencies (like libc) sit next
4+
to the standard library in the rustup sysroot and make `extern crate libc` ambiguous (E0464).
5+
Use it once nothing needs to compile rustc_codegen_gcc anymore.
6+
7+
runs:
8+
using: composite
9+
steps:
10+
- shell: bash
11+
run: |
12+
# Otherwise, rustup reinstalls it on the next `cargo` or `rustc` call.
13+
sed -i -E 's/"rustc-dev",? *//' rust-toolchain.toml
14+
if grep -q rustc-dev rust-toolchain.toml; then
15+
echo "::error::failed to remove rustc-dev from rust-toolchain.toml"
16+
exit 1
17+
fi
18+
rustup component remove rustc-dev
19+
ls "$(rustc --print sysroot)"/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-*
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Use the rustup cg_gcc
2+
description: >
3+
Installs the cg_gcc backend and libgccjit that rustup distributes for the toolchain of
4+
rust-toolchain.toml, and writes a config.toml that makes y.sh use them, along with the sysroot
5+
of that toolchain (compiled by cg_llvm), instead of building the backend and the sysroot.
6+
7+
runs:
8+
using: composite
9+
steps:
10+
- shell: bash
11+
run: |
12+
rustup component add rustc-codegen-gcc gcc-x86_64-unknown-linux-gnu
13+
sysroot="$(rustc --print sysroot)"
14+
codegen_backends="$sysroot/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends"
15+
backends=("$codegen_backends"/librustc_codegen_gcc-*.so)
16+
if [ "${#backends[@]}" -ne 1 ] || [ ! -f "${backends[0]}" ]; then
17+
echo "::error::expected exactly one cg_gcc in $codegen_backends, found: ${backends[*]}"
18+
exit 1
19+
fi
20+
echo "gcc-path = \"$codegen_backends/lib/x86_64-unknown-linux-gnu\"" > config.toml
21+
echo "backend-path = \"${backends[0]}\"" >> config.toml
22+
echo "sysroot-path = \"$sysroot\"" >> config.toml
23+
cat config.toml
Lines changed: 292 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,292 @@
1+
name: CI with the cg_gcc distributed by rustup
2+
3+
# FIXME: run nightly (`schedule: - cron: "0 4 * * *"`) once this workflow tests the cg_gcc sources
4+
# of the rust-lang/rust commit of the nightly instead of the ones of this repository.
5+
on: workflow_dispatch
6+
7+
permissions:
8+
contents: read
9+
10+
env:
11+
# Enable backtraces for easier debugging
12+
RUST_BACKTRACE: 1
13+
# For the run-make tests.
14+
LLVM_BIN_DIR: /usr/bin
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-24.04
19+
# Above 3 times the longest job, so that a hang cannot run until GitHub's 6-hour limit.
20+
timeout-minutes: 90
21+
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
commands: [
26+
"--std-tests --alloc-tests",
27+
# FIXME: re-enable asm tests when GCC can emit in the right syntax.
28+
# "--asm-tests",
29+
"--test-libcore",
30+
"--extended-rand-tests",
31+
"--extended-regex-example-tests --test-libcore-doctests",
32+
"--extended-regex-tests",
33+
"--test-successful-rustc --nb-parts 2 --current-part 0",
34+
"--test-successful-rustc --nb-parts 2 --current-part 1",
35+
"--librsvg-tests",
36+
"--projects --nb-parts 3 --current-part 0",
37+
"--projects --nb-parts 3 --current-part 1",
38+
"--projects --nb-parts 3 --current-part 2",
39+
"--gcc-asm-tests --test-release-libcore",
40+
]
41+
# The tests that don't depend on the test command only run in the fastest job.
42+
include:
43+
- commands: "--extended-rand-tests"
44+
run_cargo_tests: true
45+
46+
steps:
47+
- uses: actions/checkout@v4
48+
49+
# `rustup show` installs from rust-toolchain.toml
50+
- name: Setup rust toolchain
51+
run: rustup show
52+
53+
- name: Use the cg_gcc distributed by rustup
54+
uses: ./.github/actions/rustup-cg-gcc
55+
56+
- name: Setup rust cache
57+
uses: Swatinem/rust-cache@v2
58+
59+
- name: Add apt mirrors
60+
uses: ./.github/actions/apt-mirrors
61+
62+
- name: Install packages
63+
# `llvm-14-tools` is needed to install the `FileCheck` binary which is used for asm tests.
64+
timeout-minutes: 20
65+
run: |
66+
sudo apt-get update
67+
sudo apt-get install ninja-build ripgrep llvm-14-tools llvm
68+
69+
# The libgccjit distributed by rustup emits `.base64`, which needs binutils >= 2.43.
70+
# FIXME: remove when we have binutils version 2.43 in the repo.
71+
- name: Install more recent binutils
72+
# Without a limit, an unreachable mirror hangs the job until GitHub's 6-hour timeout.
73+
timeout-minutes: 20
74+
uses: ./.github/actions/recent-binutils
75+
76+
- name: Install the libraries needed to build librsvg
77+
if: ${{ contains(matrix.commands, '--librsvg-tests') }}
78+
timeout-minutes: 20
79+
run: sudo apt-get install libcairo2-dev libpango1.0-dev libfontconfig1-dev libfreetype-dev libharfbuzz-dev libxml2-dev libglib2.0-dev
80+
81+
- name: Set env
82+
run: |
83+
echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV
84+
85+
- name: Prepare
86+
if: ${{ matrix.run_cargo_tests }}
87+
run: ./y.sh prepare --only-libcore
88+
89+
- name: Build
90+
if: ${{ matrix.run_cargo_tests }}
91+
run: |
92+
./y.sh build --sysroot
93+
./y.sh test --cargo-tests
94+
CARGO_TEST_FLAGS="-Zmir-preserve-ub" ./y.sh test --cargo-tests -- mir_preserve_ub_empty_switch
95+
CARGO_TEST_FLAGS="-Ctarget-feature=+cmpxchg16b" ./y.sh test --cargo-tests -- atomic_u128
96+
97+
- name: Run y.sh cargo build
98+
if: ${{ matrix.run_cargo_tests }}
99+
run: |
100+
CARGO_PROFILE_DEV_LTO=no ./y.sh cargo build --manifest-path tests/hello-world/Cargo.toml
101+
102+
- name: Clean
103+
if: ${{ matrix.run_cargo_tests }}
104+
run: |
105+
./y.sh clean all
106+
107+
- name: Remove rustc-dev
108+
uses: ./.github/actions/remove-rustc-dev
109+
110+
- name: Prepare dependencies
111+
run: |
112+
git config --global user.email "user@example.com"
113+
git config --global user.name "User"
114+
./y.sh prepare
115+
116+
- name: Run tests
117+
run: |
118+
./y.sh test --release --clean --build-sysroot --no-builtins-tests ${{ matrix.commands }}
119+
120+
# FIXME: test LTO, based on release.yml, once rustup distributes liblto_plugin.so and lto1
121+
# (and cg_gcc can find them in the sysroot).
122+
123+
stdarch:
124+
runs-on: ubuntu-24.04
125+
# Above 3 times the longest job, so that a hang cannot run until GitHub's 6-hour limit.
126+
timeout-minutes: 90
127+
128+
strategy:
129+
fail-fast: false
130+
matrix:
131+
cargo_runner: [
132+
"sde -cpuid-in /home/runner/work/rustc_codegen_gcc/rustc_codegen_gcc/tests/cpuid.def -rtm_mode full --",
133+
"",
134+
]
135+
136+
steps:
137+
- uses: actions/checkout@v4
138+
139+
# `rustup show` installs from rust-toolchain.toml
140+
- name: Setup rust toolchain
141+
run: rustup show
142+
143+
# The stdarch-gen-common tests run rustfmt.
144+
- name: Install rustfmt
145+
run: rustup component add rustfmt
146+
147+
- name: Use the cg_gcc distributed by rustup
148+
uses: ./.github/actions/rustup-cg-gcc
149+
150+
- name: Setup rust cache
151+
uses: Swatinem/rust-cache@v2
152+
153+
- name: Add apt mirrors
154+
uses: ./.github/actions/apt-mirrors
155+
156+
- name: Install packages
157+
timeout-minutes: 20
158+
run: sudo apt-get install ninja-build ripgrep
159+
160+
# The libgccjit distributed by rustup emits `.base64`, which needs binutils >= 2.43.
161+
# FIXME: remove when we have binutils version 2.43 in the repo.
162+
- name: Install more recent binutils
163+
# Without a limit, an unreachable mirror hangs the job until GitHub's 6-hour timeout.
164+
timeout-minutes: 20
165+
uses: ./.github/actions/recent-binutils
166+
167+
- name: Install Intel Software Development Emulator
168+
if: ${{ matrix.cargo_runner }}
169+
run: |
170+
mkdir intel-sde
171+
cd intel-sde
172+
version=10.8.0-2026-03-15
173+
dir=sde-external-$version-lin
174+
file=$dir.tar.xz
175+
wget http://ci-mirrors.rust-lang.org/$file
176+
tar xvf $file
177+
sudo mkdir /usr/share/intel-sde
178+
sudo cp -r $dir/* /usr/share/intel-sde
179+
sudo ln -s /usr/share/intel-sde/sde /usr/bin/sde
180+
sudo ln -s /usr/share/intel-sde/sde64 /usr/bin/sde64
181+
182+
- name: Build
183+
run: |
184+
./y.sh prepare --only-libcore
185+
./y.sh build --sysroot --release --release-sysroot
186+
187+
- name: Clean
188+
if: ${{ !matrix.cargo_runner }}
189+
run: |
190+
./y.sh clean all
191+
192+
- name: Prepare dependencies
193+
run: |
194+
git config --global user.email "user@example.com"
195+
git config --global user.name "User"
196+
./y.sh prepare
197+
198+
- name: Run tests
199+
if: ${{ !matrix.cargo_runner }}
200+
run: |
201+
./y.sh test --release --clean --release-sysroot --build-sysroot --mini-tests --std-tests --test-libcore
202+
./y.sh test --cargo-tests
203+
204+
- name: Remove rustc-dev
205+
uses: ./.github/actions/remove-rustc-dev
206+
207+
- name: Run stdarch tests
208+
if: ${{ !matrix.cargo_runner }}
209+
run: |
210+
# FIXME: remove --skip test_tile_ and --skip --skip test__tile when it's implemented.
211+
# FIXME: remove --skip test_mm_srav_epi64 when it's fixed upstream.
212+
./y.sh test --release --stdarch-tests -- --skip test_tile_ --skip test__tile --skip test_mm_srav_epi64
213+
214+
- name: Run stdarch tests
215+
if: ${{ matrix.cargo_runner }}
216+
run: |
217+
# FIXME: these tests fail when the sysroot is compiled with LTO because of a missing symbol in proc-macro.
218+
# FIXME: remove --skip test_tile_ and --skip --skip test__tile when it's implemented.
219+
# FIXME: remove --skip test_mm_srav_epi64 when it's fixed upstream.
220+
STDARCH_TEST_SKIP_FUNCTION="xsave,xsaveopt,xsave64,xsaveopt64" STDARCH_TEST_EVERYTHING=1 CHANNEL=release CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="${{ matrix.cargo_runner }}" TARGET=x86_64-unknown-linux-gnu CG_RUSTFLAGS="-Ainternal_features" ./y.sh cargo test --manifest-path build/build_sysroot/sysroot_src/library/stdarch/Cargo.toml -- --skip rtm --skip tbm --skip sse4a --skip test_tile_ --skip test__tile --skip test_mm_srav_epi64
221+
222+
failures:
223+
runs-on: ubuntu-24.04
224+
# Above 3 times the longest job, so that a hang cannot run until GitHub's 6-hour limit.
225+
timeout-minutes: 90
226+
227+
steps:
228+
- uses: actions/checkout@v4
229+
230+
# `rustup show` installs from rust-toolchain.toml
231+
- name: Setup rust toolchain
232+
run: rustup show
233+
234+
- name: Use the cg_gcc distributed by rustup
235+
uses: ./.github/actions/rustup-cg-gcc
236+
237+
- name: Remove rustc-dev
238+
uses: ./.github/actions/remove-rustc-dev
239+
240+
- name: Setup rust cache
241+
uses: Swatinem/rust-cache@v2
242+
243+
- name: Add apt mirrors
244+
uses: ./.github/actions/apt-mirrors
245+
246+
- name: Install packages
247+
timeout-minutes: 20
248+
run: sudo apt-get install ninja-build ripgrep
249+
250+
# The libgccjit distributed by rustup emits `.base64`, which needs binutils >= 2.43.
251+
# FIXME: remove when we have binutils version 2.43 in the repo.
252+
- name: Install more recent binutils
253+
# Without a limit, an unreachable mirror hangs the job until GitHub's 6-hour timeout.
254+
timeout-minutes: 20
255+
uses: ./.github/actions/recent-binutils
256+
257+
- name: Set env
258+
run: |
259+
echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV
260+
261+
- name: Prepare dependencies
262+
run: |
263+
git config --global user.email "user@example.com"
264+
git config --global user.name "User"
265+
./y.sh prepare
266+
267+
- name: Run tests
268+
run: |
269+
# Without this, `tee` masks the exit status of `y.sh test`.
270+
set -o pipefail
271+
status=0
272+
./y.sh test --release --clean --build-sysroot --test-failing-rustc 2>&1 | tee output_log || status=$?
273+
# This suite runs the tests known to fail, so only a build system error must fail the job.
274+
if [ "$status" -ne 0 ] && [ "$status" -ne 2 ]; then
275+
exit "$status"
276+
fi
277+
rg --text "test result" output_log >> $GITHUB_STEP_SUMMARY
278+
279+
- name: Run failing ui pattern tests for ICE
280+
run: |
281+
# Without this, `tee` masks the exit status of `y.sh test`.
282+
set -o pipefail
283+
status=0
284+
./y.sh test --release --test-failing-ui-pattern-tests 2>&1 | tee output_log_ui || status=$?
285+
# This suite runs tests that fail, so only a build system error must fail the job here.
286+
if [ "$status" -ne 0 ] && [ "$status" -ne 2 ]; then
287+
exit "$status"
288+
fi
289+
if grep -q "the compiler unexpectedly panicked" output_log_ui; then
290+
echo "Error: 'the compiler unexpectedly panicked' found in output logs. CI Error!!"
291+
exit 1
292+
fi

‎compiler/rustc_codegen_gcc/Cargo.lock‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,18 @@ dependencies = [
5656

5757
[[package]]
5858
name = "gccjit"
59-
version = "7.1.0"
59+
version = "7.2.0"
6060
source = "registry+https://github.com/rust-lang/crates.io-index"
61-
checksum = "21312c2cc52f15e394551018c6ee878b84b039f47ad00ab027cdd13fe8b5fb08"
61+
checksum = "27cd340f3c265988de3379689cbbd103c25b1f8a3d0cc73f91a49083e899d3e1"
6262
dependencies = [
6363
"gccjit_sys",
6464
]
6565

6666
[[package]]
6767
name = "gccjit_sys"
68-
version = "4.1.0"
68+
version = "4.2.0"
6969
source = "registry+https://github.com/rust-lang/crates.io-index"
70-
checksum = "3b85bc720f5c4194dcea10f95d8eb82b30b74d63255ee01285b990424f5a0a46"
70+
checksum = "da2d9d74572f004908f17ec1bd0af071e5db63a12c3335c9651a6125593951c6"
7171
dependencies = [
7272
"libc",
7373
]

‎compiler/rustc_codegen_gcc/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ default = ["master"]
2020
[dependencies]
2121
object = { version = "0.39.0", default-features = false, features = ["std", "read"] }
2222
tempfile = "3.20"
23-
gccjit = { version = "7.1.0", features = ["dlopen"] }
23+
gccjit = { version = "7.2.0", features = ["dlopen"] }
2424
#gccjit = { git = "https://github.com/rust-lang/gccjit.rs", branch = "error-dlopen", features = ["dlopen"] }
2525

2626
# Local copy.

‎compiler/rustc_codegen_gcc/_typos.toml‎

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)