Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit fb92375

Browse files
committed
Merge commit '3a31c6d8272c14388a34622193baf553636fe470' into sync_cg_clif-2021-07-07
1 parent 4cfa1fc commit fb92375

Some content is hidden

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

55 files changed

+1283
-446
lines changed

.cirrus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ task:
1414
- . $HOME/.cargo/env
1515
- git config --global user.email "[email protected]"
1616
- git config --global user.name "User"
17-
- ./prepare.sh
17+
- ./y.rs prepare
1818
test_script:
1919
- . $HOME/.cargo/env
2020
- # Enable backtraces for easier debugging

.github/workflows/main.yml

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ jobs:
1919
- os: ubuntu-latest
2020
env:
2121
TARGET_TRIPLE: x86_64-pc-windows-gnu
22+
- os: ubuntu-latest
23+
env:
24+
TARGET_TRIPLE: aarch64-unknown-linux-gnu
2225

2326
steps:
2427
- uses: actions/checkout@v2
@@ -49,11 +52,19 @@ jobs:
4952
sudo apt-get install -y gcc-mingw-w64-x86-64 wine-stable
5053
rustup target add x86_64-pc-windows-gnu
5154
55+
- name: Install AArch64 toolchain and qemu
56+
if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'aarch64-unknown-linux-gnu'
57+
run: |
58+
sudo apt-get install -y gcc-aarch64-linux-gnu qemu-user
59+
5260
- name: Prepare dependencies
5361
run: |
5462
git config --global user.email "[email protected]"
5563
git config --global user.name "User"
56-
./prepare.sh
64+
./y.rs prepare
65+
66+
- name: Build
67+
run: ./y.rs build --sysroot none
5768

5869
- name: Test
5970
env:
@@ -87,3 +98,63 @@ jobs:
8798
with:
8899
name: cg_clif-${{ runner.os }}-cross-x86_64-mingw
89100
path: cg_clif.tar.xz
101+
102+
build_windows:
103+
runs-on: windows-latest
104+
timeout-minutes: 60
105+
106+
steps:
107+
- uses: actions/checkout@v2
108+
109+
#- name: Cache cargo installed crates
110+
# uses: actions/cache@v2
111+
# with:
112+
# path: ~/.cargo/bin
113+
# key: ${{ runner.os }}-cargo-installed-crates
114+
115+
#- name: Cache cargo registry and index
116+
# uses: actions/cache@v2
117+
# with:
118+
# path: |
119+
# ~/.cargo/registry
120+
# ~/.cargo/git
121+
# key: ${{ runner.os }}-cargo-registry-and-index-${{ hashFiles('**/Cargo.lock') }}
122+
123+
#- name: Cache cargo target dir
124+
# uses: actions/cache@v2
125+
# with:
126+
# path: target
127+
# key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
128+
129+
- name: Prepare dependencies
130+
run: |
131+
git config --global user.email "[email protected]"
132+
git config --global user.name "User"
133+
git config --global core.autocrlf false
134+
rustup set default-host x86_64-pc-windows-gnu
135+
rustc y.rs -o y.exe -g
136+
./y.exe prepare
137+
138+
- name: Build
139+
#name: Test
140+
run: |
141+
# Enable backtraces for easier debugging
142+
#export RUST_BACKTRACE=1
143+
144+
# Reduce amount of benchmark runs as they are slow
145+
#export COMPILE_RUNS=2
146+
#export RUN_RUNS=2
147+
148+
# Enable extra checks
149+
#export CG_CLIF_ENABLE_VERIFIER=1
150+
151+
./y.exe build
152+
153+
#- name: Package prebuilt cg_clif
154+
# run: tar cvfJ cg_clif.tar.xz build
155+
156+
#- name: Upload prebuilt cg_clif
157+
# uses: actions/upload-artifact@v2
158+
# with:
159+
# name: cg_clif-${{ runner.os }}
160+
# path: cg_clif.tar.xz

.github/workflows/rustc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
run: |
3535
git config --global user.email "[email protected]"
3636
git config --global user.name "User"
37-
./prepare.sh
37+
./y.rs prepare
3838
3939
- name: Test
4040
run: |
@@ -72,7 +72,7 @@ jobs:
7272
run: |
7373
git config --global user.email "[email protected]"
7474
git config --global user.name "User"
75-
./prepare.sh
75+
./y.rs prepare
7676
7777
- name: Test
7878
run: |

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ perf.data
66
perf.data.old
77
*.events
88
*.string*
9+
/y.bin
910
/build
1011
/build_sysroot/sysroot_src
1112
/build_sysroot/compiler-builtins
13+
/build_sysroot/rustc_version
1214
/rust
1315
/rand
1416
/regex

.vscode/settings.json

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
// source for rustc_* is not included in the rust-src component; disable the errors about this
33
"rust-analyzer.diagnostics.disabled": ["unresolved-extern-crate", "unresolved-macro-call"],
4-
"rust-analyzer.assist.importMergeBehavior": "last",
4+
"rust-analyzer.assist.importGranularity": "module",
5+
"rust-analyzer.assist.importEnforceGranularity": true,
6+
"rust-analyzer.assist.importPrefix": "crate",
57
"rust-analyzer.cargo.runBuildScripts": true,
68
"rust-analyzer.linkedProjects": [
79
"./Cargo.toml",
@@ -49,6 +51,23 @@
4951
"cfg": [],
5052
},
5153
]
54+
},
55+
{
56+
"roots": ["./y.rs"],
57+
"crates": [
58+
{
59+
"root_module": "./y.rs",
60+
"edition": "2018",
61+
"deps": [{ "crate": 1, "name": "std" }],
62+
"cfg": [],
63+
},
64+
{
65+
"root_module": "./build_sysroot/sysroot_src/library/std/src/lib.rs",
66+
"edition": "2018",
67+
"deps": [],
68+
"cfg": [],
69+
},
70+
]
5271
}
5372
]
5473
}

Cargo.lock

Lines changed: 32 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ crate-type = ["dylib"]
99

1010
[dependencies]
1111
# These have to be in sync with each other
12-
cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "main", features = ["unwind"] }
12+
cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "main", features = ["unwind", "all-arch"] }
1313
cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "main" }
1414
cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "main" }
1515
cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "main" }
1616
cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "main", optional = true }
1717
cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "main" }
1818
target-lexicon = "0.12.0"
1919
gimli = { version = "0.24.0", default-features = false, features = ["write"]}
20-
object = { version = "0.24.0", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
20+
object = { version = "0.25.0", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
2121

2222
ar = { git = "https://github.com/bjorn3/rust-ar.git", branch = "do_not_remove_cg_clif_ranlib" }
2323
indexmap = "1.0.2"

Readme.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ If not please open an issue.
1010
```bash
1111
$ git clone https://github.com/bjorn3/rustc_codegen_cranelift.git
1212
$ cd rustc_codegen_cranelift
13-
$ ./prepare.sh # download and patch sysroot src and install hyperfine for benchmarking
14-
$ ./build.sh
13+
$ ./y.rs prepare # download and patch sysroot src and install hyperfine for benchmarking
14+
$ ./y.rs build
1515
```
1616

1717
To run the test suite replace the last command with:
@@ -20,7 +20,7 @@ To run the test suite replace the last command with:
2020
$ ./test.sh
2121
```
2222

23-
This will implicitly build cg_clif too. Both `build.sh` and `test.sh` accept a `--debug` argument to
23+
This will implicitly build cg_clif too. Both `y.rs build` and `test.sh` accept a `--debug` argument to
2424
build in debug mode.
2525

2626
Alternatively you can download a pre built version from [GHA]. It is listed in the artifacts section
@@ -32,12 +32,12 @@ of workflow runs. Unfortunately due to GHA restrictions you need to be logged in
3232

3333
rustc_codegen_cranelift can be used as a near-drop-in replacement for `cargo build` or `cargo run` for existing projects.
3434

35-
Assuming `$cg_clif_dir` is the directory you cloned this repo into and you followed the instructions (`prepare.sh` and `build.sh` or `test.sh`).
35+
Assuming `$cg_clif_dir` is the directory you cloned this repo into and you followed the instructions (`y.rs prepare` and `y.rs build` or `test.sh`).
3636

3737
In the directory with your project (where you can do the usual `cargo build`), run:
3838

3939
```bash
40-
$ $cg_clif_dir/build/cargo.sh build
40+
$ $cg_clif_dir/build/cargo build
4141
```
4242

4343
This will build your project with rustc_codegen_cranelift instead of the usual LLVM backend.

0 commit comments

Comments
 (0)