Skip to content

Commit 4cfb885

Browse files
authored
Merge pull request #1140 from bjorn3/no_more_oldbe
Remove support for the old x86 Cranelift backend
2 parents 92c1b85 + 537db9a commit 4cfb885

18 files changed

+327
-500
lines changed

.github/workflows/main.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
os: [ubuntu-latest, macos-latest]
15-
env:
16-
- BACKEND: ""
17-
- BACKEND: --oldbe
1815

1916
steps:
2017
- uses: actions/checkout@v2
@@ -54,7 +51,7 @@ jobs:
5451
export COMPILE_RUNS=2
5552
export RUN_RUNS=2
5653
57-
./test.sh $BACKEND
54+
./test.sh
5855
5956
- name: Package prebuilt cg_clif
6057
run: tar cvfJ cg_clif.tar.xz build

Cargo.lock

+20-20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ 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", "x86", "x64"] }
12+
cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main", features = ["unwind", "x64"] }
1313
cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main" }
1414
cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main" }
1515
cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main", optional = true }
@@ -38,7 +38,6 @@ smallvec = "1.6.1"
3838
default = ["jit", "inline_asm"]
3939
jit = ["cranelift-jit", "libloading"]
4040
inline_asm = []
41-
oldbe = []
4241

4342
[profile.dev]
4443
# By compiling dependencies with optimizations, performing tests gets much faster.

build.sh

+3-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ set -e
55
export CHANNEL="release"
66
build_sysroot="clif"
77
target_dir='build'
8-
oldbe=''
98
while [[ $# != 0 ]]; do
109
case $1 in
1110
"--debug")
@@ -19,12 +18,9 @@ while [[ $# != 0 ]]; do
1918
target_dir=$2
2019
shift
2120
;;
22-
"--oldbe")
23-
oldbe='--features oldbe'
24-
;;
2521
*)
2622
echo "Unknown flag '$1'"
27-
echo "Usage: ./build.sh [--debug] [--sysroot none|clif|llvm] [--target-dir DIR] [--oldbe]"
23+
echo "Usage: ./build.sh [--debug] [--sysroot none|clif|llvm] [--target-dir DIR]"
2824
exit 1
2925
;;
3026
esac
@@ -44,9 +40,9 @@ else
4440
exit 1
4541
fi
4642
if [[ "$CHANNEL" == "release" ]]; then
47-
cargo build $oldbe --release
43+
cargo build --release
4844
else
49-
cargo build $oldbe
45+
cargo build
5046
fi
5147

5248
source scripts/ext_config.sh

build_sysroot/prepare_sysroot_src.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ git clone https://github.com/rust-lang/compiler-builtins.git || echo "rust-lang/
3333
pushd compiler-builtins
3434
git checkout -- .
3535
git checkout 0.1.39
36-
git apply ../../crate_patches/0001-compiler-builtins-Remove-rotate_left-from-Int.patch
36+
git apply ../../crate_patches/000*-compiler-builtins-*.patch
3737
popd
3838

3939
echo "Successfully prepared sysroot source for building"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
From 1d574bf5e32d51641dcacaf8ef777e95b44f6f2a Mon Sep 17 00:00:00 2001
2+
From: bjorn3 <[email protected]>
3+
Date: Thu, 18 Feb 2021 18:30:55 +0100
4+
Subject: [PATCH] Disable 128bit atomic operations
5+
6+
Cranelift doesn't support them yet
7+
---
8+
src/mem/mod.rs | 12 ------------
9+
1 file changed, 12 deletions(-)
10+
11+
diff --git a/src/mem/mod.rs b/src/mem/mod.rs
12+
index 107762c..2d1ae10 100644
13+
--- a/src/mem/mod.rs
14+
+++ b/src/mem/mod.rs
15+
@@ -137,10 +137,6 @@ intrinsics! {
16+
pub extern "C" fn __llvm_memcpy_element_unordered_atomic_8(dest: *mut u64, src: *const u64, bytes: usize) -> () {
17+
memcpy_element_unordered_atomic(dest, src, bytes);
18+
}
19+
- #[cfg(target_has_atomic_load_store = "128")]
20+
- pub extern "C" fn __llvm_memcpy_element_unordered_atomic_16(dest: *mut u128, src: *const u128, bytes: usize) -> () {
21+
- memcpy_element_unordered_atomic(dest, src, bytes);
22+
- }
23+
24+
#[cfg(target_has_atomic_load_store = "8")]
25+
pub extern "C" fn __llvm_memmove_element_unordered_atomic_1(dest: *mut u8, src: *const u8, bytes: usize) -> () {
26+
@@ -158,10 +154,6 @@ intrinsics! {
27+
pub extern "C" fn __llvm_memmove_element_unordered_atomic_8(dest: *mut u64, src: *const u64, bytes: usize) -> () {
28+
memmove_element_unordered_atomic(dest, src, bytes);
29+
}
30+
- #[cfg(target_has_atomic_load_store = "128")]
31+
- pub extern "C" fn __llvm_memmove_element_unordered_atomic_16(dest: *mut u128, src: *const u128, bytes: usize) -> () {
32+
- memmove_element_unordered_atomic(dest, src, bytes);
33+
- }
34+
35+
#[cfg(target_has_atomic_load_store = "8")]
36+
pub extern "C" fn __llvm_memset_element_unordered_atomic_1(s: *mut u8, c: u8, bytes: usize) -> () {
37+
@@ -179,8 +171,4 @@ intrinsics! {
38+
pub extern "C" fn __llvm_memset_element_unordered_atomic_8(s: *mut u64, c: u8, bytes: usize) -> () {
39+
memset_element_unordered_atomic(s, c, bytes);
40+
}
41+
- #[cfg(target_has_atomic_load_store = "128")]
42+
- pub extern "C" fn __llvm_memset_element_unordered_atomic_16(s: *mut u128, c: u8, bytes: usize) -> () {
43+
- memset_element_unordered_atomic(s, c, bytes);
44+
- }
45+
}
46+
--
47+
2.26.2.7.g19db9cfb68
48+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
From 894e07dfec2624ba539129b1c1d63e1d7d812bda Mon Sep 17 00:00:00 2001
2+
From: bjorn3 <[email protected]>
3+
Date: Thu, 18 Feb 2021 18:45:28 +0100
4+
Subject: [PATCH] Disable 128bit atomic operations
5+
6+
Cranelift doesn't support them yet
7+
---
8+
library/core/src/sync/atomic.rs | 38 ---------------------------------
9+
library/core/tests/atomic.rs | 4 ----
10+
library/std/src/panic.rs | 6 ------
11+
3 files changed, 48 deletions(-)
12+
13+
diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs
14+
index 81c9e1d..65c9503 100644
15+
--- a/library/core/src/sync/atomic.rs
16+
+++ b/library/core/src/sync/atomic.rs
17+
@@ -2228,44 +2228,6 @@ atomic_int! {
18+
"AtomicU64::new(0)",
19+
u64 AtomicU64 ATOMIC_U64_INIT
20+
}
21+
-#[cfg(target_has_atomic_load_store = "128")]
22+
-atomic_int! {
23+
- cfg(target_has_atomic = "128"),
24+
- cfg(target_has_atomic_equal_alignment = "128"),
25+
- unstable(feature = "integer_atomics", issue = "32976"),
26+
- unstable(feature = "integer_atomics", issue = "32976"),
27+
- unstable(feature = "integer_atomics", issue = "32976"),
28+
- unstable(feature = "integer_atomics", issue = "32976"),
29+
- unstable(feature = "integer_atomics", issue = "32976"),
30+
- unstable(feature = "integer_atomics", issue = "32976"),
31+
- rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
32+
- unstable(feature = "integer_atomics", issue = "32976"),
33+
- "i128", "../../../std/primitive.i128.html",
34+
- "#![feature(integer_atomics)]\n\n",
35+
- atomic_min, atomic_max,
36+
- 16,
37+
- "AtomicI128::new(0)",
38+
- i128 AtomicI128 ATOMIC_I128_INIT
39+
-}
40+
-#[cfg(target_has_atomic_load_store = "128")]
41+
-atomic_int! {
42+
- cfg(target_has_atomic = "128"),
43+
- cfg(target_has_atomic_equal_alignment = "128"),
44+
- unstable(feature = "integer_atomics", issue = "32976"),
45+
- unstable(feature = "integer_atomics", issue = "32976"),
46+
- unstable(feature = "integer_atomics", issue = "32976"),
47+
- unstable(feature = "integer_atomics", issue = "32976"),
48+
- unstable(feature = "integer_atomics", issue = "32976"),
49+
- unstable(feature = "integer_atomics", issue = "32976"),
50+
- rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
51+
- unstable(feature = "integer_atomics", issue = "32976"),
52+
- "u128", "../../../std/primitive.u128.html",
53+
- "#![feature(integer_atomics)]\n\n",
54+
- atomic_umin, atomic_umax,
55+
- 16,
56+
- "AtomicU128::new(0)",
57+
- u128 AtomicU128 ATOMIC_U128_INIT
58+
-}
59+
60+
macro_rules! atomic_int_ptr_sized {
61+
( $($target_pointer_width:literal $align:literal)* ) => { $(
62+
diff --git a/library/core/tests/atomic.rs b/library/core/tests/atomic.rs
63+
index 2d1e449..cb6da5d 100644
64+
--- a/library/core/tests/atomic.rs
65+
+++ b/library/core/tests/atomic.rs
66+
@@ -145,10 +145,6 @@ fn atomic_alignment() {
67+
assert_eq!(align_of::<AtomicU64>(), size_of::<AtomicU64>());
68+
#[cfg(target_has_atomic = "64")]
69+
assert_eq!(align_of::<AtomicI64>(), size_of::<AtomicI64>());
70+
- #[cfg(target_has_atomic = "128")]
71+
- assert_eq!(align_of::<AtomicU128>(), size_of::<AtomicU128>());
72+
- #[cfg(target_has_atomic = "128")]
73+
- assert_eq!(align_of::<AtomicI128>(), size_of::<AtomicI128>());
74+
#[cfg(target_has_atomic = "ptr")]
75+
assert_eq!(align_of::<AtomicUsize>(), size_of::<AtomicUsize>());
76+
#[cfg(target_has_atomic = "ptr")]
77+
diff --git a/library/std/src/panic.rs b/library/std/src/panic.rs
78+
index 89a822a..779fd88 100644
79+
--- a/library/std/src/panic.rs
80+
+++ b/library/std/src/panic.rs
81+
@@ -279,9 +279,6 @@ impl RefUnwindSafe for atomic::AtomicI32 {}
82+
#[cfg(target_has_atomic_load_store = "64")]
83+
#[stable(feature = "integer_atomics_stable", since = "1.34.0")]
84+
impl RefUnwindSafe for atomic::AtomicI64 {}
85+
-#[cfg(target_has_atomic_load_store = "128")]
86+
-#[unstable(feature = "integer_atomics", issue = "32976")]
87+
-impl RefUnwindSafe for atomic::AtomicI128 {}
88+
89+
#[cfg(target_has_atomic_load_store = "ptr")]
90+
#[stable(feature = "unwind_safe_atomic_refs", since = "1.14.0")]
91+
@@ -298,9 +295,6 @@ impl RefUnwindSafe for atomic::AtomicU32 {}
92+
#[cfg(target_has_atomic_load_store = "64")]
93+
#[stable(feature = "integer_atomics_stable", since = "1.34.0")]
94+
impl RefUnwindSafe for atomic::AtomicU64 {}
95+
-#[cfg(target_has_atomic_load_store = "128")]
96+
-#[unstable(feature = "integer_atomics", issue = "32976")]
97+
-impl RefUnwindSafe for atomic::AtomicU128 {}
98+
99+
#[cfg(target_has_atomic_load_store = "8")]
100+
#[stable(feature = "unwind_safe_atomic_refs", since = "1.14.0")]
101+
--
102+
2.26.2.7.g19db9cfb68
103+

scripts/config.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export RUSTC=$dir"/bin/cg_clif"
2626
export RUSTDOCFLAGS=$linker' -Cpanic=abort -Zpanic-abort-tests '\
2727
'-Zcodegen-backend='$dir'/lib/librustc_codegen_cranelift.'$dylib_ext' --sysroot '$dir
2828

29-
# FIXME remove once the atomic shim is gone
29+
# FIXME fix `#[linkage = "extern_weak"]` without this
3030
if [[ "$unamestr" == 'Darwin' ]]; then
3131
export RUSTFLAGS="$RUSTFLAGS -Clink-arg=-undefined -Clink-arg=dynamic_lookup"
3232
fi

0 commit comments

Comments
 (0)