Skip to content

Commit fed59d6

Browse files
committed
Auto merge of rust-lang#84786 - JohnTitor:rollup-j5omx6f, r=JohnTitor
Rollup of 8 pull requests Successful merges: - rust-lang#84601 (rustdoc: Only store locations in Cache::extern_locations and calculate the other info on-demand) - rust-lang#84704 (platform-support.md: Update for consistency with Target Tier Policy) - rust-lang#84724 (Replace llvm::sys::fs::F_None with llvm::sys::fs::OF_None) - rust-lang#84740 (Reset the docs' copy path button after 1 second) - rust-lang#84749 (Sync `rustc_codegen_cranelift`) - rust-lang#84756 (Add a ToC to the Target Tier Policy documentation) - rust-lang#84765 (Update cargo) - rust-lang#84774 (Fix misspelling) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 1c2c6b6 + 6af045f commit fed59d6

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

+1105
-1534
lines changed

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

+7
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,10 @@ jobs:
8080
with:
8181
name: cg_clif-${{ runner.os }}
8282
path: cg_clif.tar.xz
83+
84+
- name: Upload prebuilt cg_clif (cross compile)
85+
if: matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
86+
uses: actions/upload-artifact@v2
87+
with:
88+
name: cg_clif-${{ runner.os }}-cross-x86_64-mingw
89+
path: cg_clif.tar.xz

compiler/rustc_codegen_cranelift/.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
// source for rustc_* is not included in the rust-src component; disable the errors about this
3-
"rust-analyzer.diagnostics.disabled": ["unresolved-extern-crate", "macro-error"],
3+
"rust-analyzer.diagnostics.disabled": ["unresolved-extern-crate", "unresolved-macro-call"],
44
"rust-analyzer.assist.importMergeBehavior": "last",
55
"rust-analyzer.cargo.runBuildScripts": true,
66
"rust-analyzer.linkedProjects": [

compiler/rustc_codegen_cranelift/Cargo.lock

+23-22
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
3939

4040
[[package]]
4141
name = "cranelift-bforest"
42-
version = "0.72.0"
43-
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#8e43e96410a14143d368273cf1e708f8094bb8e0"
42+
version = "0.73.0"
43+
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#45bee40f338c631bff4a799288101ba328c7ad36"
4444
dependencies = [
4545
"cranelift-entity",
4646
]
4747

4848
[[package]]
4949
name = "cranelift-codegen"
50-
version = "0.72.0"
51-
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#8e43e96410a14143d368273cf1e708f8094bb8e0"
50+
version = "0.73.0"
51+
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#45bee40f338c631bff4a799288101ba328c7ad36"
5252
dependencies = [
5353
"byteorder",
5454
"cranelift-bforest",
@@ -65,27 +65,27 @@ dependencies = [
6565

6666
[[package]]
6767
name = "cranelift-codegen-meta"
68-
version = "0.72.0"
69-
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#8e43e96410a14143d368273cf1e708f8094bb8e0"
68+
version = "0.73.0"
69+
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#45bee40f338c631bff4a799288101ba328c7ad36"
7070
dependencies = [
7171
"cranelift-codegen-shared",
7272
"cranelift-entity",
7373
]
7474

7575
[[package]]
7676
name = "cranelift-codegen-shared"
77-
version = "0.72.0"
78-
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#8e43e96410a14143d368273cf1e708f8094bb8e0"
77+
version = "0.73.0"
78+
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#45bee40f338c631bff4a799288101ba328c7ad36"
7979

8080
[[package]]
8181
name = "cranelift-entity"
82-
version = "0.72.0"
83-
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#8e43e96410a14143d368273cf1e708f8094bb8e0"
82+
version = "0.73.0"
83+
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#45bee40f338c631bff4a799288101ba328c7ad36"
8484

8585
[[package]]
8686
name = "cranelift-frontend"
87-
version = "0.72.0"
88-
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#8e43e96410a14143d368273cf1e708f8094bb8e0"
87+
version = "0.73.0"
88+
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#45bee40f338c631bff4a799288101ba328c7ad36"
8989
dependencies = [
9090
"cranelift-codegen",
9191
"log",
@@ -95,8 +95,8 @@ dependencies = [
9595

9696
[[package]]
9797
name = "cranelift-jit"
98-
version = "0.72.0"
99-
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#8e43e96410a14143d368273cf1e708f8094bb8e0"
98+
version = "0.73.0"
99+
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#45bee40f338c631bff4a799288101ba328c7ad36"
100100
dependencies = [
101101
"anyhow",
102102
"cranelift-codegen",
@@ -113,8 +113,8 @@ dependencies = [
113113

114114
[[package]]
115115
name = "cranelift-module"
116-
version = "0.72.0"
117-
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#8e43e96410a14143d368273cf1e708f8094bb8e0"
116+
version = "0.73.0"
117+
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#45bee40f338c631bff4a799288101ba328c7ad36"
118118
dependencies = [
119119
"anyhow",
120120
"cranelift-codegen",
@@ -125,17 +125,17 @@ dependencies = [
125125

126126
[[package]]
127127
name = "cranelift-native"
128-
version = "0.72.0"
129-
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#8e43e96410a14143d368273cf1e708f8094bb8e0"
128+
version = "0.73.0"
129+
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#45bee40f338c631bff4a799288101ba328c7ad36"
130130
dependencies = [
131131
"cranelift-codegen",
132132
"target-lexicon",
133133
]
134134

135135
[[package]]
136136
name = "cranelift-object"
137-
version = "0.72.0"
138-
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#8e43e96410a14143d368273cf1e708f8094bb8e0"
137+
version = "0.73.0"
138+
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#45bee40f338c631bff4a799288101ba328c7ad36"
139139
dependencies = [
140140
"anyhow",
141141
"cranelift-codegen",
@@ -306,6 +306,7 @@ dependencies = [
306306
"cranelift-frontend",
307307
"cranelift-jit",
308308
"cranelift-module",
309+
"cranelift-native",
309310
"cranelift-object",
310311
"gimli",
311312
"indexmap",
@@ -334,9 +335,9 @@ dependencies = [
334335

335336
[[package]]
336337
name = "target-lexicon"
337-
version = "0.11.2"
338+
version = "0.12.0"
338339
source = "registry+https://github.com/rust-lang/crates.io-index"
339-
checksum = "422045212ea98508ae3d28025bc5aaa2bd4a9cdaecd442a08da2ee620ee9ea95"
340+
checksum = "64ae3b39281e4b14b8123bdbaddd472b7dfe215e444181f2f9d2443c2444f834"
340341

341342
[[package]]
342343
name = "thiserror"

compiler/rustc_codegen_cranelift/Cargo.toml

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ 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/", branch = "main", features = ["unwind", "x64"] }
12+
cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main", features = ["unwind"] }
1313
cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main" }
1414
cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main" }
15+
cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main" }
1516
cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main", optional = true }
1617
cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main" }
17-
target-lexicon = "0.11.0"
18+
target-lexicon = "0.12.0"
1819
gimli = { version = "0.23.0", default-features = false, features = ["write"]}
1920
object = { version = "0.23.0", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
2021

@@ -28,6 +29,7 @@ smallvec = "1.6.1"
2829
#cranelift-codegen = { path = "../wasmtime/cranelift/codegen" }
2930
#cranelift-frontend = { path = "../wasmtime/cranelift/frontend" }
3031
#cranelift-module = { path = "../wasmtime/cranelift/module" }
32+
#cranelift-native = { path = ../wasmtime/cranelift/native" }
3133
#cranelift-jit = { path = "../wasmtime/cranelift/jit" }
3234
#cranelift-object = { path = "../wasmtime/cranelift/object" }
3335

compiler/rustc_codegen_cranelift/Readme.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ This will build your project with rustc_codegen_cranelift instead of the usual L
4444

4545
For additional ways to use rustc_codegen_cranelift like the JIT mode see [usage.md](docs/usage.md).
4646

47-
## Env vars
47+
## Configuration
4848

49-
See [env_vars.md](docs/env_vars.md) for all env vars used by rustc_codegen_cranelift.
49+
See the documentation on the `BackendConfig` struct in [config.rs](src/config.rs) for all
50+
configuration options.
5051

5152
## Not yet supported
5253

compiler/rustc_codegen_cranelift/build_sysroot/Cargo.lock

+16-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ dependencies = [
5656

5757
[[package]]
5858
name = "compiler_builtins"
59-
version = "0.1.39"
59+
version = "0.1.40"
6060
dependencies = [
6161
"rustc-std-workspace-core",
6262
]
@@ -132,9 +132,9 @@ dependencies = [
132132

133133
[[package]]
134134
name = "libc"
135-
version = "0.2.91"
135+
version = "0.2.94"
136136
source = "registry+https://github.com/rust-lang/crates.io-index"
137-
checksum = "8916b1f6ca17130ec6568feccee27c156ad12037880833a3b842a823236502e7"
137+
checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e"
138138
dependencies = [
139139
"rustc-std-workspace-core",
140140
]
@@ -167,6 +167,7 @@ dependencies = [
167167
name = "panic_abort"
168168
version = "0.0.0"
169169
dependencies = [
170+
"alloc",
170171
"cfg-if",
171172
"compiler_builtins",
172173
"core",
@@ -242,10 +243,22 @@ dependencies = [
242243
"panic_abort",
243244
"panic_unwind",
244245
"rustc-demangle",
246+
"std_detect",
245247
"unwind",
246248
"wasi",
247249
]
248250

251+
[[package]]
252+
name = "std_detect"
253+
version = "0.1.5"
254+
dependencies = [
255+
"cfg-if",
256+
"compiler_builtins",
257+
"libc",
258+
"rustc-std-workspace-alloc",
259+
"rustc-std-workspace-core",
260+
]
261+
249262
[[package]]
250263
name = "sysroot"
251264
version = "0.0.0"

compiler/rustc_codegen_cranelift/build_sysroot/prepare_sysroot_src.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ popd
3232
git clone https://github.com/rust-lang/compiler-builtins.git || echo "rust-lang/compiler-builtins has already been cloned"
3333
pushd compiler-builtins
3434
git checkout -- .
35-
git checkout 0.1.39
35+
git checkout 0.1.40
3636
git apply ../../crate_patches/000*-compiler-builtins-*.patch
3737
popd
3838

compiler/rustc_codegen_cranelift/crate_patches/0001-compiler-builtins-Remove-rotate_left-from-Int.patch

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ index 06054c8..3bea17b 100644
1717
fn wrapping_shr(self, other: u32) -> Self;
1818
- fn rotate_left(self, other: u32) -> Self;
1919
fn overflowing_add(self, other: Self) -> (Self, bool);
20-
fn aborting_div(self, other: Self) -> Self;
21-
fn aborting_rem(self, other: Self) -> Self;
20+
fn leading_zeros(self) -> u32;
21+
}
2222
@@ -209,10 +208,6 @@ macro_rules! int_impl_common {
2323
<Self>::wrapping_shr(self, other)
2424
}

compiler/rustc_codegen_cranelift/docs/env_vars.md

-15
This file was deleted.

compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs

+24-19
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ unsafe extern "C" fn my_puts(s: *const i8) {
1111
puts(s);
1212
}
1313

14+
macro_rules! assert {
15+
($e:expr) => {
16+
if !$e {
17+
panic(stringify!(! $e));
18+
}
19+
};
20+
}
21+
22+
macro_rules! assert_eq {
23+
($l:expr, $r: expr) => {
24+
if $l != $r {
25+
panic(stringify!($l != $r));
26+
}
27+
}
28+
}
29+
1430
#[lang = "termination"]
1531
trait Termination {
1632
fn report(self) -> i32;
@@ -20,8 +36,9 @@ impl Termination for () {
2036
fn report(self) -> i32 {
2137
unsafe {
2238
NUM = 6 * 7 + 1 + (1u8 == 1u8) as u8; // 44
23-
*NUM_REF as i32
39+
assert_eq!(*NUM_REF as i32, 44);
2440
}
41+
0
2542
}
2643
}
2744

@@ -82,29 +99,12 @@ fn start<T: Termination + 'static>(
8299
unsafe { puts(*((argv as usize + 2 * intrinsics::size_of::<*const u8>()) as *const *const i8)); }
83100
}
84101

85-
main().report();
86-
0
102+
main().report() as isize
87103
}
88104

89105
static mut NUM: u8 = 6 * 7;
90106
static NUM_REF: &'static u8 = unsafe { &NUM };
91107

92-
macro_rules! assert {
93-
($e:expr) => {
94-
if !$e {
95-
panic(stringify!(! $e));
96-
}
97-
};
98-
}
99-
100-
macro_rules! assert_eq {
101-
($l:expr, $r: expr) => {
102-
if $l != $r {
103-
panic(stringify!($l != $r));
104-
}
105-
}
106-
}
107-
108108
struct Unique<T: ?Sized> {
109109
pointer: *const T,
110110
_marker: PhantomData<T>,
@@ -296,6 +296,11 @@ fn main() {
296296
unsafe {
297297
global_asm_test();
298298
}
299+
300+
// Both statics have a reference that points to the same anonymous allocation.
301+
static REF1: &u8 = &42;
302+
static REF2: &u8 = REF1;
303+
assert_eq!(*REF1, *REF2);
299304
}
300305

301306
#[cfg(all(not(jit), target_os = "linux"))]

compiler/rustc_codegen_cranelift/example/std_example.rs

+3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ fn main() {
4848
assert_eq!(2.3f32.copysign(-1.0), -2.3f32);
4949
println!("{}", 2.3f32.powf(2.0));
5050

51+
assert_eq!(i64::MAX.checked_mul(2), None);
52+
5153
assert_eq!(-128i8, (-128i8).saturating_sub(1));
5254
assert_eq!(127i8, 127i8.saturating_sub(-128));
5355
assert_eq!(-128i8, (-128i8).saturating_add(-128));
@@ -84,6 +86,7 @@ fn main() {
8486
assert_eq!(houndred_i128 as f64, 100.0);
8587
assert_eq!(houndred_f32 as i128, 100);
8688
assert_eq!(houndred_f64 as i128, 100);
89+
assert_eq!(1u128.rotate_left(2), 4);
8790

8891
// Test signed 128bit comparing
8992
let max = usize::MAX as i128;
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2021-03-29"
2+
channel = "nightly-2021-04-28"
33
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

compiler/rustc_codegen_cranelift/scripts/ext_config.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
set -e
66

77
export CG_CLIF_DISPLAY_CG_TIME=1
8-
export CG_CLIF_INCR_CACHE_DISABLED=1
8+
export CG_CLIF_DISABLE_INCR_CACHE=1
99

1010
export HOST_TRIPLE=$(rustc -vV | grep host | cut -d: -f2 | tr -d " ")
1111
export TARGET_TRIPLE=${TARGET_TRIPLE:-$HOST_TRIPLE}

compiler/rustc_codegen_cranelift/scripts/setup_rust_fork.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ index d95b5b7f17f..00b6f0e3635 100644
4545
[dependencies]
4646
core = { path = "../core" }
4747
-compiler_builtins = { version = "0.1.39", features = ['rustc-dep-of-std'] }
48-
+compiler_builtins = { version = "0.1.39", features = ['rustc-dep-of-std', 'no-asm'] }
48+
+compiler_builtins = { version = "0.1.40", features = ['rustc-dep-of-std', 'no-asm'] }
4949
5050
[dev-dependencies]
5151
rand = "0.7"

0 commit comments

Comments
 (0)