From 22134ac6ae6496c6f150cdcd47b0ac7cdfb46aa2 Mon Sep 17 00:00:00 2001 From: Dmitri Makarov Date: Fri, 12 Aug 2022 14:48:23 -0700 Subject: [PATCH 1/9] [SOL] Make SBF target specific adjustments --- builtins-test-intrinsics/src/main.rs | 8 +- builtins-test/tests/div_rem.rs | 5 +- builtins-test/tests/mem.rs | 2 + ci/docker/sbf-solana-solana/Dockerfile | 23 +++ compiler-builtins/build.rs | 23 ++- compiler-builtins/src/lib.rs | 9 ++ compiler-builtins/src/mem/mod.rs | 203 +++++++++++++++++++++++++ 7 files changed, 269 insertions(+), 4 deletions(-) create mode 100644 ci/docker/sbf-solana-solana/Dockerfile diff --git a/builtins-test-intrinsics/src/main.rs b/builtins-test-intrinsics/src/main.rs index 66744a081..41dcf1816 100644 --- a/builtins-test-intrinsics/src/main.rs +++ b/builtins-test-intrinsics/src/main.rs @@ -17,8 +17,12 @@ extern crate compiler_builtins; extern crate panic_handler; -// SAFETY: no definitions, only used for linking -#[cfg(all(not(thumb), not(windows), not(target_arch = "wasm32")))] +#[cfg(all( + not(thumb), + not(windows), + not(target_arch = "wasm32"), + not(target_os = "solana") +))] #[link(name = "c")] unsafe extern "C" {} diff --git a/builtins-test/tests/div_rem.rs b/builtins-test/tests/div_rem.rs index 5ae653cc9..26744f1ba 100644 --- a/builtins-test/tests/div_rem.rs +++ b/builtins-test/tests/div_rem.rs @@ -138,7 +138,10 @@ macro_rules! float { }; } -#[cfg(not(all(target_arch = "x86", not(target_feature = "sse"))))] +#[cfg(not(any( + all(target_arch = "x86", not(target_feature = "sse")), + target_family = "solana" +)))] mod float_div { use super::*; diff --git a/builtins-test/tests/mem.rs b/builtins-test/tests/mem.rs index d838ef159..9a54e87e1 100644 --- a/builtins-test/tests/mem.rs +++ b/builtins-test/tests/mem.rs @@ -37,6 +37,7 @@ fn memcpy_10() { } } +#[cfg(not(target_os = "solana"))] #[test] fn memcpy_big() { // Make the arrays cross 3 pages @@ -165,6 +166,7 @@ fn memmove_forward_misaligned_nonaligned_start() { } } +#[cfg(not(target_os = "solana"))] #[test] fn memmove_forward_misaligned_aligned_start() { let mut arr = gen_arr::<32>(); diff --git a/ci/docker/sbf-solana-solana/Dockerfile b/ci/docker/sbf-solana-solana/Dockerfile new file mode 100644 index 000000000..d60cc649f --- /dev/null +++ b/ci/docker/sbf-solana-solana/Dockerfile @@ -0,0 +1,23 @@ +FROM ubuntu:20.04 +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + curl \ + gcc libc6-dev ca-certificates + +ENV RUSTUP_INIT_SKIP_PATH_CHECK="yes" +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v --no-modify-path +RUN cp ${HOME}/.cargo/bin/* /usr/local/bin/ + +RUN cargo install --git https://github.com/solana-labs/cargo-run-solana-tests.git \ + --rev df2f642924aee7bbd2566017b3d71cb0c389b015 \ + --bin cargo-run-solana-tests --root /usr/local + +RUN mkdir -p /tmp/.cache/solana/v1.38/platform-tools +RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/solana-labs/platform-tools/releases/download/v1.38/platform-tools-linux-x86_64.tar.bz2 +RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.38/platform-tools +RUN rustup toolchain link solana /tmp/.cache/solana/v1.38/platform-tools/rust +RUN cp -R ${HOME}/.rustup /tmp/ + +ENV CARGO_TARGET_SBF_SOLANA_SOLANA_RUNNER="cargo-run-solana-tests --heap-size 104857600" +ENV CC="/tmp/.cache/solana/v1.38/platform-tools/llvm/bin/clang" +ENV RUSTUP_TOOLCHAIN="solana" diff --git a/compiler-builtins/build.rs b/compiler-builtins/build.rs index d37fdc5df..065caf605 100644 --- a/compiler-builtins/build.rs +++ b/compiler-builtins/build.rs @@ -52,6 +52,7 @@ fn main() { || target.arch.contains("x86") || target.arch.contains("aarch64") || target.arch.contains("bpf") + || target.arch.contains("sbf") { println!("cargo:rustc-cfg=feature=\"mem-unaligned\""); } @@ -301,7 +302,10 @@ mod c { } /// Compile intrinsics from the compiler-rt C source code - pub fn compile(llvm_target: &[&str], target: &Target) { + pub fn compile(llvm_target: &[&str], target: &String) { + let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap(); + let target_feature = env::var("CARGO_CFG_TARGET_FEATURE").unwrap_or_default(); + let mut consider_float_intrinsics = true; let cfg = &mut cc::Build::new(); @@ -609,6 +613,23 @@ mod c { sources.extend(&[("__emutls_get_address", "emutls.c")]); } + if target_os == "solana" { + cfg.define("__ELF__", None); + // Use the static-syscall target feature to detect if we're + // compiling for sbfv2, in which case set the corresponding clang + // cpu flag. + if target_feature.contains("static-syscalls") { + cfg.flag("-mcpu=sbfv2"); + } + // Remove the implementations that fail to build. + // This list should shrink to zero + sources.remove(&[ + "__int_util", // Unsupported architecture error + "__mulvdi3", // Unsupported signed division + "__mulvsi3", // Unsupported signed division + ]); + } + // When compiling the C code we require the user to tell us where the // source code is, and this is largely done so when we're compiling as // part of rust-lang/rust we can use the same llvm-project repository as diff --git a/compiler-builtins/src/lib.rs b/compiler-builtins/src/lib.rs index 6a6b28067..ea2c6a9c2 100644 --- a/compiler-builtins/src/lib.rs +++ b/compiler-builtins/src/lib.rs @@ -4,6 +4,7 @@ #![feature(asm_experimental_arch)] #![feature(cfg_target_has_atomic)] #![feature(compiler_builtins)] +#![cfg_attr(not(target_os = "solana"), feature(core_ffi_c))] #![feature(core_intrinsics)] #![feature(linkage)] #![feature(naked_functions)] @@ -81,4 +82,12 @@ pub mod x86; #[cfg(target_arch = "x86_64")] pub mod x86_64; +#[cfg(all(target_os = "solana", target_feature = "static-syscalls"))] +#[cfg_attr(not(feature = "mangled-names"), no_mangle)] +#[linkage = "weak"] +pub unsafe extern "C" fn abort() -> ! { + let syscall: extern "C" fn() -> ! = core::mem::transmute(3069975057u64); // murmur32 hash of "abort" + syscall() +} + pub mod probestack; diff --git a/compiler-builtins/src/mem/mod.rs b/compiler-builtins/src/mem/mod.rs index 6828f3804..abc1b18c0 100644 --- a/compiler-builtins/src/mem/mod.rs +++ b/compiler-builtins/src/mem/mod.rs @@ -11,12 +11,14 @@ type c_int = i16; type c_int = i32; // memcpy/memmove/memset have optimized implementations on some architectures +#[cfg(not(target_os = "solana"))] #[cfg_attr( all(not(feature = "no-asm"), target_arch = "x86_64"), path = "x86_64.rs" )] mod impls; +#[cfg(not(target_os = "solana"))] intrinsics! { #[mem_builtin] pub unsafe extern "C" fn memcpy(dest: *mut u8, src: *const u8, n: usize) -> *mut u8 { @@ -58,3 +60,204 @@ intrinsics! { impls::c_string_length(s) } } + +// MEM functions have been rewritten to copy 8 byte chunks. No +// compensation for alignment is made here with the requirement that +// the underlying hardware supports unaligned loads/stores. If the +// number of store operations is greater than 8 the memory operation +// is performed in the run-time system instead, by calling the +// corresponding "C" function. + +#[cfg(all(target_os = "solana", not(target_feature = "static-syscalls")))] +mod syscalls { + extern "C" { + pub fn sol_memcpy_(dest: *mut u8, src: *const u8, n: u64); + pub fn sol_memmove_(dest: *mut u8, src: *const u8, n: u64); + pub fn sol_memset_(s: *mut u8, c: u8, n: u64); + pub fn sol_memcmp_(s1: *const u8, s2: *const u8, n: u64, result: *mut i32); + } +} + +#[cfg(all(target_os = "solana", target_feature = "static-syscalls"))] +mod syscalls { + pub(crate) fn sol_memcpy_(dest: *mut u8, src: *const u8, n: u64) { + let syscall: extern "C" fn(*mut u8, *const u8, u64) = + unsafe { core::mem::transmute(1904002211u64) }; // murmur32 hash of "sol_memcpy_" + syscall(dest, src, n) + } + + pub(crate) fn sol_memmove_(dest: *mut u8, src: *const u8, n: u64) { + let syscall: extern "C" fn(*mut u8, *const u8, u64) = + unsafe { core::mem::transmute(1128493560u64) }; // murmur32 hash of "sol_memmove_" + syscall(dest, src, n) + } + + pub(crate) fn sol_memcmp_(dest: *const u8, src: *const u8, n: u64, result: *mut i32) { + let syscall: extern "C" fn(*const u8, *const u8, u64, *mut i32) = + unsafe { core::mem::transmute(1608310321u64) }; // murmur32 hash of "sol_memcmp_" + syscall(dest, src, n, result) + } + + pub(crate) fn sol_memset_(dest: *mut u8, c: u8, n: u64) { + let syscall: extern "C" fn(*mut u8, u8, u64) = + unsafe { core::mem::transmute(930151202u64) }; // murmur32 hash of "sol_memset_" + syscall(dest, c, n) + } +} + +#[cfg(target_os = "solana")] +use self::syscalls::*; + +#[cfg(target_os = "solana")] +const NSTORE_THRESHOLD: usize = 15; + +#[cfg(target_os = "solana")] +#[cfg_attr( + all(feature = "mem-unaligned", not(feature = "mangled-names")), + no_mangle +)] +#[inline] +pub unsafe extern "C" fn memcpy(dest: *mut u8, src: *const u8, n: usize) -> *mut u8 { + let chunks = (n / 8) as isize; + let nstore = n - (7 * chunks) as usize; + if nstore > NSTORE_THRESHOLD { + sol_memcpy_(dest, src, n as u64); + return dest; + } + let mut i: isize = 0; + if chunks != 0 { + let dest_64 = dest as *mut _ as *mut u64; + let src_64 = src as *const _ as *const u64; + while i < chunks { + *dest_64.offset(i) = *src_64.offset(i); + i += 1; + } + i *= 8; + } + while i < n as isize { + *dest.offset(i) = *src.offset(i); + i += 1; + } + dest +} + +#[cfg(target_os = "solana")] +#[cfg_attr( + all(feature = "mem-unaligned", not(feature = "mangled-names")), + no_mangle +)] +#[inline] +pub unsafe extern "C" fn memmove(dest: *mut u8, src: *const u8, n: usize) -> *mut u8 { + let chunks = (n / 8) as isize; + let nstore = n - (7 * chunks) as usize; + if nstore > NSTORE_THRESHOLD { + sol_memmove_(dest, src, n as u64); + return dest; + } + if src < dest as *const u8 { + // copy from end + let mut i = n as isize; + while i > chunks * 8 { + i -= 1; + *dest.offset(i) = *src.offset(i); + } + i = chunks; + if i > 0 { + let dest_64 = dest as *mut _ as *mut u64; + let src_64 = src as *const _ as *const u64; + while i > 0 { + i -= 1; + *dest_64.offset(i) = *src_64.offset(i); + } + } + } else { + // copy from beginning + let mut i: isize = 0; + if chunks != 0 { + let dest_64 = dest as *mut _ as *mut u64; + let src_64 = src as *const _ as *const u64; + while i < chunks { + *dest_64.offset(i) = *src_64.offset(i); + i += 1; + } + i *= 8; + } + while i < n as isize { + *dest.offset(i) = *src.offset(i); + i += 1; + } + } + dest +} + +#[cfg(target_os = "solana")] +#[cfg_attr( + all(feature = "mem-unaligned", not(feature = "mangled-names")), + no_mangle +)] +#[inline] +pub unsafe extern "C" fn memset(s: *mut u8, c: c_int, n: usize) -> *mut u8 { + let chunks = (n / 8) as isize; + let nstore = n - (7 * chunks) as usize; + if nstore > NSTORE_THRESHOLD { + sol_memset_(s, c as u8, n as u64); + return s; + } + let mut i: isize = 0; + if chunks != 0 { + let mut c_64 = c as u64 & 0xFF as u64; + c_64 |= c_64 << 8; + c_64 |= c_64 << 16; + c_64 |= c_64 << 32; + let s_64 = s as *mut _ as *mut u64; + while i < chunks { + *s_64.offset(i) = c_64; + i += 1; + } + i *= 8; + } + while i < n as isize { + *s.offset(i) = c as u8; + i += 1; + } + s +} + +#[cfg(target_os = "solana")] +#[cfg_attr( + all(feature = "mem-unaligned", not(feature = "mangled-names")), + no_mangle +)] +#[inline] +pub unsafe extern "C" fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> i32 { + let chunks = (n / 8) as isize; + let nstore = n - (7 * chunks) as usize; + if nstore > NSTORE_THRESHOLD { + let mut result = 0; + sol_memcmp_(s1, s2, n as u64, &mut result as *mut i32); + return result; + } + let mut i: isize = 0; + if chunks != 0 { + let s1_64 = s1 as *const _ as *const u64; + let s2_64 = s2 as *const _ as *const u64; + while i < chunks { + let a = *s1_64.offset(i); + let b = *s2_64.offset(i); + if a != b { + break; + } + i += 1; + } + i *= 8; + } + while i < n as isize { + let a = *s1.offset(i); + let b = *s2.offset(i); + if a != b { + return a as i32 - b as i32; + } + i += 1; + } + 0 +} \ No newline at end of file From e56534310395e99996ba70763ee939e2a0552bf9 Mon Sep 17 00:00:00 2001 From: Lucas Ste <38472950+LucasSte@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:44:13 -0300 Subject: [PATCH 2/9] [SOL] Fix ci (#26) * Fix other targets --- Cargo.toml | 3 +++ ci/docker/sbf-solana-solana/Dockerfile | 18 +++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bc6b4bd29..5715c9df2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,3 +49,6 @@ lto = "fat" [profile.bench] # Required for iai-callgrind debug = true + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_family, values("solana"))', 'cfg(target_feature, values("static-syscalls"))', 'cfg(target_os, values("solana"))'] } diff --git a/ci/docker/sbf-solana-solana/Dockerfile b/ci/docker/sbf-solana-solana/Dockerfile index d60cc649f..a127ac350 100644 --- a/ci/docker/sbf-solana-solana/Dockerfile +++ b/ci/docker/sbf-solana-solana/Dockerfile @@ -1,23 +1,23 @@ -FROM ubuntu:20.04 +FROM ubuntu:22.04 RUN apt-get update && \ apt-get install -y --no-install-recommends \ curl \ - gcc libc6-dev ca-certificates + gcc libc6-dev ca-certificates bzip2 ENV RUSTUP_INIT_SKIP_PATH_CHECK="yes" RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v --no-modify-path RUN cp ${HOME}/.cargo/bin/* /usr/local/bin/ -RUN cargo install --git https://github.com/solana-labs/cargo-run-solana-tests.git \ - --rev df2f642924aee7bbd2566017b3d71cb0c389b015 \ +RUN cargo install --git https://github.com/anza-xyz/cargo-run-solana-tests.git \ + --rev c5df324a62a5e03d2ff5f9efbdbf5a4e4182325e \ --bin cargo-run-solana-tests --root /usr/local -RUN mkdir -p /tmp/.cache/solana/v1.38/platform-tools -RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/solana-labs/platform-tools/releases/download/v1.38/platform-tools-linux-x86_64.tar.bz2 -RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.38/platform-tools -RUN rustup toolchain link solana /tmp/.cache/solana/v1.38/platform-tools/rust +RUN mkdir -p /tmp/.cache/solana/v1.44/platform-tools +RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/solana-labs/platform-tools/releases/download/v1.44/platform-tools-linux-x86_64.tar.bz2 +RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.44/platform-tools +RUN rustup toolchain link solana /tmp/.cache/solana/v1.44/platform-tools/rust RUN cp -R ${HOME}/.rustup /tmp/ ENV CARGO_TARGET_SBF_SOLANA_SOLANA_RUNNER="cargo-run-solana-tests --heap-size 104857600" -ENV CC="/tmp/.cache/solana/v1.38/platform-tools/llvm/bin/clang" +ENV CC="/tmp/.cache/solana/v1.44/platform-tools/llvm/bin/clang" ENV RUSTUP_TOOLCHAIN="solana" From a5004050808c71de669f1f610f5432ee8b306f7b Mon Sep 17 00:00:00 2001 From: Lucas Ste <38472950+LucasSte@users.noreply.github.com> Date: Tue, 4 Feb 2025 11:07:07 -0300 Subject: [PATCH 3/9] [SOL] Remove sbfv2 flag (#29) --- compiler-builtins/build.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/compiler-builtins/build.rs b/compiler-builtins/build.rs index 065caf605..7320ac248 100644 --- a/compiler-builtins/build.rs +++ b/compiler-builtins/build.rs @@ -615,12 +615,6 @@ mod c { if target_os == "solana" { cfg.define("__ELF__", None); - // Use the static-syscall target feature to detect if we're - // compiling for sbfv2, in which case set the corresponding clang - // cpu flag. - if target_feature.contains("static-syscalls") { - cfg.flag("-mcpu=sbfv2"); - } // Remove the implementations that fail to build. // This list should shrink to zero sources.remove(&[ From 89e0af7689d9bf807cfe0f058183d6d5ae21cf57 Mon Sep 17 00:00:00 2001 From: Lucas Ste <38472950+LucasSte@users.noreply.github.com> Date: Wed, 5 Feb 2025 13:50:21 -0300 Subject: [PATCH 4/9] [SOL] Remove abort from compiler-builtins (#30) --- compiler-builtins/src/lib.rs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/compiler-builtins/src/lib.rs b/compiler-builtins/src/lib.rs index ea2c6a9c2..eec921f25 100644 --- a/compiler-builtins/src/lib.rs +++ b/compiler-builtins/src/lib.rs @@ -82,12 +82,4 @@ pub mod x86; #[cfg(target_arch = "x86_64")] pub mod x86_64; -#[cfg(all(target_os = "solana", target_feature = "static-syscalls"))] -#[cfg_attr(not(feature = "mangled-names"), no_mangle)] -#[linkage = "weak"] -pub unsafe extern "C" fn abort() -> ! { - let syscall: extern "C" fn() -> ! = core::mem::transmute(3069975057u64); // murmur32 hash of "abort" - syscall() -} - pub mod probestack; From 7e9119b373d9ac83e81fc99a4e36f60e78df59f7 Mon Sep 17 00:00:00 2001 From: Lucas Ste <38472950+LucasSte@users.noreply.github.com> Date: Tue, 11 Feb 2025 11:47:01 -0300 Subject: [PATCH 5/9] [SOL] Optimize memory operations (#31) --- compiler-builtins/src/mem/mod.rs | 124 ++----------------------------- 1 file changed, 7 insertions(+), 117 deletions(-) diff --git a/compiler-builtins/src/mem/mod.rs b/compiler-builtins/src/mem/mod.rs index abc1b18c0..7df580700 100644 --- a/compiler-builtins/src/mem/mod.rs +++ b/compiler-builtins/src/mem/mod.rs @@ -67,7 +67,6 @@ intrinsics! { // number of store operations is greater than 8 the memory operation // is performed in the run-time system instead, by calling the // corresponding "C" function. - #[cfg(all(target_os = "solana", not(target_feature = "static-syscalls")))] mod syscalls { extern "C" { @@ -108,9 +107,6 @@ mod syscalls { #[cfg(target_os = "solana")] use self::syscalls::*; -#[cfg(target_os = "solana")] -const NSTORE_THRESHOLD: usize = 15; - #[cfg(target_os = "solana")] #[cfg_attr( all(feature = "mem-unaligned", not(feature = "mangled-names")), @@ -118,26 +114,7 @@ const NSTORE_THRESHOLD: usize = 15; )] #[inline] pub unsafe extern "C" fn memcpy(dest: *mut u8, src: *const u8, n: usize) -> *mut u8 { - let chunks = (n / 8) as isize; - let nstore = n - (7 * chunks) as usize; - if nstore > NSTORE_THRESHOLD { - sol_memcpy_(dest, src, n as u64); - return dest; - } - let mut i: isize = 0; - if chunks != 0 { - let dest_64 = dest as *mut _ as *mut u64; - let src_64 = src as *const _ as *const u64; - while i < chunks { - *dest_64.offset(i) = *src_64.offset(i); - i += 1; - } - i *= 8; - } - while i < n as isize { - *dest.offset(i) = *src.offset(i); - i += 1; - } + sol_memcpy_(dest, src, n as u64); dest } @@ -148,45 +125,7 @@ pub unsafe extern "C" fn memcpy(dest: *mut u8, src: *const u8, n: usize) -> *mut )] #[inline] pub unsafe extern "C" fn memmove(dest: *mut u8, src: *const u8, n: usize) -> *mut u8 { - let chunks = (n / 8) as isize; - let nstore = n - (7 * chunks) as usize; - if nstore > NSTORE_THRESHOLD { - sol_memmove_(dest, src, n as u64); - return dest; - } - if src < dest as *const u8 { - // copy from end - let mut i = n as isize; - while i > chunks * 8 { - i -= 1; - *dest.offset(i) = *src.offset(i); - } - i = chunks; - if i > 0 { - let dest_64 = dest as *mut _ as *mut u64; - let src_64 = src as *const _ as *const u64; - while i > 0 { - i -= 1; - *dest_64.offset(i) = *src_64.offset(i); - } - } - } else { - // copy from beginning - let mut i: isize = 0; - if chunks != 0 { - let dest_64 = dest as *mut _ as *mut u64; - let src_64 = src as *const _ as *const u64; - while i < chunks { - *dest_64.offset(i) = *src_64.offset(i); - i += 1; - } - i *= 8; - } - while i < n as isize { - *dest.offset(i) = *src.offset(i); - i += 1; - } - } + sol_memmove_(dest, src, n as u64); dest } @@ -197,29 +136,7 @@ pub unsafe extern "C" fn memmove(dest: *mut u8, src: *const u8, n: usize) -> *mu )] #[inline] pub unsafe extern "C" fn memset(s: *mut u8, c: c_int, n: usize) -> *mut u8 { - let chunks = (n / 8) as isize; - let nstore = n - (7 * chunks) as usize; - if nstore > NSTORE_THRESHOLD { - sol_memset_(s, c as u8, n as u64); - return s; - } - let mut i: isize = 0; - if chunks != 0 { - let mut c_64 = c as u64 & 0xFF as u64; - c_64 |= c_64 << 8; - c_64 |= c_64 << 16; - c_64 |= c_64 << 32; - let s_64 = s as *mut _ as *mut u64; - while i < chunks { - *s_64.offset(i) = c_64; - i += 1; - } - i *= 8; - } - while i < n as isize { - *s.offset(i) = c as u8; - i += 1; - } + sol_memset_(s, c as u8, n as u64); s } @@ -230,34 +147,7 @@ pub unsafe extern "C" fn memset(s: *mut u8, c: c_int, n: usize) -> *mut u8 { )] #[inline] pub unsafe extern "C" fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> i32 { - let chunks = (n / 8) as isize; - let nstore = n - (7 * chunks) as usize; - if nstore > NSTORE_THRESHOLD { - let mut result = 0; - sol_memcmp_(s1, s2, n as u64, &mut result as *mut i32); - return result; - } - let mut i: isize = 0; - if chunks != 0 { - let s1_64 = s1 as *const _ as *const u64; - let s2_64 = s2 as *const _ as *const u64; - while i < chunks { - let a = *s1_64.offset(i); - let b = *s2_64.offset(i); - if a != b { - break; - } - i += 1; - } - i *= 8; - } - while i < n as isize { - let a = *s1.offset(i); - let b = *s2.offset(i); - if a != b { - return a as i32 - b as i32; - } - i += 1; - } - 0 -} \ No newline at end of file + let mut result = 0; + sol_memcmp_(s1, s2, n as u64, &mut result as *mut i32); + result +} From 59f6d1d54063cd653602b48a2a5e604da3ad1cc7 Mon Sep 17 00:00:00 2001 From: Lucas Date: Fri, 7 Mar 2025 17:37:32 -0300 Subject: [PATCH 6/9] [SOL] Adjustments for Rust 1.84.1 --- builtins-test/Cargo.toml | 7 +++++-- builtins-test/src/lib.rs | 1 + ci/docker/sbf-solana-solana/Dockerfile | 5 +++-- compiler-builtins/build.rs | 7 ++----- compiler-builtins/src/lib.rs | 1 + 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/builtins-test/Cargo.toml b/builtins-test/Cargo.toml index 10978c0bb..6dd103914 100644 --- a/builtins-test/Cargo.toml +++ b/builtins-test/Cargo.toml @@ -22,9 +22,12 @@ default-features = false features = ["unstable-public-internals"] [dev-dependencies] -criterion = { version = "0.5.1", default-features = false, features = ["cargo_bench_support"] } paste = "1.0.15" +[target.'cfg(not(target_arch = "sbf"))'.dev-dependencies] +criterion = { version = "0.5.1", default-features = false, features = ["cargo_bench_support"] } + + [target.'cfg(all(target_arch = "arm", not(any(target_env = "gnu", target_env = "musl")), target_os = "linux"))'.dev-dependencies] test = { git = "https://github.com/japaric/utest" } utest-cortex-m-qemu = { default-features = false, git = "https://github.com/japaric/utest" } @@ -50,7 +53,7 @@ no-sys-f16 = ["no-sys-f16-f64-convert"] icount = ["dep:iai-callgrind"] # Enable report generation without bringing in more dependencies by default -benchmarking-reports = ["criterion/plotters", "criterion/html_reports"] +# benchmarking-reports = ["criterion/plotters", "criterion/html_reports"] # NOTE: benchmarks must be run with `--no-default-features` or with # `-p builtins-test`, otherwise the default `compiler-builtins` feature diff --git a/builtins-test/src/lib.rs b/builtins-test/src/lib.rs index f1673133b..e35bb2046 100644 --- a/builtins-test/src/lib.rs +++ b/builtins-test/src/lib.rs @@ -13,6 +13,7 @@ //! Some floating point tests are disabled for specific architectures, because they do not have //! correct rounding. #![no_std] +#![feature(isqrt)] #![cfg_attr(f128_enabled, feature(f128))] #![cfg_attr(f16_enabled, feature(f16))] diff --git a/ci/docker/sbf-solana-solana/Dockerfile b/ci/docker/sbf-solana-solana/Dockerfile index a127ac350..d8cafda7c 100644 --- a/ci/docker/sbf-solana-solana/Dockerfile +++ b/ci/docker/sbf-solana-solana/Dockerfile @@ -2,7 +2,8 @@ FROM ubuntu:22.04 RUN apt-get update && \ apt-get install -y --no-install-recommends \ curl \ - gcc libc6-dev ca-certificates bzip2 + gcc libc6-dev ca-certificates bzip2 \ + libssl-dev pkg-config ENV RUSTUP_INIT_SKIP_PATH_CHECK="yes" RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v --no-modify-path @@ -13,7 +14,7 @@ RUN cargo install --git https://github.com/anza-xyz/cargo-run-solana-tests.git \ --bin cargo-run-solana-tests --root /usr/local RUN mkdir -p /tmp/.cache/solana/v1.44/platform-tools -RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/solana-labs/platform-tools/releases/download/v1.44/platform-tools-linux-x86_64.tar.bz2 +RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.44/platform-tools-linux-x86_64.tar.bz2 RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.44/platform-tools RUN rustup toolchain link solana /tmp/.cache/solana/v1.44/platform-tools/rust RUN cp -R ${HOME}/.rustup /tmp/ diff --git a/compiler-builtins/build.rs b/compiler-builtins/build.rs index 7320ac248..403e552a8 100644 --- a/compiler-builtins/build.rs +++ b/compiler-builtins/build.rs @@ -302,10 +302,7 @@ mod c { } /// Compile intrinsics from the compiler-rt C source code - pub fn compile(llvm_target: &[&str], target: &String) { - let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap(); - let target_feature = env::var("CARGO_CFG_TARGET_FEATURE").unwrap_or_default(); - + pub fn compile(llvm_target: &[&str], target: &Target) { let mut consider_float_intrinsics = true; let cfg = &mut cc::Build::new(); @@ -613,7 +610,7 @@ mod c { sources.extend(&[("__emutls_get_address", "emutls.c")]); } - if target_os == "solana" { + if target.os == "solana" { cfg.define("__ELF__", None); // Remove the implementations that fail to build. // This list should shrink to zero diff --git a/compiler-builtins/src/lib.rs b/compiler-builtins/src/lib.rs index eec921f25..05863bd6b 100644 --- a/compiler-builtins/src/lib.rs +++ b/compiler-builtins/src/lib.rs @@ -9,6 +9,7 @@ #![feature(linkage)] #![feature(naked_functions)] #![feature(repr_simd)] +#![feature(isqrt)] #![cfg_attr(f16_enabled, feature(f16))] #![cfg_attr(f128_enabled, feature(f128))] #![no_builtins] From a9be9146554e74a96e0e39f921a6ef79bd6db064 Mon Sep 17 00:00:00 2001 From: Lucas Ste <38472950+LucasSte@users.noreply.github.com> Date: Fri, 9 May 2025 14:46:24 -0300 Subject: [PATCH 7/9] [SOL] Fix CI and compile previously incompatible functions (#33) --- builtins-test/tests/conv.rs | 4 +++- ci/docker/sbf-solana-solana/Dockerfile | 11 +++++----- ci/docker/sbpf-solana-solana/Dockerfile | 25 +++++++++++++++++++++++ ci/docker/sbpfv1-solana-solana/Dockerfile | 25 +++++++++++++++++++++++ ci/docker/sbpfv2-solana-solana/Dockerfile | 25 +++++++++++++++++++++++ ci/docker/sbpfv3-solana-solana/Dockerfile | 25 +++++++++++++++++++++++ ci/run.sh | 23 +++++++++++++++------ compiler-builtins/build.rs | 7 ------- 8 files changed, 126 insertions(+), 19 deletions(-) create mode 100644 ci/docker/sbpf-solana-solana/Dockerfile create mode 100644 ci/docker/sbpfv1-solana-solana/Dockerfile create mode 100644 ci/docker/sbpfv2-solana-solana/Dockerfile create mode 100644 ci/docker/sbpfv3-solana-solana/Dockerfile diff --git a/builtins-test/tests/conv.rs b/builtins-test/tests/conv.rs index 491915d9b..0822c66c7 100644 --- a/builtins-test/tests/conv.rs +++ b/builtins-test/tests/conv.rs @@ -84,7 +84,9 @@ mod i_to_f { if !Float::eq_repr(f0, f1) && !cfg!(any( target_arch = "x86", target_arch = "powerpc", - target_arch = "powerpc64" + target_arch = "powerpc64", + // In SBF, the rounding bug exists when ALU32 is disbaled. + not(target_feature = "static-syscalls"), )) { panic!( "{}({}): std: {:?}, builtins: {:?}", diff --git a/ci/docker/sbf-solana-solana/Dockerfile b/ci/docker/sbf-solana-solana/Dockerfile index d8cafda7c..13c838ba8 100644 --- a/ci/docker/sbf-solana-solana/Dockerfile +++ b/ci/docker/sbf-solana-solana/Dockerfile @@ -13,12 +13,13 @@ RUN cargo install --git https://github.com/anza-xyz/cargo-run-solana-tests.git \ --rev c5df324a62a5e03d2ff5f9efbdbf5a4e4182325e \ --bin cargo-run-solana-tests --root /usr/local -RUN mkdir -p /tmp/.cache/solana/v1.44/platform-tools -RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.44/platform-tools-linux-x86_64.tar.bz2 -RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.44/platform-tools -RUN rustup toolchain link solana /tmp/.cache/solana/v1.44/platform-tools/rust +RUN mkdir -p /tmp/.cache/solana/v1.47/platform-tools +RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.47/platform-tools-linux-x86_64.tar.bz2 +RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.47/platform-tools +RUN rustup toolchain link solana /tmp/.cache/solana/v1.47/platform-tools/rust RUN cp -R ${HOME}/.rustup /tmp/ ENV CARGO_TARGET_SBF_SOLANA_SOLANA_RUNNER="cargo-run-solana-tests --heap-size 104857600" -ENV CC="/tmp/.cache/solana/v1.44/platform-tools/llvm/bin/clang" +ENV LLVM_HOME="/tmp/.cache/solana/v1.47/platform-tools/llvm" +ENV CC="/tmp/.cache/solana/v1.47/platform-tools/llvm/bin/clang" ENV RUSTUP_TOOLCHAIN="solana" diff --git a/ci/docker/sbpf-solana-solana/Dockerfile b/ci/docker/sbpf-solana-solana/Dockerfile new file mode 100644 index 000000000..8ed3f6f45 --- /dev/null +++ b/ci/docker/sbpf-solana-solana/Dockerfile @@ -0,0 +1,25 @@ +FROM ubuntu:22.04 +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + curl \ + gcc libc6-dev ca-certificates bzip2 \ + libssl-dev pkg-config + +ENV RUSTUP_INIT_SKIP_PATH_CHECK="yes" +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v --no-modify-path +RUN cp ${HOME}/.cargo/bin/* /usr/local/bin/ + +RUN cargo install --git https://github.com/anza-xyz/cargo-run-solana-tests.git \ + --rev c5df324a62a5e03d2ff5f9efbdbf5a4e4182325e \ + --bin cargo-run-solana-tests --root /usr/local + +RUN mkdir -p /tmp/.cache/solana/v1.47/platform-tools +RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.47/platform-tools-linux-x86_64.tar.bz2 +RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.47/platform-tools +RUN rustup toolchain link solana /tmp/.cache/solana/v1.47/platform-tools/rust +RUN cp -R ${HOME}/.rustup /tmp/ + +ENV CARGO_TARGET_SBPF_SOLANA_SOLANA_RUNNER="cargo-run-solana-tests --heap-size 104857600" +ENV LLVM_HOME="/tmp/.cache/solana/v1.47/platform-tools/llvm" +ENV CC="/tmp/.cache/solana/v1.47/platform-tools/llvm/bin/clang" +ENV RUSTUP_TOOLCHAIN="solana" diff --git a/ci/docker/sbpfv1-solana-solana/Dockerfile b/ci/docker/sbpfv1-solana-solana/Dockerfile new file mode 100644 index 000000000..08243c1b5 --- /dev/null +++ b/ci/docker/sbpfv1-solana-solana/Dockerfile @@ -0,0 +1,25 @@ +FROM ubuntu:22.04 +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + curl \ + gcc libc6-dev ca-certificates bzip2 \ + libssl-dev pkg-config + +ENV RUSTUP_INIT_SKIP_PATH_CHECK="yes" +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v --no-modify-path +RUN cp ${HOME}/.cargo/bin/* /usr/local/bin/ + +RUN cargo install --git https://github.com/anza-xyz/cargo-run-solana-tests.git \ + --rev c5df324a62a5e03d2ff5f9efbdbf5a4e4182325e \ + --bin cargo-run-solana-tests --root /usr/local + +RUN mkdir -p /tmp/.cache/solana/v1.47/platform-tools +RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.47/platform-tools-linux-x86_64.tar.bz2 +RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.47/platform-tools +RUN rustup toolchain link solana /tmp/.cache/solana/v1.47/platform-tools/rust +RUN cp -R ${HOME}/.rustup /tmp/ + +ENV CARGO_TARGET_SBPFV1_SOLANA_SOLANA_RUNNER="cargo-run-solana-tests --heap-size 104857600" +ENV LLVM_HOME="/tmp/.cache/solana/v1.47/platform-tools/llvm" +ENV CC="/tmp/.cache/solana/v1.47/platform-tools/llvm/bin/clang" +ENV RUSTUP_TOOLCHAIN="solana" diff --git a/ci/docker/sbpfv2-solana-solana/Dockerfile b/ci/docker/sbpfv2-solana-solana/Dockerfile new file mode 100644 index 000000000..b2d6b8eea --- /dev/null +++ b/ci/docker/sbpfv2-solana-solana/Dockerfile @@ -0,0 +1,25 @@ +FROM ubuntu:22.04 +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + curl \ + gcc libc6-dev ca-certificates bzip2 \ + libssl-dev pkg-config + +ENV RUSTUP_INIT_SKIP_PATH_CHECK="yes" +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v --no-modify-path +RUN cp ${HOME}/.cargo/bin/* /usr/local/bin/ + +RUN cargo install --git https://github.com/anza-xyz/cargo-run-solana-tests.git \ + --rev c5df324a62a5e03d2ff5f9efbdbf5a4e4182325e \ + --bin cargo-run-solana-tests --root /usr/local + +RUN mkdir -p /tmp/.cache/solana/v1.47/platform-tools +RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.47/platform-tools-linux-x86_64.tar.bz2 +RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.47/platform-tools +RUN rustup toolchain link solana /tmp/.cache/solana/v1.47/platform-tools/rust +RUN cp -R ${HOME}/.rustup /tmp/ + +ENV CARGO_TARGET_SBPFV2_SOLANA_SOLANA_RUNNER="cargo-run-solana-tests --heap-size 104857600" +ENV LLVM_HOME="/tmp/.cache/solana/v1.47/platform-tools/llvm" +ENV CC="/tmp/.cache/solana/v1.47/platform-tools/llvm/bin/clang" +ENV RUSTUP_TOOLCHAIN="solana" diff --git a/ci/docker/sbpfv3-solana-solana/Dockerfile b/ci/docker/sbpfv3-solana-solana/Dockerfile new file mode 100644 index 000000000..bdab73ee5 --- /dev/null +++ b/ci/docker/sbpfv3-solana-solana/Dockerfile @@ -0,0 +1,25 @@ +FROM ubuntu:22.04 +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + curl \ + gcc libc6-dev ca-certificates bzip2 \ + libssl-dev pkg-config + +ENV RUSTUP_INIT_SKIP_PATH_CHECK="yes" +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v --no-modify-path +RUN cp ${HOME}/.cargo/bin/* /usr/local/bin/ + +RUN cargo install --git https://github.com/anza-xyz/cargo-run-solana-tests.git \ + --rev c5df324a62a5e03d2ff5f9efbdbf5a4e4182325e \ + --bin cargo-run-solana-tests --root /usr/local + +RUN mkdir -p /tmp/.cache/solana/v1.47/platform-tools +RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.47/platform-tools-linux-x86_64.tar.bz2 +RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.47/platform-tools +RUN rustup toolchain link solana /tmp/.cache/solana/v1.47/platform-tools/rust +RUN cp -R ${HOME}/.rustup /tmp/ + +ENV CARGO_TARGET_SBPFV3_SOLANA_SOLANA_RUNNER="cargo-run-solana-tests --heap-size 104857600" +ENV LLVM_HOME="/tmp/.cache/solana/v1.47/platform-tools/llvm" +ENV CC="/tmp/.cache/solana/v1.47/platform-tools/llvm/bin/clang" +ENV RUSTUP_TOOLCHAIN="solana" diff --git a/ci/run.sh b/ci/run.sh index 27b9686ea..5b692efe0 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -30,16 +30,27 @@ if [ "${BUILD_ONLY:-}" = "1" ]; then echo "no tests to run for build-only targets" else test_builtins=(cargo test --package builtins-test --no-fail-fast --target "$target") - "${test_builtins[@]}" + if [[ ! "$target" =~ ^sbf && ! "$target" =~ ^sbpf- && ! "$target" =~ ^sbpfv3- ]]; then + # Not using release mode causes a stack overflow in SBPFv0 + # There is a bug in SBPFv3 whereby we were not adding returns to -O0 code + "${test_builtins[@]}" + "${test_builtins[@]}" --features c + "${test_builtins[@]}" --features no-asm + "${test_builtins[@]}" --features no-f16-f128 + fi + "${test_builtins[@]}" --release - "${test_builtins[@]}" --features c "${test_builtins[@]}" --features c --release - "${test_builtins[@]}" --features no-asm "${test_builtins[@]}" --features no-asm --release - "${test_builtins[@]}" --features no-f16-f128 "${test_builtins[@]}" --features no-f16-f128 --release - "${test_builtins[@]}" --benches - "${test_builtins[@]}" --benches --release + + if [[ ! "$target" =~ ^sbf && ! "$target" =~ ^sbpf ]]; then + # Benches require criterion, which is not compatible with SBPF + "${test_builtins[@]}" --benches + "${test_builtins[@]}" --benches --release + "${test_builtins[@]}" --benches + "${test_builtins[@]}" --benches --release + fi if [ "${TEST_VERBATIM:-}" = "1" ]; then verb_path=$(cmd.exe //C echo \\\\?\\%cd%\\builtins-test\\target2) diff --git a/compiler-builtins/build.rs b/compiler-builtins/build.rs index 403e552a8..893d1d2de 100644 --- a/compiler-builtins/build.rs +++ b/compiler-builtins/build.rs @@ -612,13 +612,6 @@ mod c { if target.os == "solana" { cfg.define("__ELF__", None); - // Remove the implementations that fail to build. - // This list should shrink to zero - sources.remove(&[ - "__int_util", // Unsupported architecture error - "__mulvdi3", // Unsupported signed division - "__mulvsi3", // Unsupported signed division - ]); } // When compiling the C code we require the user to tell us where the From 0922f38f0251d03b2d48e244fee7c667f63a1f88 Mon Sep 17 00:00:00 2001 From: Lucas Ste <38472950+LucasSte@users.noreply.github.com> Date: Mon, 14 Jul 2025 09:57:37 -0300 Subject: [PATCH 8/9] [SOL] Revamp CI (#34) --- ci/docker/sbf-solana-solana/Dockerfile | 25 ----------------------- ci/docker/sbpf-solana-solana/Dockerfile | 14 ++++++------- ci/docker/sbpfv1-solana-solana/Dockerfile | 14 ++++++------- ci/docker/sbpfv2-solana-solana/Dockerfile | 14 ++++++------- ci/docker/sbpfv3-solana-solana/Dockerfile | 14 ++++++------- ci/run.sh | 2 +- 6 files changed, 29 insertions(+), 54 deletions(-) delete mode 100644 ci/docker/sbf-solana-solana/Dockerfile diff --git a/ci/docker/sbf-solana-solana/Dockerfile b/ci/docker/sbf-solana-solana/Dockerfile deleted file mode 100644 index 13c838ba8..000000000 --- a/ci/docker/sbf-solana-solana/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -FROM ubuntu:22.04 -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - curl \ - gcc libc6-dev ca-certificates bzip2 \ - libssl-dev pkg-config - -ENV RUSTUP_INIT_SKIP_PATH_CHECK="yes" -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v --no-modify-path -RUN cp ${HOME}/.cargo/bin/* /usr/local/bin/ - -RUN cargo install --git https://github.com/anza-xyz/cargo-run-solana-tests.git \ - --rev c5df324a62a5e03d2ff5f9efbdbf5a4e4182325e \ - --bin cargo-run-solana-tests --root /usr/local - -RUN mkdir -p /tmp/.cache/solana/v1.47/platform-tools -RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.47/platform-tools-linux-x86_64.tar.bz2 -RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.47/platform-tools -RUN rustup toolchain link solana /tmp/.cache/solana/v1.47/platform-tools/rust -RUN cp -R ${HOME}/.rustup /tmp/ - -ENV CARGO_TARGET_SBF_SOLANA_SOLANA_RUNNER="cargo-run-solana-tests --heap-size 104857600" -ENV LLVM_HOME="/tmp/.cache/solana/v1.47/platform-tools/llvm" -ENV CC="/tmp/.cache/solana/v1.47/platform-tools/llvm/bin/clang" -ENV RUSTUP_TOOLCHAIN="solana" diff --git a/ci/docker/sbpf-solana-solana/Dockerfile b/ci/docker/sbpf-solana-solana/Dockerfile index 8ed3f6f45..e1e2bf607 100644 --- a/ci/docker/sbpf-solana-solana/Dockerfile +++ b/ci/docker/sbpf-solana-solana/Dockerfile @@ -10,16 +10,16 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v - RUN cp ${HOME}/.cargo/bin/* /usr/local/bin/ RUN cargo install --git https://github.com/anza-xyz/cargo-run-solana-tests.git \ - --rev c5df324a62a5e03d2ff5f9efbdbf5a4e4182325e \ + --rev 2ff58e81919c5c6580620f4b1f0e37777ef6787f \ --bin cargo-run-solana-tests --root /usr/local -RUN mkdir -p /tmp/.cache/solana/v1.47/platform-tools -RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.47/platform-tools-linux-x86_64.tar.bz2 -RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.47/platform-tools -RUN rustup toolchain link solana /tmp/.cache/solana/v1.47/platform-tools/rust +RUN mkdir -p /tmp/.cache/solana/v1.50/platform-tools +RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.50/platform-tools-linux-x86_64.tar.bz2 +RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.50/platform-tools +RUN rustup toolchain link solana /tmp/.cache/solana/v1.50/platform-tools/rust RUN cp -R ${HOME}/.rustup /tmp/ ENV CARGO_TARGET_SBPF_SOLANA_SOLANA_RUNNER="cargo-run-solana-tests --heap-size 104857600" -ENV LLVM_HOME="/tmp/.cache/solana/v1.47/platform-tools/llvm" -ENV CC="/tmp/.cache/solana/v1.47/platform-tools/llvm/bin/clang" +ENV LLVM_HOME="/tmp/.cache/solana/v1.50/platform-tools/llvm" +ENV CC="/tmp/.cache/solana/v1.50/platform-tools/llvm/bin/clang" ENV RUSTUP_TOOLCHAIN="solana" diff --git a/ci/docker/sbpfv1-solana-solana/Dockerfile b/ci/docker/sbpfv1-solana-solana/Dockerfile index 08243c1b5..4937bd0bd 100644 --- a/ci/docker/sbpfv1-solana-solana/Dockerfile +++ b/ci/docker/sbpfv1-solana-solana/Dockerfile @@ -10,16 +10,16 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v - RUN cp ${HOME}/.cargo/bin/* /usr/local/bin/ RUN cargo install --git https://github.com/anza-xyz/cargo-run-solana-tests.git \ - --rev c5df324a62a5e03d2ff5f9efbdbf5a4e4182325e \ + --rev 2ff58e81919c5c6580620f4b1f0e37777ef6787f \ --bin cargo-run-solana-tests --root /usr/local -RUN mkdir -p /tmp/.cache/solana/v1.47/platform-tools -RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.47/platform-tools-linux-x86_64.tar.bz2 -RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.47/platform-tools -RUN rustup toolchain link solana /tmp/.cache/solana/v1.47/platform-tools/rust +RUN mkdir -p /tmp/.cache/solana/v1.50/platform-tools +RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.50/platform-tools-linux-x86_64.tar.bz2 +RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.50/platform-tools +RUN rustup toolchain link solana /tmp/.cache/solana/v1.50/platform-tools/rust RUN cp -R ${HOME}/.rustup /tmp/ ENV CARGO_TARGET_SBPFV1_SOLANA_SOLANA_RUNNER="cargo-run-solana-tests --heap-size 104857600" -ENV LLVM_HOME="/tmp/.cache/solana/v1.47/platform-tools/llvm" -ENV CC="/tmp/.cache/solana/v1.47/platform-tools/llvm/bin/clang" +ENV LLVM_HOME="/tmp/.cache/solana/v1.50/platform-tools/llvm" +ENV CC="/tmp/.cache/solana/v1.50/platform-tools/llvm/bin/clang" ENV RUSTUP_TOOLCHAIN="solana" diff --git a/ci/docker/sbpfv2-solana-solana/Dockerfile b/ci/docker/sbpfv2-solana-solana/Dockerfile index b2d6b8eea..04c2e4520 100644 --- a/ci/docker/sbpfv2-solana-solana/Dockerfile +++ b/ci/docker/sbpfv2-solana-solana/Dockerfile @@ -10,16 +10,16 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v - RUN cp ${HOME}/.cargo/bin/* /usr/local/bin/ RUN cargo install --git https://github.com/anza-xyz/cargo-run-solana-tests.git \ - --rev c5df324a62a5e03d2ff5f9efbdbf5a4e4182325e \ + --rev 2ff58e81919c5c6580620f4b1f0e37777ef6787f \ --bin cargo-run-solana-tests --root /usr/local -RUN mkdir -p /tmp/.cache/solana/v1.47/platform-tools -RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.47/platform-tools-linux-x86_64.tar.bz2 -RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.47/platform-tools -RUN rustup toolchain link solana /tmp/.cache/solana/v1.47/platform-tools/rust +RUN mkdir -p /tmp/.cache/solana/v1.50/platform-tools +RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.50/platform-tools-linux-x86_64.tar.bz2 +RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.50/platform-tools +RUN rustup toolchain link solana /tmp/.cache/solana/v1.50/platform-tools/rust RUN cp -R ${HOME}/.rustup /tmp/ ENV CARGO_TARGET_SBPFV2_SOLANA_SOLANA_RUNNER="cargo-run-solana-tests --heap-size 104857600" -ENV LLVM_HOME="/tmp/.cache/solana/v1.47/platform-tools/llvm" -ENV CC="/tmp/.cache/solana/v1.47/platform-tools/llvm/bin/clang" +ENV LLVM_HOME="/tmp/.cache/solana/v1.50/platform-tools/llvm" +ENV CC="/tmp/.cache/solana/v1.50/platform-tools/llvm/bin/clang" ENV RUSTUP_TOOLCHAIN="solana" diff --git a/ci/docker/sbpfv3-solana-solana/Dockerfile b/ci/docker/sbpfv3-solana-solana/Dockerfile index bdab73ee5..7f5ee1fb5 100644 --- a/ci/docker/sbpfv3-solana-solana/Dockerfile +++ b/ci/docker/sbpfv3-solana-solana/Dockerfile @@ -10,16 +10,16 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v - RUN cp ${HOME}/.cargo/bin/* /usr/local/bin/ RUN cargo install --git https://github.com/anza-xyz/cargo-run-solana-tests.git \ - --rev c5df324a62a5e03d2ff5f9efbdbf5a4e4182325e \ + --rev 2ff58e81919c5c6580620f4b1f0e37777ef6787f \ --bin cargo-run-solana-tests --root /usr/local -RUN mkdir -p /tmp/.cache/solana/v1.47/platform-tools -RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.47/platform-tools-linux-x86_64.tar.bz2 -RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.47/platform-tools -RUN rustup toolchain link solana /tmp/.cache/solana/v1.47/platform-tools/rust +RUN mkdir -p /tmp/.cache/solana/v1.50/platform-tools +RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.50/platform-tools-linux-x86_64.tar.bz2 +RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.50/platform-tools +RUN rustup toolchain link solana /tmp/.cache/solana/v1.50/platform-tools/rust RUN cp -R ${HOME}/.rustup /tmp/ ENV CARGO_TARGET_SBPFV3_SOLANA_SOLANA_RUNNER="cargo-run-solana-tests --heap-size 104857600" -ENV LLVM_HOME="/tmp/.cache/solana/v1.47/platform-tools/llvm" -ENV CC="/tmp/.cache/solana/v1.47/platform-tools/llvm/bin/clang" +ENV LLVM_HOME="/tmp/.cache/solana/v1.50/platform-tools/llvm" +ENV CC="/tmp/.cache/solana/v1.50/platform-tools/llvm/bin/clang" ENV RUSTUP_TOOLCHAIN="solana" diff --git a/ci/run.sh b/ci/run.sh index 5b692efe0..d280df192 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -30,7 +30,7 @@ if [ "${BUILD_ONLY:-}" = "1" ]; then echo "no tests to run for build-only targets" else test_builtins=(cargo test --package builtins-test --no-fail-fast --target "$target") - if [[ ! "$target" =~ ^sbf && ! "$target" =~ ^sbpf- && ! "$target" =~ ^sbpfv3- ]]; then + if [[ ! "$target" =~ ^sbf && ! "$target" =~ ^sbpf- ]]; then # Not using release mode causes a stack overflow in SBPFv0 # There is a bug in SBPFv3 whereby we were not adding returns to -O0 code "${test_builtins[@]}" From bbbaa9f4ae184b11e68d07849de96e1926600e0e Mon Sep 17 00:00:00 2001 From: Lucas Steuernagel Date: Mon, 18 Aug 2025 17:11:50 -0300 Subject: [PATCH 9/9] [SOL] Adjustments for Rust 1.89.0 --- .github/workflows/main.yaml | 26 ++++++++++++++++++----- Cargo.toml | 3 --- builtins-test-intrinsics/Cargo.toml | 7 ++++++ builtins-test/Cargo.toml | 8 +++++++ builtins-test/src/lib.rs | 1 - ci/docker/sbpf-solana-solana/Dockerfile | 14 ++++++------ ci/docker/sbpfv1-solana-solana/Dockerfile | 14 ++++++------ ci/docker/sbpfv2-solana-solana/Dockerfile | 14 ++++++------ ci/docker/sbpfv3-solana-solana/Dockerfile | 14 ++++++------ compiler-builtins/Cargo.toml | 9 +++++++- 10 files changed, 72 insertions(+), 38 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 9f389d8b4..534a80ea7 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -94,10 +94,18 @@ jobs: test_verbatim: 1 - target: i686-pc-windows-gnu os: windows-2025 - channel: nightly-i686-gnu + channel: nightly-2025-04-29-i686-gnu - target: x86_64-pc-windows-gnu os: windows-2025 - channel: nightly-x86_64-gnu + channel: nightly-2025-04-29-x86_64-gnu + - target: sbpf-solana-solana + os: ubuntu-24.04 + - target: sbpfv1-solana-solana + os: ubuntu-24.04 + - target: sbpfv2-solana-solana + os: ubuntu-24.04 + - target: sbpfv3-solana-solana + os: ubuntu-24.04 runs-on: ${{ matrix.os }} needs: [calculate_vars] env: @@ -111,14 +119,22 @@ jobs: with: submodules: true - name: Install Rust (rustup) + if: ${{ !startsWith(matrix.target, 'sbpf') }} shell: bash run: | - channel="nightly" + channel="nightly-2025-04-29" # Account for channels that have required components (MinGW) [ -n "${{ matrix.channel }}" ] && channel="${{ matrix.channel }}" rustup update "$channel" --no-self-update rustup default "$channel" rustup target add "${{ matrix.target }}" + - name: Install Rust (rustup) + if: ${{ startsWith(matrix.target, 'sbpf') }} + shell: bash + run: | + channel="nightly-2025-04-29" + rustup update "$channel" --no-self-update + rustup default "$channel" - uses: taiki-e/install-action@nextest - uses: Swatinem/rust-cache@v2 with: @@ -188,7 +204,7 @@ jobs: - name: Install nightly `clippy` run: | rustup set profile minimal - rustup default nightly + rustup default nightly-2025-04-29 rustup component add clippy - uses: Swatinem/rust-cache@v2 - run: cargo clippy --workspace --all-targets @@ -259,7 +275,7 @@ jobs: with: submodules: true - name: Install Rust (rustup) - run: rustup update nightly --no-self-update && rustup default nightly + run: rustup update nightly-2025-04-29 --no-self-update && rustup default nightly-2025-04-29 shell: bash - run: rustup component add miri - run: cargo miri setup diff --git a/Cargo.toml b/Cargo.toml index 5715c9df2..bc6b4bd29 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,6 +49,3 @@ lto = "fat" [profile.bench] # Required for iai-callgrind debug = true - -[lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_family, values("solana"))', 'cfg(target_feature, values("static-syscalls"))', 'cfg(target_os, values("solana"))'] } diff --git a/builtins-test-intrinsics/Cargo.toml b/builtins-test-intrinsics/Cargo.toml index 704de20c5..103a97546 100644 --- a/builtins-test-intrinsics/Cargo.toml +++ b/builtins-test-intrinsics/Cargo.toml @@ -17,3 +17,10 @@ panic = "abort" [profile.dev] panic = "abort" + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = [ + 'cfg(target_family, values("solana"))', + 'cfg(target_feature, values("static-syscalls"))', + 'cfg(target_os, values("solana"))' +] } \ No newline at end of file diff --git a/builtins-test/Cargo.toml b/builtins-test/Cargo.toml index 6dd103914..a7f0cb8ba 100644 --- a/builtins-test/Cargo.toml +++ b/builtins-test/Cargo.toml @@ -100,3 +100,11 @@ harness = false name = "mem_icount" harness = false required-features = ["icount"] + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = [ + 'cfg(target_family, values("solana"))', + 'cfg(target_feature, values("static-syscalls"))', + 'cfg(target_os, values("solana"))' +] } + diff --git a/builtins-test/src/lib.rs b/builtins-test/src/lib.rs index e35bb2046..f1673133b 100644 --- a/builtins-test/src/lib.rs +++ b/builtins-test/src/lib.rs @@ -13,7 +13,6 @@ //! Some floating point tests are disabled for specific architectures, because they do not have //! correct rounding. #![no_std] -#![feature(isqrt)] #![cfg_attr(f128_enabled, feature(f128))] #![cfg_attr(f16_enabled, feature(f16))] diff --git a/ci/docker/sbpf-solana-solana/Dockerfile b/ci/docker/sbpf-solana-solana/Dockerfile index e1e2bf607..6c9807aa0 100644 --- a/ci/docker/sbpf-solana-solana/Dockerfile +++ b/ci/docker/sbpf-solana-solana/Dockerfile @@ -10,16 +10,16 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v - RUN cp ${HOME}/.cargo/bin/* /usr/local/bin/ RUN cargo install --git https://github.com/anza-xyz/cargo-run-solana-tests.git \ - --rev 2ff58e81919c5c6580620f4b1f0e37777ef6787f \ + --rev ccfb0a3f5f967f3cf52fef0c95e283c7cab1836e \ --bin cargo-run-solana-tests --root /usr/local -RUN mkdir -p /tmp/.cache/solana/v1.50/platform-tools -RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.50/platform-tools-linux-x86_64.tar.bz2 -RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.50/platform-tools -RUN rustup toolchain link solana /tmp/.cache/solana/v1.50/platform-tools/rust +RUN mkdir -p /tmp/.cache/solana/v1.51/platform-tools +RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.51/platform-tools-linux-x86_64.tar.bz2 +RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.51/platform-tools +RUN rustup toolchain link solana /tmp/.cache/solana/v1.51/platform-tools/rust RUN cp -R ${HOME}/.rustup /tmp/ ENV CARGO_TARGET_SBPF_SOLANA_SOLANA_RUNNER="cargo-run-solana-tests --heap-size 104857600" -ENV LLVM_HOME="/tmp/.cache/solana/v1.50/platform-tools/llvm" -ENV CC="/tmp/.cache/solana/v1.50/platform-tools/llvm/bin/clang" +ENV LLVM_HOME="/tmp/.cache/solana/v1.51/platform-tools/llvm" +ENV CC="/tmp/.cache/solana/v1.51/platform-tools/llvm/bin/clang" ENV RUSTUP_TOOLCHAIN="solana" diff --git a/ci/docker/sbpfv1-solana-solana/Dockerfile b/ci/docker/sbpfv1-solana-solana/Dockerfile index 4937bd0bd..030639e52 100644 --- a/ci/docker/sbpfv1-solana-solana/Dockerfile +++ b/ci/docker/sbpfv1-solana-solana/Dockerfile @@ -10,16 +10,16 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v - RUN cp ${HOME}/.cargo/bin/* /usr/local/bin/ RUN cargo install --git https://github.com/anza-xyz/cargo-run-solana-tests.git \ - --rev 2ff58e81919c5c6580620f4b1f0e37777ef6787f \ + --rev ccfb0a3f5f967f3cf52fef0c95e283c7cab1836e \ --bin cargo-run-solana-tests --root /usr/local -RUN mkdir -p /tmp/.cache/solana/v1.50/platform-tools -RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.50/platform-tools-linux-x86_64.tar.bz2 -RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.50/platform-tools -RUN rustup toolchain link solana /tmp/.cache/solana/v1.50/platform-tools/rust +RUN mkdir -p /tmp/.cache/solana/v1.51/platform-tools +RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.51/platform-tools-linux-x86_64.tar.bz2 +RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.51/platform-tools +RUN rustup toolchain link solana /tmp/.cache/solana/v1.51/platform-tools/rust RUN cp -R ${HOME}/.rustup /tmp/ ENV CARGO_TARGET_SBPFV1_SOLANA_SOLANA_RUNNER="cargo-run-solana-tests --heap-size 104857600" -ENV LLVM_HOME="/tmp/.cache/solana/v1.50/platform-tools/llvm" -ENV CC="/tmp/.cache/solana/v1.50/platform-tools/llvm/bin/clang" +ENV LLVM_HOME="/tmp/.cache/solana/v1.51/platform-tools/llvm" +ENV CC="/tmp/.cache/solana/v1.51/platform-tools/llvm/bin/clang" ENV RUSTUP_TOOLCHAIN="solana" diff --git a/ci/docker/sbpfv2-solana-solana/Dockerfile b/ci/docker/sbpfv2-solana-solana/Dockerfile index 04c2e4520..dd3489a82 100644 --- a/ci/docker/sbpfv2-solana-solana/Dockerfile +++ b/ci/docker/sbpfv2-solana-solana/Dockerfile @@ -10,16 +10,16 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v - RUN cp ${HOME}/.cargo/bin/* /usr/local/bin/ RUN cargo install --git https://github.com/anza-xyz/cargo-run-solana-tests.git \ - --rev 2ff58e81919c5c6580620f4b1f0e37777ef6787f \ + --rev ccfb0a3f5f967f3cf52fef0c95e283c7cab1836e \ --bin cargo-run-solana-tests --root /usr/local -RUN mkdir -p /tmp/.cache/solana/v1.50/platform-tools -RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.50/platform-tools-linux-x86_64.tar.bz2 -RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.50/platform-tools -RUN rustup toolchain link solana /tmp/.cache/solana/v1.50/platform-tools/rust +RUN mkdir -p /tmp/.cache/solana/v1.51/platform-tools +RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.51/platform-tools-linux-x86_64.tar.bz2 +RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.51/platform-tools +RUN rustup toolchain link solana /tmp/.cache/solana/v1.51/platform-tools/rust RUN cp -R ${HOME}/.rustup /tmp/ ENV CARGO_TARGET_SBPFV2_SOLANA_SOLANA_RUNNER="cargo-run-solana-tests --heap-size 104857600" -ENV LLVM_HOME="/tmp/.cache/solana/v1.50/platform-tools/llvm" -ENV CC="/tmp/.cache/solana/v1.50/platform-tools/llvm/bin/clang" +ENV LLVM_HOME="/tmp/.cache/solana/v1.51/platform-tools/llvm" +ENV CC="/tmp/.cache/solana/v1.51/platform-tools/llvm/bin/clang" ENV RUSTUP_TOOLCHAIN="solana" diff --git a/ci/docker/sbpfv3-solana-solana/Dockerfile b/ci/docker/sbpfv3-solana-solana/Dockerfile index 7f5ee1fb5..bf67af987 100644 --- a/ci/docker/sbpfv3-solana-solana/Dockerfile +++ b/ci/docker/sbpfv3-solana-solana/Dockerfile @@ -10,16 +10,16 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v - RUN cp ${HOME}/.cargo/bin/* /usr/local/bin/ RUN cargo install --git https://github.com/anza-xyz/cargo-run-solana-tests.git \ - --rev 2ff58e81919c5c6580620f4b1f0e37777ef6787f \ + --rev ccfb0a3f5f967f3cf52fef0c95e283c7cab1836e \ --bin cargo-run-solana-tests --root /usr/local -RUN mkdir -p /tmp/.cache/solana/v1.50/platform-tools -RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.50/platform-tools-linux-x86_64.tar.bz2 -RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.50/platform-tools -RUN rustup toolchain link solana /tmp/.cache/solana/v1.50/platform-tools/rust +RUN mkdir -p /tmp/.cache/solana/v1.51/platform-tools +RUN curl -L -o platform-tools-linux-x86_64.tar.bz2 https://github.com/anza-xyz/platform-tools/releases/download/v1.51/platform-tools-linux-x86_64.tar.bz2 +RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.51/platform-tools +RUN rustup toolchain link solana /tmp/.cache/solana/v1.51/platform-tools/rust RUN cp -R ${HOME}/.rustup /tmp/ ENV CARGO_TARGET_SBPFV3_SOLANA_SOLANA_RUNNER="cargo-run-solana-tests --heap-size 104857600" -ENV LLVM_HOME="/tmp/.cache/solana/v1.50/platform-tools/llvm" -ENV CC="/tmp/.cache/solana/v1.50/platform-tools/llvm/bin/clang" +ENV LLVM_HOME="/tmp/.cache/solana/v1.51/platform-tools/llvm" +ENV CC="/tmp/.cache/solana/v1.51/platform-tools/llvm/bin/clang" ENV RUSTUP_TOOLCHAIN="solana" diff --git a/compiler-builtins/Cargo.toml b/compiler-builtins/Cargo.toml index 8ceef286f..71b467c11 100644 --- a/compiler-builtins/Cargo.toml +++ b/compiler-builtins/Cargo.toml @@ -61,4 +61,11 @@ unstable-public-internals = [] [lints.rust] # The cygwin config can be dropped after our benchmark toolchain is bumped -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(bootstrap)', 'cfg(target_os, values("cygwin"))'] } +unexpected_cfgs = { level = "warn", check-cfg = [ + 'cfg(bootstrap)', + 'cfg(target_os, values("cygwin"))', + 'cfg(target_family, values("solana"))', + 'cfg(target_feature, values("static-syscalls"))', + 'cfg(target_os, values("solana"))' +] } +