Skip to content

Commit 1386813

Browse files
committed
Newer Rust and LLVM
Codegen support for RV32E was added to mainline LLVM. Upgrade to newer Rust and newer LLVM, and drop most of the patches.
1 parent 627e08a commit 1386813

File tree

5 files changed

+17
-28
lines changed

5 files changed

+17
-28
lines changed

clone.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -euo pipefail
44

55
source config.sh -rust_commit
66

7-
git clone "https://github.com/succinctlabs/rust.git" --depth 1 --single-branch --branch succinct
7+
git clone "https://github.com/rust-lang/rust.git" --depth 1
88
cd rust
99
git fetch --depth 1 origin $RUST_COMMIT
1010
git checkout FETCH_HEAD

config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
param1=${1:-}
44

5-
export RUST_COMMIT=295b693dfe72d0ac2d0924eb84af39e364d9c3e3
5+
export RUST_COMMIT=9b00956e56009bab2aa15d7bff10916599e3d6d6
66

77
# If -rust_commit specified then only export the rust commit variable
88
if [ "$param1" == "-rust_commit" ]; then

patch.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,3 @@ set -euo pipefail
55
cd rust
66
patch -p1 < ../patches/rust.patch
77
cp ../patches/config.toml ./
8-
9-
cd src/llvm-project
10-
patch -p1 < ../../../patches/llvm-D70401.patch
11-
patch -p1 < ../../../patches/compiler-rt.patch

patches/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
change-id = 116881
1+
change-id = 121754
22

33
[build]
44
target = ["riscv32em-athena-zkvm-elf"]

patches/rust.patch

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,46 @@
11
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
2-
index 235ab0b6e7d..87b204d711a 100644
2+
index 941d767b..1b4004c4 100644
33
--- a/compiler/rustc_target/src/spec/mod.rs
44
+++ b/compiler/rustc_target/src/spec/mod.rs
5-
@@ -1635,6 +1635,7 @@ fn $module() {
5+
@@ -1618,6 +1618,7 @@ fn $module() {
66

77
("x86_64-unikraft-linux-musl", x86_64_unikraft_linux_musl),
88

99
+ ("riscv32em-athena-zkvm-elf", riscv32em_athena_zkvm_elf),
1010
("riscv32i-unknown-none-elf", riscv32i_unknown_none_elf),
11-
("riscv32im-succinct-zkvm-elf", riscv32im_succinct_zkvm_elf),
11+
("riscv32im-risc0-zkvm-elf", riscv32im_risc0_zkvm_elf),
1212
("riscv32im-unknown-none-elf", riscv32im_unknown_none_elf),
13-
diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
14-
index 8e9d342e65d..d2dae37d73a 100644
15-
--- a/src/bootstrap/src/lib.rs
16-
+++ b/src/bootstrap/src/lib.rs
17-
@@ -101,7 +101,7 @@
18-
// #[cfg(bootstrap)] zkvm
19-
(Some(Mode::Std), "target_os", Some(&["zkvm"])),
20-
// #[cfg(bootstrap)] succinct
21-
- (Some(Mode::Std), "target_vendor", Some(&["succinct"])),
22-
+ (Some(Mode::Std), "target_vendor", Some(&["athena", "succinct"])),
23-
(Some(Mode::Std), "target_arch", Some(&["asmjs", "spirv", "nvptx", "xtensa"])),
24-
/* Extra names used by dependencies */
25-
// FIXME: Used by serde_json, but we should not be triggering on external dependencies.
2613
diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs
27-
index ea620c64f3c..28363a2cb8a 100644
14+
index eab9138b..60507063 100644
2815
--- a/src/tools/build-manifest/src/main.rs
2916
+++ b/src/tools/build-manifest/src/main.rs
30-
@@ -119,6 +119,7 @@
17+
@@ -123,6 +123,7 @@
3118
"powerpc-unknown-linux-gnu",
3219
"powerpc64-unknown-linux-gnu",
3320
"powerpc64le-unknown-linux-gnu",
3421
+ "riscv32e-athena-zkvm-elf",
3522
"riscv32i-unknown-none-elf",
36-
"riscv32im-succinct-zkvm-elf",
23+
"riscv32im-risc0-zkvm-elf",
3724
"riscv32im-unknown-none-elf",
3825
diff --git a/compiler/rustc_target/src/spec/targets/riscv32em_athena_zkvm_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32em_athena_zkvm_elf.rs
3926
new file mode 100644
40-
index 00000000000..0ac603543b9
27+
index 00000000..2a95006c
4128
--- /dev/null
4229
+++ b/compiler/rustc_target/src/spec/targets/riscv32em_athena_zkvm_elf.rs
43-
@@ -0,0 +1,38 @@
30+
@@ -0,0 +1,44 @@
4431
+use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel};
4532
+use crate::spec::{Target, TargetOptions};
4633
+
4734
+pub fn target() -> Target {
4835
+ Target {
4936
+ data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
5037
+ llvm_target: "riscv32".into(),
38+
+ metadata: crate::spec::TargetMetadata {
39+
+ description: None,
40+
+ tier: None,
41+
+ host_tools: None,
42+
+ std: None,
43+
+ },
5144
+ pointer_width: 32,
5245
+ arch: "riscv32".into(),
5346
+

0 commit comments

Comments
 (0)