Skip to content

Commit

Permalink
Switch to use mips-zkm-zkvm-elf toolchain (#192)
Browse files Browse the repository at this point in the history
Co-authored-by: Stephen <81497928+eigmax@users.noreply.github.com>
  • Loading branch information
qethu and eigmax authored Dec 19, 2024
1 parent 8412e71 commit 448afce
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
2 changes: 0 additions & 2 deletions build/src/command/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ pub(crate) fn create_local_command(
// toolchain.
command
.current_dir(canonicalized_program_dir)
.env("RUSTUP_TOOLCHAIN", "nightly-2023-04-06")
.env("CARGO_ENCODED_RUSTFLAGS", get_rust_compiler_flags())
.env_remove("RUSTC")
.env(
"CARGO_TARGET_DIR",
program_metadata.target_directory.join(HELPER_TARGET_SUBDIR),
Expand Down
10 changes: 7 additions & 3 deletions build/src/command/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,17 @@ pub(crate) fn get_program_build_args(args: &BuildArgs) -> Vec<String> {
pub(crate) fn get_rust_compiler_flags() -> String {
let rust_flags = [
"-C".to_string(),
"target-cpu=mips32".to_string(),
"--cfg".to_string(),
"target_os=\"zkvm\"".to_string(),
"target-cpu=mips2".to_string(),
"-C".to_string(),
"target-feature=+crt-static".to_string(),
"-C".to_string(),
"link-arg=-nostdlib".to_string(),
"-C".to_string(),
"link-arg=-g".to_string(),
//"-C".to_string(),
//"link-arg=-nostartfiles".to_string(),
"-C".to_string(),
"link-arg=--entry=main".to_string(),
];
rust_flags.join("\x1f")
}
Expand Down
4 changes: 2 additions & 2 deletions build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ pub use build::execute_build_program;

use clap::Parser;

pub const BUILD_TARGET: &str = "mips-unknown-linux-musl";
//pub const DEFAULT_TAG: &str = "v1.0.0";
pub const BUILD_TARGET: &str = "mips-zkm-zkvm-elf";
// const DEFAULT_TAG: &str = "v1.0.0";
pub const DEFAULT_OUTPUT_DIR: &str = "elf";
pub const HELPER_TARGET_SUBDIR: &str = "elf-compilation";

Expand Down
2 changes: 1 addition & 1 deletion prover/examples/revme/host/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ fn prove_multi_seg_common(
result
}

const ELF_PATH: &str = "../guest/elf/mips-unknown-linux-musl";
const ELF_PATH: &str = "../guest/elf/mips-zkm-zkvm-elf";

fn prove_revm() {
// 1. split ELF into segs
Expand Down
2 changes: 1 addition & 1 deletion prover/examples/sha2-precompile/host/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const D: usize = 2;
type C = PoseidonGoldilocksConfig;
type F = <C as GenericConfig<D>>::F;

const ELF_PATH: &str = "../guest/elf/mips-unknown-linux-musl";
const ELF_PATH: &str = "../guest/elf/mips-zkm-zkvm-elf";

fn u32_array_to_u8_vec(u32_array: &[u32; 8]) -> Vec<u8> {
let mut u8_vec = Vec::with_capacity(u32_array.len() * 4);
Expand Down
2 changes: 1 addition & 1 deletion prover/examples/sha2-rust/host/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ fn prove_multi_seg_common(
result
}

const ELF_PATH: &str = "../guest/elf/mips-unknown-linux-musl";
const ELF_PATH: &str = "../guest/elf/mips-zkm-zkvm-elf";

fn prove_sha2_rust() {
// 1. split ELF into segs
Expand Down

0 comments on commit 448afce

Please sign in to comment.