Skip to content

Commit ee45a53

Browse files
authored
Rollup merge of #92131 - bjorn3:sync_cg_clif-2021-12-20, r=bjorn3
Sync rustc_codegen_cranelift The main highlight this sync is improved support for inline assembly. Thanks `@nbdd0121!` Inline assembly is still disabled by default for builds in the main rust repo though. Cranelift will now also be built from the crates.io releases rather than the git repo. Git repos are incompatible with vendoring. r? `@ghost` `@rustbot` label +A-codegen +A-cranelift +T-compiler
2 parents 55b4944 + 3426a73 commit ee45a53

36 files changed

+1009
-524
lines changed

compiler/rustc_codegen_cranelift/.github/workflows/main.yml

+14-7
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ jobs:
6565
git config --global user.name "User"
6666
./y.rs prepare
6767
68+
- name: Build without unstable features
69+
env:
70+
TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
71+
# This is the config rust-lang/rust uses for builds
72+
run: ./y.rs build --no-unstable-features
73+
6874
- name: Build
6975
run: ./y.rs build --sysroot none
7076

@@ -152,11 +158,12 @@ jobs:
152158
153159
./y.exe build
154160
155-
#- name: Package prebuilt cg_clif
156-
# run: tar cvfJ cg_clif.tar.xz build
161+
- name: Package prebuilt cg_clif
162+
# don't use compression as xzip isn't supported by tar on windows and bzip2 hangs
163+
run: tar cvf cg_clif.tar build
157164

158-
#- name: Upload prebuilt cg_clif
159-
# uses: actions/upload-artifact@v2
160-
# with:
161-
# name: cg_clif-${{ runner.os }}
162-
# path: cg_clif.tar.xz
165+
- name: Upload prebuilt cg_clif
166+
uses: actions/upload-artifact@v2
167+
with:
168+
name: cg_clif-${{ runner.os }}
169+
path: cg_clif.tar
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Test nightly Cranelift
2+
3+
on:
4+
push:
5+
schedule:
6+
- cron: '1 17 * * *' # At 01:17 UTC every day.
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 60
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- name: Cache cargo installed crates
17+
uses: actions/cache@v2
18+
with:
19+
path: ~/.cargo/bin
20+
key: ubuntu-latest-cargo-installed-crates
21+
22+
- name: Prepare dependencies
23+
run: |
24+
git config --global user.email "[email protected]"
25+
git config --global user.name "User"
26+
./y.rs prepare
27+
28+
- name: Patch Cranelift
29+
run: |
30+
sed -i 's/cranelift-codegen = { version = "\w*.\w*.\w*", features = \["unwind", "all-arch"\] }/cranelift-codegen = { git = "https:\/\/github.com\/bytecodealliance\/wasmtime.git", features = ["unwind", "all-arch"] }/' Cargo.toml
31+
sed -i 's/cranelift-frontend = "\w*.\w*.\w*"/cranelift-frontend = { git = "https:\/\/github.com\/bytecodealliance\/wasmtime.git" }/' Cargo.toml
32+
sed -i 's/cranelift-module = "\w*.\w*.\w*"/cranelift-module = { git = "https:\/\/github.com\/bytecodealliance\/wasmtime.git" }/' Cargo.toml
33+
sed -i 's/cranelift-native = "\w*.\w*.\w*"/cranelift-native = { git = "https:\/\/github.com\/bytecodealliance\/wasmtime.git" }/' Cargo.toml
34+
sed -i 's/cranelift-jit = { version = "\w*.\w*.\w*", optional = true }/cranelift-jit = { git = "https:\/\/github.com\/bytecodealliance\/wasmtime.git", optional = true }/' Cargo.toml
35+
sed -i 's/cranelift-object = "\w*.\w*.\w*"/cranelift-object = { git = "https:\/\/github.com\/bytecodealliance\/wasmtime.git" }/' Cargo.toml
36+
37+
sed -i 's/gimli = { version = "0.25.0", default-features = false, features = \["write"\]}/gimli = { version = "0.26.1", default-features = false, features = ["write"] }/' Cargo.toml
38+
39+
cat Cargo.toml
40+
41+
- name: Build without unstable features
42+
# This is the config rust-lang/rust uses for builds
43+
run: ./y.rs build --no-unstable-features
44+
45+
- name: Build
46+
run: ./y.rs build --sysroot none
47+
- name: Test
48+
run: |
49+
# Enable backtraces for easier debugging
50+
export RUST_BACKTRACE=1
51+
52+
# Reduce amount of benchmark runs as they are slow
53+
export COMPILE_RUNS=2
54+
export RUN_RUNS=2
55+
56+
# Enable extra checks
57+
export CG_CLIF_ENABLE_VERIFIER=1
58+
59+
./test.sh

compiler/rustc_codegen_cranelift/.vscode/settings.json

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"rust-analyzer.assist.importEnforceGranularity": true,
66
"rust-analyzer.assist.importPrefix": "crate",
77
"rust-analyzer.cargo.runBuildScripts": true,
8+
"rust-analyzer.cargo.features": ["unstable-features"]
89
"rust-analyzer.linkedProjects": [
910
"./Cargo.toml",
1011
//"./build_sysroot/sysroot_src/src/libstd/Cargo.toml",

compiler/rustc_codegen_cranelift/Cargo.lock

+48-38
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ version = 3
44

55
[[package]]
66
name = "anyhow"
7-
version = "1.0.42"
7+
version = "1.0.51"
88
source = "registry+https://github.com/rust-lang/crates.io-index"
9-
checksum = "595d3cfa7a60d4555cb5067b99f07142a08ea778de5cf993f7b75c7d8fabc486"
9+
checksum = "8b26702f315f53b6071259e15dd9d64528213b44d61de1ec926eca7715d62203"
1010

1111
[[package]]
1212
name = "ar"
@@ -21,9 +21,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
2121

2222
[[package]]
2323
name = "bitflags"
24-
version = "1.2.1"
24+
version = "1.3.2"
2525
source = "registry+https://github.com/rust-lang/crates.io-index"
26-
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
26+
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
2727

2828
[[package]]
2929
name = "cfg-if"
@@ -33,16 +33,18 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
3333

3434
[[package]]
3535
name = "cranelift-bforest"
36-
version = "0.76.0"
37-
source = "git+https://github.com/bytecodealliance/wasmtime.git#9c550fcf41425942ed97c747f0169b2ca81f9c1b"
36+
version = "0.78.0"
37+
source = "registry+https://github.com/rust-lang/crates.io-index"
38+
checksum = "cc0cb7df82c8cf8f2e6a8dd394a0932a71369c160cc9b027dca414fced242513"
3839
dependencies = [
3940
"cranelift-entity",
4041
]
4142

4243
[[package]]
4344
name = "cranelift-codegen"
44-
version = "0.76.0"
45-
source = "git+https://github.com/bytecodealliance/wasmtime.git#9c550fcf41425942ed97c747f0169b2ca81f9c1b"
45+
version = "0.78.0"
46+
source = "registry+https://github.com/rust-lang/crates.io-index"
47+
checksum = "fe4463c15fa42eee909e61e5eac4866b7c6d22d0d8c621e57a0c5380753bfa8c"
4648
dependencies = [
4749
"cranelift-bforest",
4850
"cranelift-codegen-meta",
@@ -57,27 +59,31 @@ dependencies = [
5759

5860
[[package]]
5961
name = "cranelift-codegen-meta"
60-
version = "0.76.0"
61-
source = "git+https://github.com/bytecodealliance/wasmtime.git#9c550fcf41425942ed97c747f0169b2ca81f9c1b"
62+
version = "0.78.0"
63+
source = "registry+https://github.com/rust-lang/crates.io-index"
64+
checksum = "793f6a94a053a55404ea16e1700202a88101672b8cd6b4df63e13cde950852bf"
6265
dependencies = [
6366
"cranelift-codegen-shared",
6467
"cranelift-entity",
6568
]
6669

6770
[[package]]
6871
name = "cranelift-codegen-shared"
69-
version = "0.76.0"
70-
source = "git+https://github.com/bytecodealliance/wasmtime.git#9c550fcf41425942ed97c747f0169b2ca81f9c1b"
72+
version = "0.78.0"
73+
source = "registry+https://github.com/rust-lang/crates.io-index"
74+
checksum = "44aa1846df275bce5eb30379d65964c7afc63c05a117076e62a119c25fe174be"
7175

7276
[[package]]
7377
name = "cranelift-entity"
74-
version = "0.76.0"
75-
source = "git+https://github.com/bytecodealliance/wasmtime.git#9c550fcf41425942ed97c747f0169b2ca81f9c1b"
78+
version = "0.78.0"
79+
source = "registry+https://github.com/rust-lang/crates.io-index"
80+
checksum = "a3a45d8d6318bf8fc518154d9298eab2a8154ec068a8885ff113f6db8d69bb3a"
7681

7782
[[package]]
7883
name = "cranelift-frontend"
79-
version = "0.76.0"
80-
source = "git+https://github.com/bytecodealliance/wasmtime.git#9c550fcf41425942ed97c747f0169b2ca81f9c1b"
84+
version = "0.78.0"
85+
source = "registry+https://github.com/rust-lang/crates.io-index"
86+
checksum = "e07339bd461766deb7605169de039e01954768ff730fa1254e149001884a8525"
8187
dependencies = [
8288
"cranelift-codegen",
8389
"log",
@@ -87,8 +93,9 @@ dependencies = [
8793

8894
[[package]]
8995
name = "cranelift-jit"
90-
version = "0.76.0"
91-
source = "git+https://github.com/bytecodealliance/wasmtime.git#9c550fcf41425942ed97c747f0169b2ca81f9c1b"
96+
version = "0.78.0"
97+
source = "registry+https://github.com/rust-lang/crates.io-index"
98+
checksum = "0e8f0d60fb5d67f7a1e5c49db38ba96d1c846921faef02085fc5590b74781747"
9299
dependencies = [
93100
"anyhow",
94101
"cranelift-codegen",
@@ -104,8 +111,9 @@ dependencies = [
104111

105112
[[package]]
106113
name = "cranelift-module"
107-
version = "0.76.0"
108-
source = "git+https://github.com/bytecodealliance/wasmtime.git#9c550fcf41425942ed97c747f0169b2ca81f9c1b"
114+
version = "0.78.0"
115+
source = "registry+https://github.com/rust-lang/crates.io-index"
116+
checksum = "825ac7e0959cbe7ddc9cc21209f0319e611a57f9fcb2b723861fe7ef2017e651"
109117
dependencies = [
110118
"anyhow",
111119
"cranelift-codegen",
@@ -115,8 +123,9 @@ dependencies = [
115123

116124
[[package]]
117125
name = "cranelift-native"
118-
version = "0.76.0"
119-
source = "git+https://github.com/bytecodealliance/wasmtime.git#9c550fcf41425942ed97c747f0169b2ca81f9c1b"
126+
version = "0.78.0"
127+
source = "registry+https://github.com/rust-lang/crates.io-index"
128+
checksum = "03e2fca76ff57e0532936a71e3fc267eae6a19a86656716479c66e7f912e3d7b"
120129
dependencies = [
121130
"cranelift-codegen",
122131
"libc",
@@ -125,8 +134,9 @@ dependencies = [
125134

126135
[[package]]
127136
name = "cranelift-object"
128-
version = "0.76.0"
129-
source = "git+https://github.com/bytecodealliance/wasmtime.git#9c550fcf41425942ed97c747f0169b2ca81f9c1b"
137+
version = "0.78.0"
138+
source = "registry+https://github.com/rust-lang/crates.io-index"
139+
checksum = "55500d0fc9bb05c0944fc4506649249d28f55bd4fe95b87f0e55bf41058f0e6d"
130140
dependencies = [
131141
"anyhow",
132142
"cranelift-codegen",
@@ -138,9 +148,9 @@ dependencies = [
138148

139149
[[package]]
140150
name = "crc32fast"
141-
version = "1.2.1"
151+
version = "1.3.0"
142152
source = "registry+https://github.com/rust-lang/crates.io-index"
143-
checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a"
153+
checksum = "738c290dfaea84fc1ca15ad9c168d083b05a714e1efddd8edaab678dc28d2836"
144154
dependencies = [
145155
"cfg-if",
146156
]
@@ -172,9 +182,9 @@ dependencies = [
172182

173183
[[package]]
174184
name = "libc"
175-
version = "0.2.98"
185+
version = "0.2.112"
176186
source = "registry+https://github.com/rust-lang/crates.io-index"
177-
checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790"
187+
checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125"
178188

179189
[[package]]
180190
name = "libloading"
@@ -206,15 +216,15 @@ dependencies = [
206216

207217
[[package]]
208218
name = "memchr"
209-
version = "2.4.0"
219+
version = "2.4.1"
210220
source = "registry+https://github.com/rust-lang/crates.io-index"
211-
checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
221+
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
212222

213223
[[package]]
214224
name = "object"
215-
version = "0.26.0"
225+
version = "0.27.1"
216226
source = "registry+https://github.com/rust-lang/crates.io-index"
217-
checksum = "c55827317fb4c08822499848a14237d2874d6f139828893017237e7ab93eb386"
227+
checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9"
218228
dependencies = [
219229
"crc32fast",
220230
"indexmap",
@@ -223,9 +233,9 @@ dependencies = [
223233

224234
[[package]]
225235
name = "regalloc"
226-
version = "0.0.31"
236+
version = "0.0.32"
227237
source = "registry+https://github.com/rust-lang/crates.io-index"
228-
checksum = "571f7f397d61c4755285cd37853fe8e03271c243424a907415909379659381c5"
238+
checksum = "a6304468554ed921da3d32c355ea107b8d13d7b8996c3adfb7aab48d3bc321f4"
229239
dependencies = [
230240
"log",
231241
"rustc-hash",
@@ -271,15 +281,15 @@ dependencies = [
271281

272282
[[package]]
273283
name = "smallvec"
274-
version = "1.6.1"
284+
version = "1.7.0"
275285
source = "registry+https://github.com/rust-lang/crates.io-index"
276-
checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
286+
checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309"
277287

278288
[[package]]
279289
name = "target-lexicon"
280-
version = "0.12.1"
290+
version = "0.12.2"
281291
source = "registry+https://github.com/rust-lang/crates.io-index"
282-
checksum = "b0652da4c4121005e9ed22b79f6c5f2d9e2752906b53a33e9490489ba421a6fb"
292+
checksum = "d9bffcddbc2458fa3e6058414599e3c838a022abae82e5c67b4f7f80298d5bff"
283293

284294
[[package]]
285295
name = "winapi"

compiler/rustc_codegen_cranelift/Cargo.toml

+8-9
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,30 @@ crate-type = ["dylib"]
88

99
[dependencies]
1010
# These have to be in sync with each other
11-
cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", features = ["unwind", "all-arch"] }
12-
cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git" }
13-
cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git" }
14-
cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git" }
15-
cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", optional = true }
16-
cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git" }
11+
cranelift-codegen = { version = "0.78.0", features = ["unwind", "all-arch"] }
12+
cranelift-frontend = "0.78.0"
13+
cranelift-module = "0.78.0"
14+
cranelift-native = "0.78.0"
15+
cranelift-jit = { version = "0.78.0", optional = true }
16+
cranelift-object = "0.78.0"
1717
target-lexicon = "0.12.0"
1818
gimli = { version = "0.25.0", default-features = false, features = ["write"]}
19-
object = { version = "0.26.0", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
19+
object = { version = "0.27.0", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
2020

2121
ar = { git = "https://github.com/bjorn3/rust-ar.git", branch = "do_not_remove_cg_clif_ranlib" }
2222
indexmap = "1.0.2"
2323
libloading = { version = "0.6.0", optional = true }
2424
smallvec = "1.6.1"
2525

26+
[patch.crates-io]
2627
# Uncomment to use local checkout of cranelift
27-
#[patch."https://github.com/bytecodealliance/wasmtime.git"]
2828
#cranelift-codegen = { path = "../wasmtime/cranelift/codegen" }
2929
#cranelift-frontend = { path = "../wasmtime/cranelift/frontend" }
3030
#cranelift-module = { path = "../wasmtime/cranelift/module" }
3131
#cranelift-native = { path = "../wasmtime/cranelift/native" }
3232
#cranelift-jit = { path = "../wasmtime/cranelift/jit" }
3333
#cranelift-object = { path = "../wasmtime/cranelift/object" }
3434

35-
#[patch.crates-io]
3635
#gimli = { path = "../" }
3736

3837
[features]

compiler/rustc_codegen_cranelift/build_sysroot/Cargo.lock

+7-7
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
4040

4141
[[package]]
4242
name = "cc"
43-
version = "1.0.70"
43+
version = "1.0.72"
4444
source = "registry+https://github.com/rust-lang/crates.io-index"
45-
checksum = "d26a6ce4b6a484fa3edb70f7efa6fc430fd2b87285fe8b84304fd0936faa0dc0"
45+
checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"
4646

4747
[[package]]
4848
name = "cfg-if"
@@ -56,7 +56,7 @@ dependencies = [
5656

5757
[[package]]
5858
name = "compiler_builtins"
59-
version = "0.1.50"
59+
version = "0.1.66"
6060
dependencies = [
6161
"rustc-std-workspace-core",
6262
]
@@ -67,9 +67,9 @@ version = "0.0.0"
6767

6868
[[package]]
6969
name = "dlmalloc"
70-
version = "0.2.1"
70+
version = "0.2.3"
7171
source = "registry+https://github.com/rust-lang/crates.io-index"
72-
checksum = "332570860c2edf2d57914987bf9e24835425f75825086b6ba7d1e6a3e4f1f254"
72+
checksum = "a6fe28e0bf9357092740362502f5cc7955d8dc125ebda71dec72336c2e15c62e"
7373
dependencies = [
7474
"compiler_builtins",
7575
"libc",
@@ -132,9 +132,9 @@ dependencies = [
132132

133133
[[package]]
134134
name = "libc"
135-
version = "0.2.102"
135+
version = "0.2.112"
136136
source = "registry+https://github.com/rust-lang/crates.io-index"
137-
checksum = "a2a5ac8f984bfcf3a823267e5fde638acc3325f6496633a5da6bb6eb2171e103"
137+
checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125"
138138
dependencies = [
139139
"rustc-std-workspace-core",
140140
]

0 commit comments

Comments
 (0)