Skip to content

Commit 083b569

Browse files
Rollup merge of rust-lang#87260 - antoyo:libgccjit-codegen, r=Mark-Simulacrum
Libgccjit codegen This PR introduces a subtree for a gcc-based codegen backend to the repository, per decision in rust-lang/compiler-team#442. We do not yet expect to ship this backend on nightly or run tests in CI, but we do verify that the backend checks (i.e., `cargo check`) successfully. Work is expected to progress primarily in https://github.com/rust-lang/rustc_codegen_gcc, with semi-regular upstreaming, like with other subtrees.
2 parents 1d71ba8 + 90be409 commit 083b569

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+13239
-2
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ members = [
4141
exclude = [
4242
"build",
4343
"compiler/rustc_codegen_cranelift",
44+
"compiler/rustc_codegen_gcc",
4445
"src/test/rustdoc-gui",
4546
# HACK(eddyb) This hardcodes the fact that our CI uses `/checkout/obj`.
4647
"obj",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: CI
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
strategy:
12+
fail-fast: false
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Install packages
18+
run: sudo apt-get install ninja-build ripgrep
19+
20+
- name: Download artifact
21+
uses: dawidd6/action-download-artifact@v2
22+
with:
23+
workflow: main.yml
24+
name: libgccjit.so
25+
path: gcc-build
26+
repo: antoyo/gcc
27+
28+
- name: Setup path to libgccjit
29+
run: |
30+
echo $(readlink -f gcc-build) > gcc_path
31+
ln gcc-build/libgccjit.so gcc-build/libgccjit.so.0
32+
33+
- name: Set LIBRARY_PATH
34+
run: |
35+
echo "LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
36+
echo "LD_LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
37+
38+
# https://github.com/actions/cache/issues/133
39+
- name: Fixup owner of ~/.cargo/
40+
# Don't remove the trailing /. It is necessary to follow the symlink.
41+
run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/
42+
43+
- name: Cache cargo installed crates
44+
uses: actions/[email protected]
45+
with:
46+
path: ~/.cargo/bin
47+
key: cargo-installed-crates2-ubuntu-latest
48+
49+
- name: Cache cargo registry
50+
uses: actions/cache@v1
51+
with:
52+
path: ~/.cargo/registry
53+
key: ${{ runner.os }}-cargo-registry2-${{ hashFiles('**/Cargo.lock') }}
54+
55+
- name: Cache cargo index
56+
uses: actions/cache@v1
57+
with:
58+
path: ~/.cargo/git
59+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
60+
61+
- name: Cache cargo target dir
62+
uses: actions/[email protected]
63+
with:
64+
path: target
65+
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain') }}
66+
67+
- name: Build
68+
run: |
69+
./prepare_build.sh
70+
./build.sh
71+
cargo test
72+
./clean_all.sh
73+
74+
- name: Prepare dependencies
75+
run: |
76+
git config --global user.email "[email protected]"
77+
git config --global user.name "User"
78+
./prepare.sh
79+
80+
# Compile is a separate step, as the actions-rs/cargo action supports error annotations
81+
- name: Compile
82+
uses: actions-rs/[email protected]
83+
with:
84+
command: build
85+
args: --release
86+
87+
- name: Test
88+
run: |
89+
# Enable backtraces for easier debugging
90+
export RUST_BACKTRACE=1
91+
92+
# Reduce amount of benchmark runs as they are slow
93+
export COMPILE_RUNS=2
94+
export RUN_RUNS=2
95+
96+
./test.sh --release

compiler/rustc_codegen_gcc/.gitignore

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
target
2+
**/*.rs.bk
3+
*.rlib
4+
*.o
5+
perf.data
6+
perf.data.old
7+
*.events
8+
*.string*
9+
/build_sysroot/sysroot
10+
/build_sysroot/sysroot_src
11+
/build_sysroot/Cargo.lock
12+
/build_sysroot/test_target/Cargo.lock
13+
/rust
14+
/simple-raytracer
15+
/regex
16+
gimple*
17+
*asm
18+
res
19+
test-backend
20+
gcc_path

0 commit comments

Comments
 (0)