add more crates

Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
xermicus
2023-12-09 17:48:52 +01:00
parent c04ae9a5c3
commit 7a094f17c0
22 changed files with 191 additions and 34 deletions
Generated
+45 -24
View File
@@ -300,6 +300,10 @@ dependencies = [
"os_str_bytes",
]
[[package]]
name = "compiler-builtins"
version = "0.1.0"
[[package]]
name = "core-foundation-sys"
version = "0.8.6"
@@ -546,16 +550,6 @@ dependencies = [
"hashbrown 0.14.3",
]
[[package]]
name = "ir-tac"
version = "0.1.0"
dependencies = [
"evmil",
"indexmap 2.1.0",
"petgraph",
"primitive-types",
]
[[package]]
name = "itertools"
version = "0.10.5"
@@ -567,9 +561,9 @@ dependencies = [
[[package]]
name = "itoa"
version = "1.0.9"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c"
[[package]]
name = "js-sys"
@@ -604,6 +598,14 @@ version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
name = "lld-sys"
version = "0.1.0"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "lock_api"
version = "0.4.11"
@@ -694,9 +696,9 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.18.0"
version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "ordered-float"
@@ -808,10 +810,11 @@ dependencies = [
[[package]]
name = "proc-macro-crate"
version = "2.0.0"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8"
checksum = "97dc5fea232fc28d2f597b37c4876b348a40e33f3b02cc975c8d006d78d94b1a"
dependencies = [
"toml_datetime",
"toml_edit",
]
@@ -934,14 +937,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]]
name = "revive"
name = "revive-cli"
version = "0.1.0"
dependencies = [
"evmil",
"hex",
"ir-tac",
"revive-ir",
]
[[package]]
name = "revive-environment"
version = "0.1.0"
[[package]]
name = "revive-ir"
version = "0.1.0"
dependencies = [
"evmil",
"indexmap 2.1.0",
"petgraph",
"primitive-types",
]
[[package]]
name = "revive-polkavm"
version = "0.1.0"
[[package]]
name = "rlp"
version = "0.5.2"
@@ -1197,15 +1218,15 @@ dependencies = [
[[package]]
name = "toml_datetime"
version = "0.6.5"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b"
[[package]]
name = "toml_edit"
version = "0.20.7"
version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81"
checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338"
dependencies = [
"indexmap 2.1.0",
"toml_datetime",
@@ -1437,9 +1458,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "winnow"
version = "0.5.19"
version = "0.5.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b"
checksum = "b67b5f0a4e7a27a64c651977932b9dc5667ca7fc31ac44b03ed37a0cf42fdfff"
dependencies = [
"memchr",
]
+5 -6
View File
@@ -1,14 +1,13 @@
[workspace]
resolver = "2"
members = [
"crates/ir-tac",
"crates/cli",
]
members = ["crates/*"]
[workspace.dependencies]
evmil = "0.4"
hex = "0.4"
petgraph = "0.6"
primitive-types = "0.12"
indexmap = "2.1.0"
indexmap = "2.1.0"
inkwell = { version = "0.2.0", features = ["target-riscv", "no-libffi-linking", "llvm16-0"] }
cc = "1.0"
libc = "0.2"
+9
View File
@@ -0,0 +1,9 @@
[package]
name = "compiler-builtins"
version = "0.1.0"
edition = "2021"
build = "build.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
+31
View File
@@ -0,0 +1,31 @@
use std::{env, fs, io::Read, path::Path, process::Command};
fn main() {
let lib = "libclang_rt.builtins-riscv32.a";
let mut llvm_lib_dir = String::new();
Command::new("llvm-config")
.args(["--libdir"])
.output()
.expect("llvm-config should be able to provide LD path")
.stdout
.as_slice()
.read_to_string(&mut llvm_lib_dir)
.expect("llvm-config output should be utf8");
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 fonud");
let out_dir = env::var_os("OUT_DIR").expect("has OUT_DIR");
let archive_path = Path::new(&out_dir).join(lib);
let len = archive.len();
std::fs::write(archive_path, &archive).expect("can write to OUT_DIR");
let src_path = Path::new(&out_dir).join("compiler_rt.rs");
let src = format!("pub static COMPILER_RT: &[u8; {len}] = include_bytes!(\"{lib}\");");
fs::write(src_path, src).expect("can write to OUT_DIR");
println!("cargo:rerun-if-changed=build.rs");
}
+1
View File
@@ -0,0 +1 @@
include!(concat!(env!("OUT_DIR"), "/compiler_rt.rs"));
+2 -2
View File
@@ -1,5 +1,5 @@
[package]
name = "revive"
name = "revive-cli"
version = "0.1.0"
edition = "2021"
@@ -8,4 +8,4 @@ edition = "2021"
[dependencies]
hex = { workspace = true }
evmil = { workspace = true }
ir-tac = { path = "../ir-tac" }
revive-ir = { path = "../ir" }
+1 -1
View File
@@ -1,5 +1,5 @@
use evmil::bytecode::Disassemble;
use ir_tac::cfg::{BasicBlockFormatOption, Program};
use revive_ir::cfg::{BasicBlockFormatOption, Program};
fn main() {
let hexcode = std::fs::read_to_string(std::env::args().nth(1).unwrap()).unwrap();
+8
View File
@@ -0,0 +1,8 @@
[package]
name = "revive-environment"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
+1
View File
@@ -0,0 +1 @@
@@ -1,5 +1,5 @@
[package]
name = "ir-tac"
name = "revive-ir"
version = "0.1.0"
edition = "2021"
+14
View File
@@ -0,0 +1,14 @@
[package]
name = "lld-sys"
version = "0.1.0"
edition = "2021"
build = "build.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
libc = { workspace = true }
[build-dependencies]
cc = { workspace = true }
+25
View File
@@ -0,0 +1,25 @@
// SPDX-License-Identifier: Apache-2.0
use std::{io::Read, process::Command};
fn main() {
let mut flags = String::new();
Command::new("llvm-config")
.args(["--cxxflags"])
.output()
.expect("llvm-config should be able to provide CXX flags")
.stdout
.as_slice()
.read_to_string(&mut flags)
.expect("llvm-config output should be utf8");
let mut builder = cc::Build::new();
flags
.split_whitespace()
.fold(&mut builder, |builder, flag| builder.flag(flag))
.cpp(true)
.file("src/linker.cpp")
.compile("liblinker.a");
println!("cargo:rerun-if-changed=build.rs");
}
+3
View File
@@ -0,0 +1,3 @@
extern "C" {
pub fn LLDELFLink(args: *const *const libc::c_char, size: libc::size_t) -> libc::c_int;
}
+22
View File
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: Apache-2.0
#include "lld/Common/Driver.h"
#include "lld/Common/CommonLinkerContext.h"
#include "llvm/Support/CrashRecoveryContext.h"
extern "C" bool LLDELFLink(const char *argv[], size_t length)
{
bool canRunAgain;
{
llvm::ArrayRef<const char *> args(argv, length);
llvm::CrashRecoveryContext crc;
if (!crc.RunSafely([&]()
{ canRunAgain = lld::elf::link(args, llvm::outs(), llvm::errs(), false, false); }))
return false;
}
llvm::CrashRecoveryContext crc;
return canRunAgain && crc.RunSafely([&]()
{ lld::CommonLinkerContext::destroy(); });
}
+8
View File
@@ -0,0 +1,8 @@
[package]
name = "revive-polkavm"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
+14
View File
@@ -0,0 +1,14 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
+1
View File
@@ -0,0 +1 @@
602060006000376020600060003561001b5760ff602052602060205bf3