Skip to content

Add mips-zkm-zkvm-elf triple #134721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1679,6 +1679,7 @@ supported_targets! {

("mips-unknown-linux-uclibc", mips_unknown_linux_uclibc),
("mipsel-unknown-linux-uclibc", mipsel_unknown_linux_uclibc),
("mips-zkm-zkvm-elf", mips_zkm_zkvm_elf),

("i686-linux-android", i686_linux_android),
("x86_64-linux-android", x86_64_linux_android),
Expand Down
43 changes: 43 additions & 0 deletions compiler/rustc_target/src/spec/targets/mips_zkm_zkvm_elf.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
use crate::abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};

pub(crate) fn target() -> Target {
Target {
data_layout: "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".into(),
llvm_target: "mips".into(),
metadata: crate::spec::TargetMetadata {
description: Some("ZKM's zero-knowledge Virtual Machine (MIPS32r2 ISA)".into()),
tier: Some(3),
host_tools: Some(false),
std: None, // ?
},
pointer_width: 32,
arch: "mips".into(),

options: TargetOptions {
os: "zkvm".into(),
vendor: "zkm".into(),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
linker: Some("rust-lld".into()),
endian: Endian::Big,
cpu: "mips32r2".into(),

// Some crates (*cough* crossbeam) assume you have 64 bit
// atomics if the target name is not in a hardcoded list.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, as for crossbeam, this issue was already resolved over a year ago. crossbeam-rs/crossbeam#1033

// Since zkvm is singlethreaded and all operations are
// atomic, I guess we can just say we support 64-bit
// atomics.
max_atomic_width: Some(64),
atomic_cas: true,

features: "+mips32r2,+soft-float,+noabicalls".into(),
executables: true,
panic_strategy: PanicStrategy::Abort,
relocation_model: RelocModel::Static,
emit_debug_gdb_scripts: false,
eh_frame_header: false,
singlethread: true,
..Default::default()
},
}
}
1 change: 1 addition & 0 deletions src/tools/build-manifest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ static TARGETS: &[&str] = &[
"mipsisa64r6el-unknown-linux-gnuabi64",
"mipsel-unknown-linux-gnu",
"mipsel-unknown-linux-musl",
"mips-zkm-zkvm-elf",
"nvptx64-nvidia-cuda",
"powerpc-unknown-linux-gnu",
"powerpc64-unknown-linux-gnu",
Expand Down
Loading