mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-22 07:57:57 +00:00
experimentally switch to rv64
Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
Generated
+7
-5
@@ -1349,7 +1349,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "polkavm"
|
||||
version = "0.9.3"
|
||||
source = "git+https://github.com/koute/polkavm.git#4ca06cc1b7cb435b2b92e81e30c2eb0e988f563e"
|
||||
source = "git+https://github.com/xermicus/polkavm.git?branch=master_byteswap#73ab6d953c13de26ab75ed11707aa6d902ba47ea"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
@@ -1361,7 +1361,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "polkavm-assembler"
|
||||
version = "0.9.0"
|
||||
source = "git+https://github.com/koute/polkavm.git#4ca06cc1b7cb435b2b92e81e30c2eb0e988f563e"
|
||||
source = "git+https://github.com/xermicus/polkavm.git?branch=master_byteswap#73ab6d953c13de26ab75ed11707aa6d902ba47ea"
|
||||
dependencies = [
|
||||
"log",
|
||||
]
|
||||
@@ -1369,7 +1369,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "polkavm-common"
|
||||
version = "0.9.0"
|
||||
source = "git+https://github.com/koute/polkavm.git#4ca06cc1b7cb435b2b92e81e30c2eb0e988f563e"
|
||||
source = "git+https://github.com/xermicus/polkavm.git?branch=master_byteswap#73ab6d953c13de26ab75ed11707aa6d902ba47ea"
|
||||
dependencies = [
|
||||
"log",
|
||||
]
|
||||
@@ -1377,7 +1377,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "polkavm-linker"
|
||||
version = "0.9.2"
|
||||
source = "git+https://github.com/koute/polkavm.git#4ca06cc1b7cb435b2b92e81e30c2eb0e988f563e"
|
||||
source = "git+https://github.com/xermicus/polkavm.git?branch=master_byteswap#73ab6d953c13de26ab75ed11707aa6d902ba47ea"
|
||||
dependencies = [
|
||||
"gimli",
|
||||
"hashbrown 0.14.3",
|
||||
@@ -1391,7 +1391,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "polkavm-linux-raw"
|
||||
version = "0.9.0"
|
||||
source = "git+https://github.com/koute/polkavm.git#4ca06cc1b7cb435b2b92e81e30c2eb0e988f563e"
|
||||
source = "git+https://github.com/xermicus/polkavm.git?branch=master_byteswap#73ab6d953c13de26ab75ed11707aa6d902ba47ea"
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
@@ -1675,6 +1675,8 @@ dependencies = [
|
||||
"polkavm",
|
||||
"revive-differential",
|
||||
"revive-solidity",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha1",
|
||||
]
|
||||
|
||||
|
||||
+3
-3
@@ -27,9 +27,9 @@ path-slash = "0.2"
|
||||
rayon = "1.8"
|
||||
structopt = { version = "0.3", default-features = false }
|
||||
rand = "0.8"
|
||||
polkavm-common = { git = "https://github.com/koute/polkavm.git" }
|
||||
polkavm-linker = { git = "https://github.com/koute/polkavm.git" }
|
||||
polkavm = { git = "https://github.com/koute/polkavm.git" }
|
||||
polkavm-common = { branch = "master_byteswap", git = "https://github.com/xermicus/polkavm.git" }
|
||||
polkavm-linker = { branch = "master_byteswap", git = "https://github.com/xermicus/polkavm.git" }
|
||||
polkavm = { branch = "master_byteswap", git = "https://github.com/xermicus/polkavm.git" }
|
||||
alloy-primitives = "0.6"
|
||||
alloy-sol-types = "0.6"
|
||||
env_logger = { version = "0.10.0", default-features = false }
|
||||
|
||||
+3
-3
@@ -37,7 +37,7 @@ cd ../compiler-rt
|
||||
mkdir -p build
|
||||
cd build
|
||||
|
||||
CFLAGS="--target=riscv32 -march=rv32em -mabi=ilp32e -nostdlib -nodefaultlibs -mcpu=generic-rv32"
|
||||
CFLAGS="--target=riscv64 -march=rv64em -mabi=lp64e -nostdlib -nodefaultlibs -mcpu=generic-rv64"
|
||||
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \
|
||||
-DCOMPILER_RT_BUILD_BUILTINS=ON \
|
||||
-DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
|
||||
@@ -46,8 +46,8 @@ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \
|
||||
-DCOMPILER_RT_BUILD_SANITIZERS=OFF \
|
||||
-DCOMPILER_RT_BUILD_XRAY=OFF \
|
||||
-DCMAKE_C_COMPILER=$INSTALL_DIR/bin/clang \
|
||||
-DCMAKE_C_COMPILER_TARGET="riscv32" \
|
||||
-DCMAKE_ASM_COMPILER_TARGET="riscv32" \
|
||||
-DCMAKE_C_COMPILER_TARGET="riscv64" \
|
||||
-DCMAKE_ASM_COMPILER_TARGET="riscv64" \
|
||||
-DCMAKE_AR=$INSTALL_DIR/bin/llvm-ar \
|
||||
-DCMAKE_NM=$INSTALL_DIR/bin/llvm-nm \
|
||||
-DCMAKE_RANLIB=$INSTALL_DIR/bin/llvm-ranlib \
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::{env, fs, io::Read, path::Path, process::Command};
|
||||
|
||||
fn main() {
|
||||
let lib = "libclang_rt.builtins-riscv32.a";
|
||||
let lib = "libclang_rt.builtins-riscv64.a";
|
||||
let mut llvm_lib_dir = String::new();
|
||||
|
||||
Command::new("llvm-config")
|
||||
@@ -16,7 +16,7 @@ fn main() {
|
||||
let lib_path = std::path::PathBuf::from(llvm_lib_dir.trim())
|
||||
.join("linux")
|
||||
.join(lib);
|
||||
let archive = fs::read(lib_path).expect("clang builtins for riscv32 not found");
|
||||
let archive = fs::read(lib_path).expect("clang builtins for riscv64 not found");
|
||||
|
||||
let out_dir = env::var_os("OUT_DIR").expect("has OUT_DIR");
|
||||
let archive_path = Path::new(&out_dir).join(lib);
|
||||
|
||||
@@ -9,7 +9,7 @@ pub const BYTE_LENGTH_BYTE: usize = 1;
|
||||
pub const BYTE_LENGTH_X32: usize = 4;
|
||||
|
||||
/// Native stack alignment size in bytes
|
||||
pub const BYTE_LENGTH_STACK_ALIGN: usize = 4;
|
||||
pub const BYTE_LENGTH_STACK_ALIGN: usize = BYTE_LENGTH_X64;
|
||||
|
||||
/// The x86_64 word byte-length.
|
||||
pub const BYTE_LENGTH_X64: usize = 8;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
target datalayout = "e-m:e-p:32:32-i64:64-n32-S128"
|
||||
target triple = "riscv32-unknown-unknown-elf"
|
||||
; target datalayout = "e-m:e-p:32:32-i64:64-n32-S128"
|
||||
; target triple = "riscv32-unknown-unknown-elf"
|
||||
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
|
||||
target triple = "riscv64-unknown-unknown-elf"
|
||||
|
||||
define dso_local noundef i256 @__bswap(i256 noundef %0) local_unnamed_addr #0 {
|
||||
%2 = tail call i256 @llvm.bswap.i256(i256 %0)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"Computation": 5912,
|
||||
"ERC20": 33512,
|
||||
"Flipper": 3958,
|
||||
"Baseline": 3551,
|
||||
"Fibonacci": 4909
|
||||
"Computation": 5912,
|
||||
"Fibonacci": 4909,
|
||||
"ERC20": 1966
|
||||
}
|
||||
@@ -33,7 +33,7 @@ pub fn link<T: AsRef<[u8]>>(input: T) -> anyhow::Result<Vec<u8>> {
|
||||
let output_path = dir.path().join("out.so");
|
||||
let object_path = dir.path().join("out.o");
|
||||
let linker_script_path = dir.path().join("linker.ld");
|
||||
let compiler_rt_path = dir.path().join("libclang_rt.builtins-riscv32.a");
|
||||
let compiler_rt_path = dir.path().join("libclang_rt.builtins-riscv64.a");
|
||||
|
||||
fs::write(&object_path, input).map_err(|msg| anyhow::anyhow!("{msg} {object_path:?}"))?;
|
||||
|
||||
@@ -58,7 +58,7 @@ pub fn link<T: AsRef<[u8]>>(input: T) -> anyhow::Result<Vec<u8>> {
|
||||
"--library-path",
|
||||
dir.path().to_str().expect("should be utf8"),
|
||||
"--library",
|
||||
"clang_rt.builtins-riscv32",
|
||||
"clang_rt.builtins-riscv64",
|
||||
linker_script_path.to_str().expect("should be utf8"),
|
||||
object_path.to_str().expect("should be utf8"),
|
||||
"-o",
|
||||
|
||||
@@ -24,10 +24,10 @@ pub struct TargetMachine {
|
||||
|
||||
impl TargetMachine {
|
||||
/// The LLVM target name.
|
||||
pub const VM_TARGET_NAME: &'static str = "riscv32";
|
||||
pub const VM_TARGET_NAME: &'static str = "riscv64";
|
||||
|
||||
/// The LLVM target triple.
|
||||
pub const VM_TARGET_TRIPLE: &'static str = "riscv32-unknown-unknown-elf";
|
||||
pub const VM_TARGET_TRIPLE: &'static str = "riscv64-unknown-unknown-elf";
|
||||
|
||||
/// LLVM target features.
|
||||
#[cfg(feature = "riscv-zbb")]
|
||||
@@ -45,7 +45,7 @@ impl TargetMachine {
|
||||
.ok_or_else(|| anyhow::anyhow!("LLVM target machine `{}` not found", target.name()))?
|
||||
.create_target_machine(
|
||||
&inkwell::targets::TargetTriple::create(target.triple()),
|
||||
"generic-rv32",
|
||||
"generic-rv64",
|
||||
Self::VM_FEATURES,
|
||||
optimizer_settings.level_back_end,
|
||||
inkwell::targets::RelocMode::PIC,
|
||||
|
||||
@@ -19,7 +19,7 @@ impl Target {
|
||||
///
|
||||
pub fn name(&self) -> &str {
|
||||
match self {
|
||||
Self::PVM => "riscv32",
|
||||
Self::PVM => "riscv64",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ impl Target {
|
||||
///
|
||||
pub fn triple(&self) -> &str {
|
||||
match self {
|
||||
Self::PVM => "riscv32-unknown-unknown-elf",
|
||||
Self::PVM => "riscv64-unknown-unknown-elf",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ impl FromStr for Target {
|
||||
|
||||
fn from_str(string: &str) -> Result<Self, Self::Err> {
|
||||
match string {
|
||||
"riscv32" => Ok(Self::PVM),
|
||||
"riscv64" => Ok(Self::PVM),
|
||||
_ => Err(anyhow::anyhow!(
|
||||
"Unknown target `{}`. Supported targets: {:?}",
|
||||
string,
|
||||
@@ -60,7 +60,7 @@ impl FromStr for Target {
|
||||
impl std::fmt::Display for Target {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Target::PVM => write!(f, "riscv32"),
|
||||
Target::PVM => write!(f, "riscv64"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@ use std::{env, fs, path::Path, process::Command};
|
||||
fn compile(bitcode_path: &str) {
|
||||
let output = Command::new("clang")
|
||||
.args([
|
||||
"--target=riscv32",
|
||||
"--target=riscv64",
|
||||
"-Xclang",
|
||||
"-triple=riscv32-unknown-unknown-elf",
|
||||
"-march=rv32em",
|
||||
"-mabi=ilp32e",
|
||||
"-triple=riscv64-unknown-unknown-elf",
|
||||
"-march=rv64em",
|
||||
"-mabi=lp64e",
|
||||
"-fno-exceptions",
|
||||
"-ffreestanding",
|
||||
"-Wall",
|
||||
|
||||
Reference in New Issue
Block a user