parent
ac6dbf8f04
commit
9a4c449135
|
@ -2,6 +2,7 @@
|
|||
|
||||
[dependencies.compiler_builtins]
|
||||
path = "../../../../sdk/bpf/rust-bpf-sysroot/src/compiler-builtins"
|
||||
features = ["c", "mem"]
|
||||
|
||||
[target.bpfel-unknown-unknown.dependencies]
|
||||
alloc = { path = "../../../../sdk/bpf/rust-bpf-sysroot/src/liballoc" }
|
|
@ -2,13 +2,14 @@
|
|||
|
||||
#![no_std]
|
||||
|
||||
#[macro_use]
|
||||
// #[macro_use]
|
||||
extern crate alloc;
|
||||
extern crate solana_sdk_bpf_utils;
|
||||
|
||||
use solana_sdk_bpf_utils::log::*;
|
||||
|
||||
use core::alloc::Layout;
|
||||
// use alloc::vec::Vec;
|
||||
use core::mem;
|
||||
|
||||
#[no_mangle]
|
||||
|
@ -82,15 +83,28 @@ pub extern "C" fn entrypoint(_input: *mut u8) -> bool {
|
|||
// // Test allocated vector
|
||||
|
||||
// const ITERS: usize = 100;
|
||||
// let ones = vec![1_u64; ITERS];
|
||||
// let mut sum: u64 = 0;
|
||||
// let ones = vec![1_usize; ITERS];
|
||||
// let mut sum: usize = 0;
|
||||
|
||||
// for (i, v) in ones.iter().enumerate() {
|
||||
// sol_log_64(i as u64, 0, 0, 0, 0);
|
||||
// sum += ones[i as usize];
|
||||
// for v in ones.iter() {
|
||||
// sum += ones[*v];
|
||||
// }
|
||||
// sol_log_64(0x4, 0, 0, 0, sum);
|
||||
// assert_eq!(sum, ITERS as u64);
|
||||
// sol_log_64(0x0, 0, 0, 0, sum as u64);
|
||||
// assert_eq!(sum, ITERS);
|
||||
// }
|
||||
|
||||
// {
|
||||
// // TODO test Vec::new()
|
||||
|
||||
// const ITERS: usize = 100;
|
||||
// let mut v = Vec::new();
|
||||
|
||||
// for i in 0..ITERS {
|
||||
// sol_log_64(i as u64, 0, 0, 0, 0);
|
||||
// v.push(i);
|
||||
// }
|
||||
// sol_log_64(0x4, 0, 0, 0, v.len() as u64);
|
||||
// assert_eq!(v.len(), ITERS);
|
||||
// }
|
||||
|
||||
sol_log("Success");
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
[dependencies.compiler_builtins]
|
||||
path = "../../../../sdk/bpf/rust-bpf-sysroot/src/compiler-builtins"
|
||||
features = ["c", "mem"]
|
||||
|
||||
[target.bpfel-unknown-unknown.dependencies]
|
||||
alloc = { path = "../../../../sdk/bpf/rust-bpf-sysroot/src/liballoc" }
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
[dependencies.compiler_builtins]
|
||||
path = "../../../../sdk/bpf/rust-bpf-sysroot/src/compiler-builtins"
|
||||
features = ["c", "mem"]
|
||||
|
||||
[target.bpfel-unknown-unknown.dependencies]
|
||||
alloc = { path = "../../../../sdk/bpf/rust-bpf-sysroot/src/liballoc" }
|
|
@ -22,6 +22,10 @@ set -e
|
|||
# Ensure the sdk is installed
|
||||
"$bpf_sdk"/scripts/install.sh
|
||||
|
||||
# Use the SDK's version of llvm to build the compiler-builtins for BPF
|
||||
export CC="$bpf_sdk/llvm-native/bin/clang"
|
||||
export AR="$bpf_sdk/llvm-native/bin/llvm-ar"
|
||||
# Use the SDK's version of Rust to build for BPF
|
||||
export RUSTUP_TOOLCHAIN=bpf
|
||||
export RUSTFLAGS="
|
||||
--emit=llvm-ir \
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
#![no_std]
|
||||
#![feature(allocator_api)]
|
||||
#![feature(alloc_error_handler)]
|
||||
#![feature(panic_info_message)]
|
||||
#![feature(compiler_builtins_lib)]
|
||||
|
||||
extern crate compiler_builtins;
|
||||
|
||||
pub mod alloc;
|
||||
pub mod entrypoint;
|
||||
|
|
|
@ -48,7 +48,7 @@ if [[ ! -r criterion-$machine-$version.md ]]; then
|
|||
fi
|
||||
|
||||
# Install LLVM
|
||||
version=v0.0.9
|
||||
version=v0.0.10
|
||||
if [[ ! -f llvm-native-$machine-$version.md ]]; then
|
||||
(
|
||||
filename=solana-llvm-$machine.tar.bz2
|
||||
|
@ -108,7 +108,7 @@ if [[ ! -f rust-bpf-$machine-$version.md ]]; then
|
|||
fi
|
||||
|
||||
# Install Rust-BPF Sysroot sources
|
||||
version=v0.2
|
||||
version=v0.3
|
||||
if [[ ! -f rust-bpf-sysroot-$version.md ]]; then
|
||||
(
|
||||
set -ex
|
||||
|
|
Loading…
Reference in New Issue