From 784a6e74b1330250a206e1789ad67b718526d0a8 Mon Sep 17 00:00:00 2001 From: Tom Kaitchuck Date: Tue, 6 Aug 2024 08:23:49 -0700 Subject: [PATCH] Quick test nostd build Signed-off-by: Tom Kaitchuck --- test-block/Cargo.toml | 19 +++++++++++++++++++ test-block/src/main.rs | 31 +++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 test-block/Cargo.toml create mode 100644 test-block/src/main.rs diff --git a/test-block/Cargo.toml b/test-block/Cargo.toml new file mode 100644 index 0000000..1a7a0d5 --- /dev/null +++ b/test-block/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "test-block" +version = "0.1.0" +edition = "2021" + +[profile.release] +panic = 'abort' + +[profile.test] +panic = 'abort' + +[profile.dev] +panic = 'abort' + +[dependencies] +ahash = { path = "../", default-features = false } +spin = "0.9.8" +talc = "4.4.1" +panic-abort = "0.3.2" \ No newline at end of file diff --git a/test-block/src/main.rs b/test-block/src/main.rs new file mode 100644 index 0000000..88757d6 --- /dev/null +++ b/test-block/src/main.rs @@ -0,0 +1,31 @@ +#![no_std] +#![feature(start)] + +use ahash::RandomState; + +use talc::*; + +extern crate alloc; +extern crate panic_abort; + +static mut ARENA: [u8; 1024*1024] = [0; 1024*1024]; + +#[global_allocator] +static ALLOCATOR: Talck, ClaimOnOom> = Talc::new(unsafe { + // if we're in a hosted environment, the Rust runtime may allocate before + // main() is called, so we need to initialize the arena automatically + ClaimOnOom::new(Span::from_const_array(core::ptr::addr_of!(ARENA))) +}).lock(); + + +#[start] +fn start(_argc: isize, _argv: *const *const u8) -> isize { + // let state = RandomState::with_seeds(1, 2, 3, 4); + //let mut sum: u64 = 0; + // let mut payload: [u8; 8196] = [0; 8196]; + // for i in 0..1024 { + // payload.fill(i as u8); + // sum = sum.wrapping_add(state.hash_one(&payload)); + // } + 0 as isize +}