Pull in LLVM with stack location fixes (#5732)
This commit is contained in:
4
programs/bpf/rust/param_passing/.gitignore
vendored
Normal file
4
programs/bpf/rust/param_passing/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/target/
|
||||
|
||||
Cargo.lock
|
||||
/farf/
|
27
programs/bpf/rust/param_passing/Cargo.toml
Normal file
27
programs/bpf/rust/param_passing/Cargo.toml
Normal file
@ -0,0 +1,27 @@
|
||||
|
||||
# Note: This crate must be built using build.sh
|
||||
|
||||
[package]
|
||||
name = "solana-bpf-rust-param-passing"
|
||||
version = "0.19.0-pre0"
|
||||
description = "Solana BPF test program written in Rust"
|
||||
authors = ["Solana Maintainers <maintainers@solana.com>"]
|
||||
repository = "https://github.com/solana-labs/solana"
|
||||
license = "Apache-2.0"
|
||||
homepage = "https://solana.com/"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
solana-sdk-bpf-utils = { path = "../../../../sdk/bpf/rust/rust-utils", version = "0.19.0-pre0" }
|
||||
solana-sdk-bpf-no-std = { path = "../../../../sdk/bpf/rust/rust-no-std", version = "0.19.0-pre0" }
|
||||
solana-bpf-rust-param-passing-dep = { path = "../param_passing_dep", version = "0.19.0-pre0" }
|
||||
|
||||
[dev_dependencies]
|
||||
solana-sdk-bpf-test = { path = "../../../../sdk/bpf/rust/rust-test", version = "0.19.0-pre0" }
|
||||
|
||||
[workspace]
|
||||
members = []
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
name = "solana_bpf_rust_param_passing"
|
6
programs/bpf/rust/param_passing/Xargo.toml
Normal file
6
programs/bpf/rust/param_passing/Xargo.toml
Normal file
@ -0,0 +1,6 @@
|
||||
[dependencies.compiler_builtins]
|
||||
path = "../../../../sdk/bpf/dependencies/rust-bpf-sysroot/src/compiler-builtins"
|
||||
features = ["c", "mem"]
|
||||
|
||||
[target.bpfel-unknown-unknown.dependencies]
|
||||
alloc = { path = "../../../../sdk/bpf/dependencies/rust-bpf-sysroot/src/liballoc" }
|
28
programs/bpf/rust/param_passing/src/lib.rs
Normal file
28
programs/bpf/rust/param_passing/src/lib.rs
Normal file
@ -0,0 +1,28 @@
|
||||
//! @brief Example Rust-based BPF program tests loop iteration
|
||||
|
||||
#![no_std]
|
||||
#![allow(unused_attributes)]
|
||||
|
||||
#[cfg(not(test))]
|
||||
extern crate solana_sdk_bpf_no_std;
|
||||
extern crate solana_sdk_bpf_utils;
|
||||
|
||||
use solana_bpf_rust_param_passing_dep::{Data, TestDep};
|
||||
use solana_sdk_bpf_utils::info;
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn entrypoint(_input: *mut u8) -> bool {
|
||||
let array = [0xA, 0xB, 0xC, 0xD, 0xE, 0xF];
|
||||
let data = Data {
|
||||
twentyone: 21u64,
|
||||
twentytwo: 22u64,
|
||||
twentythree: 23u64,
|
||||
twentyfour: 24u64,
|
||||
twentyfive: 25u32,
|
||||
array: &array,
|
||||
};
|
||||
|
||||
let test_dep = TestDep::new(&data, 1, 2, 3, 4, 5);
|
||||
info!(0, 0, 0, 0, test_dep.thirty);
|
||||
test_dep.thirty == 30
|
||||
}
|
Reference in New Issue
Block a user