Skip to content

Commit

Permalink
Back-port Bump platform tools version (from solana-labs/solana #35330
Browse files Browse the repository at this point in the history
…) (#362)

Bump platform tools version (#35330)

Co-authored-by: Dmitri Makarov <[email protected]>
  • Loading branch information
2 people authored and willhickey committed Mar 23, 2024
1 parent 4fc2a30 commit acae767
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 9 deletions.
23 changes: 23 additions & 0 deletions programs/sbf/rust/sanity/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ struct SStruct {
z: u64,
}

#[allow(dead_code)]
#[repr(C)]
enum TestEnum {
VariantOne,
VariantTwo,
}

#[allow(dead_code)]
#[allow(clippy::enum_clike_unportable_variant)]
#[repr(C)]
enum Test64BitEnum {
VariantOne,
VariantTwo = 0xFFFFFFFFF,
}

#[inline(never)]
fn return_sstruct() -> SStruct {
SStruct { x: 1, y: 2, z: 3 }
Expand Down Expand Up @@ -72,6 +87,14 @@ pub fn process_instruction(
assert!(1.9986f64 < num && num < 2.0f64);
}

{
// #[repr(C) enums must not change size between compiler version
// 32-bit for #[repr(C)] enum
assert_eq!(std::mem::size_of::<TestEnum>(), 4);
// 64-bit for enum with a declared value
assert_eq!(std::mem::size_of::<Test64BitEnum>(), 8);
}

check_type_assumptions();

sol_log_compute_units();
Expand Down
2 changes: 1 addition & 1 deletion programs/sbf/tests/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@ fn assert_instruction_count() {
#[cfg(feature = "sbf_c")]
{
programs.extend_from_slice(&[
("alloc", 11502),
("alloc", 14575),
("sbf_to_sbf", 313),
("multiple_static", 208),
("noop", 5),
Expand Down
6 changes: 3 additions & 3 deletions sdk/bpf/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,16 @@ if [[ ! -e criterion-$version.md || ! -e criterion ]]; then
fi

# Install Rust-BPF
version=v1.39
version=v1.41
if [[ ! -e bpf-tools-$version.md || ! -e bpf-tools ]]; then
(
set -e
rm -rf bpf-tools*
rm -rf xargo
job="download \
https://github.com/solana-labs/bpf-tools/releases/download \
https://github.com/anza-xyz/platform-tools/releases/download \
$version \
solana-bpf-tools-${machine}-${arch}.tar.bz2 \
platform-tools-${machine}-${arch}.tar.bz2 \
bpf-tools"
get $version bpf-tools "$job"
)
Expand Down
2 changes: 1 addition & 1 deletion sdk/cargo-build-sbf/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ fn main() {

// The following line is scanned by CI configuration script to
// separate cargo caches according to the version of platform-tools.
let platform_tools_version = String::from("v1.39");
let platform_tools_version = String::from("v1.41");
let rust_base_version = get_base_rust_version(platform_tools_version.as_str());
let version = format!(
"{}\nplatform-tools {}\n{}",
Expand Down
2 changes: 1 addition & 1 deletion sdk/program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repository = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
edition = { workspace = true }
rust-version = "1.72.0" # solana platform-tools rust version
rust-version = "1.75.0" # solana platform-tools rust version

[dependencies]
bincode = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion sdk/sbf/c/sbf.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ OUT_DIR ?= ./out
OS := $(shell uname)

LLVM_DIR = $(LOCAL_PATH)../dependencies/platform-tools/llvm
LLVM_SYSTEM_INC_DIRS := $(LLVM_DIR)/lib/clang/15.0.4/include
LLVM_SYSTEM_INC_DIRS := $(LLVM_DIR)/lib/clang/17/include
COMPILER_RT_DIR = $(LOCAL_PATH)../dependencies/platform-tools/rust/lib/rustlib/sbf-solana-solana/lib
STD_INC_DIRS := $(LLVM_DIR)/include
STD_LIB_DIRS := $(LLVM_DIR)/lib
Expand Down
4 changes: 2 additions & 2 deletions sdk/sbf/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ if [[ ! -e criterion-$version.md || ! -e criterion ]]; then
fi

# Install platform tools
version=v1.39
version=v1.41
if [[ ! -e platform-tools-$version.md || ! -e platform-tools ]]; then
(
set -e
rm -rf platform-tools*
job="download \
https://github.com/solana-labs/platform-tools/releases/download \
https://github.com/anza-xyz/platform-tools/releases/download \
$version \
platform-tools-${machine}-${arch}.tar.bz2 \
platform-tools"
Expand Down

0 comments on commit acae767

Please sign in to comment.