1
1
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
2
- index 6c698c5b0..357cd0e3e 100644
2
+ index 235ab0b6e7d..87b204d711a 100644
3
3
--- a/compiler/rustc_target/src/spec/mod.rs
4
4
+++ b/compiler/rustc_target/src/spec/mod.rs
5
- @@ -1596 ,6 +1596 ,7 @@ fn $module() {
5
+ @@ -1635 ,6 +1635 ,7 @@ fn $module() {
6
6
7
7
("x86_64-unikraft-linux-musl", x86_64_unikraft_linux_musl),
8
8
9
9
+ ("riscv32em-athena-zkvm-elf", riscv32em_athena_zkvm_elf),
10
10
("riscv32i-unknown-none-elf", riscv32i_unknown_none_elf),
11
- ("riscv32im-risc0 -zkvm-elf", riscv32im_risc0_zkvm_elf ),
11
+ ("riscv32im-succinct -zkvm-elf", riscv32im_succinct_zkvm_elf ),
12
12
("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.
26
+ diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs
27
+ index ea620c64f3c..28363a2cb8a 100644
28
+ --- a/src/tools/build-manifest/src/main.rs
29
+ +++ b/src/tools/build-manifest/src/main.rs
30
+ @@ -119,6 +119,7 @@
31
+ "powerpc-unknown-linux-gnu",
32
+ "powerpc64-unknown-linux-gnu",
33
+ "powerpc64le-unknown-linux-gnu",
34
+ + "riscv32e-athena-zkvm-elf",
35
+ "riscv32i-unknown-none-elf",
36
+ "riscv32im-succinct-zkvm-elf",
37
+ "riscv32im-unknown-none-elf",
13
38
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
14
39
new file mode 100644
15
- index 000000000..7a09c78a4
40
+ index 00000000000..0ac603543b9
16
41
--- /dev/null
17
42
+++ b/compiler/rustc_target/src/spec/targets/riscv32em_athena_zkvm_elf.rs
18
- @@ -0,0 +1,29 @@
19
- + use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
43
+ @@ -0,0 +1,38 @@
44
+ + use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel};
45
+ + use crate::spec::{Target, TargetOptions};
20
46
+
21
47
+ pub fn target() -> Target {
22
48
+ Target {
@@ -26,86 +52,30 @@ index 000000000..7a09c78a4
26
52
+ arch: "riscv32".into(),
27
53
+
28
54
+ options: TargetOptions {
55
+ + os: "zkvm".into(),
56
+ + vendor: "athena".into(),
29
57
+ linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
30
58
+ linker: Some("rust-lld".into()),
31
59
+ cpu: "generic-rv32".into(),
32
- + features: "+e,+m".into(),
33
- + llvm_abiname: "ilp32e".into(),
60
+ +
61
+ + // Some crates (*cough* crossbeam) assume you have 64 bit
62
+ + // atomics if the target name is not in a hardcoded list.
63
+ + // Since zkvm is singlethreaded and all operations are
64
+ + // atomic, I guess we can just say we support 64-bit
65
+ + // atomics.
34
66
+ max_atomic_width: Some(64),
35
- + os: "zkvm".into(),
36
- + vendor: "athena".into(),
37
- + singlethread: true,
38
67
+ atomic_cas: true,
68
+ +
69
+ + features: "+e,+m".into(),
70
+ + llvm_abiname: "ilp32e".into(),
39
71
+ executables: true,
40
72
+ panic_strategy: PanicStrategy::Abort,
41
73
+ relocation_model: RelocModel::Static,
42
74
+ emit_debug_gdb_scripts: false,
43
75
+ eh_frame_header: false,
76
+ + singlethread: true,
44
77
+ ..Default::default()
45
78
+ },
46
79
+ }
47
80
+ }
48
- diff --git a/library/std/src/sys/pal/zkvm/args.rs b/library/std/src/sys/pal/zkvm/args.rs
49
- index 7753cf63840..583c16e3a47 100644
50
- --- a/library/std/src/sys/pal/zkvm/args.rs
51
- +++ b/library/std/src/sys/pal/zkvm/args.rs
52
- @@ -1,6 +1,7 @@
53
- use super::{abi, WORD_SIZE};
54
- use crate::ffi::OsString;
55
- use crate::fmt;
56
- + use crate::sys::os_str;
57
- use crate::sys_common::FromInner;
58
-
59
- pub struct Args {
60
- @@ -33,7 +34,7 @@ fn argv(i: usize) -> OsString {
61
- // "os_str".
62
- let arg_bytes: &[u8] =
63
- unsafe { crate::slice::from_raw_parts(words.cast() as *const u8, arg_len) };
64
- - OsString::from_inner(super::os_str::Buf { inner: arg_bytes.to_vec() })
65
- + OsString::from_inner(os_str::Buf { inner: arg_bytes.to_vec() })
66
- }
67
- }
68
-
69
- diff --git a/library/std/src/sys/pal/zkvm/os.rs b/library/std/src/sys/pal/zkvm/os.rs
70
- index d8739ee3824..759beb2d306 100644
71
- --- a/library/std/src/sys/pal/zkvm/os.rs
72
- +++ b/library/std/src/sys/pal/zkvm/os.rs
73
- @@ -5,6 +5,7 @@
74
- use crate::io;
75
- use crate::marker::PhantomData;
76
- use crate::path::{self, PathBuf};
77
- + use crate::sys::os_str;
78
- use crate::sys_common::FromInner;
79
-
80
- pub fn errno() -> i32 {
81
- @@ -111,7 +112,7 @@ pub fn getenv(varname: &OsStr) -> Option<OsString> {
82
- // reimplement "os_str" instead of just using the generic unix
83
- // "os_str".
84
- let u8s: &[u8] = unsafe { crate::slice::from_raw_parts(words.cast() as *const u8, nbytes) };
85
- - Some(OsString::from_inner(super::os_str::Buf { inner: u8s.to_vec() }))
86
- + Some(OsString::from_inner(os_str::Buf { inner: u8s.to_vec() }))
87
- }
88
-
89
- pub fn setenv(_: &OsStr, _: &OsStr) -> io::Result<()> {
90
- diff --git a/library/std/src/sys/pal/zkvm/mod.rs b/library/std/src/sys/pal/zkvm/mod.rs
91
- index 7f221dc4fd9..ebdcb6abbdb 100644
92
- --- a/library/std/src/sys/pal/zkvm/mod.rs
93
- +++ b/library/std/src/sys/pal/zkvm/mod.rs
94
- @@ -12,8 +12,6 @@
95
- pub mod alloc;
96
- #[path = "../zkvm/args.rs"]
97
- pub mod args;
98
- - #[path = "../unix/cmath.rs"]
99
- - pub mod cmath;
100
- pub mod env;
101
- #[path = "../unsupported/fs.rs"]
102
- pub mod fs;
103
- @@ -24,8 +22,6 @@
104
- #[path = "../unsupported/once.rs"]
105
- pub mod once;
106
- pub mod os;
107
- - #[path = "../unix/os_str.rs"]
108
- - pub mod os_str;
109
- #[path = "../unix/path.rs"]
110
- pub mod path;
111
- #[path = "../unsupported/pipe.rs"]
81
+ +
0 commit comments