Skip to content

Commit ee570b1

Browse files
committed
Sync rustc_codegen_cranelift 'ddd4ce25535cf71203ba3700896131ce55fde795'
1 parent fa559fb commit ee570b1

Some content is hidden

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

43 files changed

+784
-1243
lines changed

.github/workflows/main.yml

Lines changed: 7 additions & 0 deletions
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

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
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": [

Cargo.lock

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

Cargo.toml

Lines changed: 4 additions & 2 deletions
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

Readme.md

Lines changed: 3 additions & 2 deletions
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

build_sysroot/Cargo.lock

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

build_sysroot/prepare_sysroot_src.sh

Lines changed: 1 addition & 1 deletion
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

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

Lines changed: 2 additions & 2 deletions
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
}

docs/env_vars.md

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

example/mini_core_hello_world.rs

Lines changed: 24 additions & 19 deletions
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"))]

0 commit comments

Comments
 (0)