Skip to content

Commit de1d04b

Browse files
committed
Fix CI and compile previsouly incompatible functions
1 parent bf501f2 commit de1d04b

File tree

9 files changed

+137
-20
lines changed

9 files changed

+137
-20
lines changed

.github/workflows/main.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,18 @@ jobs:
7070
- target: sbf-solana-solana
7171
os: ubuntu-latest
7272
rust: nightly-2024-11-01
73+
- target: sbpf-solana-solana
74+
os: ubuntu-latest
75+
rust: nightly-2024-11-01
76+
- target: sbpfv1-solana-solana
77+
os: ubuntu-latest
78+
rust: nightly-2024-11-01
79+
- target: sbpfv2-solana-solana
80+
os: ubuntu-latest
81+
rust: nightly-2024-11-01
82+
- target: sbpfv3-solana-solana
83+
os: ubuntu-latest
84+
rust: nightly-2024-11-01
7385
- target: thumbv6m-none-eabi
7486
os: ubuntu-latest
7587
rust: nightly-2024-11-01

build.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -587,13 +587,6 @@ mod c {
587587

588588
if target.os == "solana" {
589589
cfg.define("__ELF__", None);
590-
// Remove the implementations that fail to build.
591-
// This list should shrink to zero
592-
sources.remove(&[
593-
"__int_util", // Unsupported architecture error
594-
"__mulvdi3", // Unsupported signed division
595-
"__mulvsi3", // Unsupported signed division
596-
]);
597590
}
598591

599592
// When compiling the C code we require the user to tell us where the

ci/docker/sbf-solana-solana/Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ RUN cargo install --git https://github.com/anza-xyz/cargo-run-solana-tests.git \
1313
--rev c5df324a62a5e03d2ff5f9efbdbf5a4e4182325e \
1414
--bin cargo-run-solana-tests --root /usr/local
1515

16-
RUN mkdir -p /tmp/.cache/solana/v1.44/platform-tools
17-
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
18-
RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.44/platform-tools
19-
RUN rustup toolchain link solana /tmp/.cache/solana/v1.44/platform-tools/rust
16+
RUN mkdir -p /tmp/.cache/solana/v1.47/platform-tools
17+
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
18+
RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.47/platform-tools
19+
RUN rustup toolchain link solana /tmp/.cache/solana/v1.47/platform-tools/rust
2020
RUN cp -R ${HOME}/.rustup /tmp/
2121

2222
ENV CARGO_TARGET_SBF_SOLANA_SOLANA_RUNNER="cargo-run-solana-tests --heap-size 104857600"
23-
ENV CC="/tmp/.cache/solana/v1.44/platform-tools/llvm/bin/clang"
23+
ENV LLVM_HOME="/tmp/.cache/solana/v1.47/platform-tools/llvm"
24+
ENV CC="/tmp/.cache/solana/v1.47/platform-tools/llvm/bin/clang"
2425
ENV RUSTUP_TOOLCHAIN="solana"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM ubuntu:22.04
2+
RUN apt-get update && \
3+
apt-get install -y --no-install-recommends \
4+
curl \
5+
gcc libc6-dev ca-certificates bzip2 \
6+
libssl-dev pkg-config
7+
8+
ENV RUSTUP_INIT_SKIP_PATH_CHECK="yes"
9+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v --no-modify-path
10+
RUN cp ${HOME}/.cargo/bin/* /usr/local/bin/
11+
12+
RUN cargo install --git https://github.com/anza-xyz/cargo-run-solana-tests.git \
13+
--rev c5df324a62a5e03d2ff5f9efbdbf5a4e4182325e \
14+
--bin cargo-run-solana-tests --root /usr/local
15+
16+
RUN mkdir -p /tmp/.cache/solana/v1.47/platform-tools
17+
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
18+
RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.47/platform-tools
19+
RUN rustup toolchain link solana /tmp/.cache/solana/v1.47/platform-tools/rust
20+
RUN cp -R ${HOME}/.rustup /tmp/
21+
22+
ENV CARGO_TARGET_SBPF_SOLANA_SOLANA_RUNNER="cargo-run-solana-tests --heap-size 104857600"
23+
ENV LLVM_HOME="/tmp/.cache/solana/v1.47/platform-tools/llvm"
24+
ENV CC="/tmp/.cache/solana/v1.47/platform-tools/llvm/bin/clang"
25+
ENV RUSTUP_TOOLCHAIN="solana"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM ubuntu:22.04
2+
RUN apt-get update && \
3+
apt-get install -y --no-install-recommends \
4+
curl \
5+
gcc libc6-dev ca-certificates bzip2 \
6+
libssl-dev pkg-config
7+
8+
ENV RUSTUP_INIT_SKIP_PATH_CHECK="yes"
9+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v --no-modify-path
10+
RUN cp ${HOME}/.cargo/bin/* /usr/local/bin/
11+
12+
RUN cargo install --git https://github.com/anza-xyz/cargo-run-solana-tests.git \
13+
--rev c5df324a62a5e03d2ff5f9efbdbf5a4e4182325e \
14+
--bin cargo-run-solana-tests --root /usr/local
15+
16+
RUN mkdir -p /tmp/.cache/solana/v1.47/platform-tools
17+
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
18+
RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.47/platform-tools
19+
RUN rustup toolchain link solana /tmp/.cache/solana/v1.47/platform-tools/rust
20+
RUN cp -R ${HOME}/.rustup /tmp/
21+
22+
ENV CARGO_TARGET_SBPFV1_SOLANA_SOLANA_RUNNER="cargo-run-solana-tests --heap-size 104857600"
23+
ENV LLVM_HOME="/tmp/.cache/solana/v1.47/platform-tools/llvm"
24+
ENV CC="/tmp/.cache/solana/v1.47/platform-tools/llvm/bin/clang"
25+
ENV RUSTUP_TOOLCHAIN="solana"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM ubuntu:22.04
2+
RUN apt-get update && \
3+
apt-get install -y --no-install-recommends \
4+
curl \
5+
gcc libc6-dev ca-certificates bzip2 \
6+
libssl-dev pkg-config
7+
8+
ENV RUSTUP_INIT_SKIP_PATH_CHECK="yes"
9+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v --no-modify-path
10+
RUN cp ${HOME}/.cargo/bin/* /usr/local/bin/
11+
12+
RUN cargo install --git https://github.com/anza-xyz/cargo-run-solana-tests.git \
13+
--rev c5df324a62a5e03d2ff5f9efbdbf5a4e4182325e \
14+
--bin cargo-run-solana-tests --root /usr/local
15+
16+
RUN mkdir -p /tmp/.cache/solana/v1.47/platform-tools
17+
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
18+
RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.47/platform-tools
19+
RUN rustup toolchain link solana /tmp/.cache/solana/v1.47/platform-tools/rust
20+
RUN cp -R ${HOME}/.rustup /tmp/
21+
22+
ENV CARGO_TARGET_SBPFV2_SOLANA_SOLANA_RUNNER="cargo-run-solana-tests --heap-size 104857600"
23+
ENV LLVM_HOME="/tmp/.cache/solana/v1.47/platform-tools/llvm"
24+
ENV CC="/tmp/.cache/solana/v1.47/platform-tools/llvm/bin/clang"
25+
ENV RUSTUP_TOOLCHAIN="solana"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM ubuntu:22.04
2+
RUN apt-get update && \
3+
apt-get install -y --no-install-recommends \
4+
curl \
5+
gcc libc6-dev ca-certificates bzip2 \
6+
libssl-dev pkg-config
7+
8+
ENV RUSTUP_INIT_SKIP_PATH_CHECK="yes"
9+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v --no-modify-path
10+
RUN cp ${HOME}/.cargo/bin/* /usr/local/bin/
11+
12+
RUN cargo install --git https://github.com/anza-xyz/cargo-run-solana-tests.git \
13+
--rev c5df324a62a5e03d2ff5f9efbdbf5a4e4182325e \
14+
--bin cargo-run-solana-tests --root /usr/local
15+
16+
RUN mkdir -p /tmp/.cache/solana/v1.47/platform-tools
17+
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
18+
RUN tar -xjf platform-tools-linux-x86_64.tar.bz2 --strip-components 1 -C /tmp/.cache/solana/v1.47/platform-tools
19+
RUN rustup toolchain link solana /tmp/.cache/solana/v1.47/platform-tools/rust
20+
RUN cp -R ${HOME}/.rustup /tmp/
21+
22+
ENV CARGO_TARGET_SBPFV3_SOLANA_SOLANA_RUNNER="cargo-run-solana-tests --heap-size 104857600"
23+
ENV LLVM_HOME="/tmp/.cache/solana/v1.47/platform-tools/llvm"
24+
ENV CC="/tmp/.cache/solana/v1.47/platform-tools/llvm/bin/clang"
25+
ENV RUSTUP_TOOLCHAIN="solana"

ci/run.sh

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,26 @@ if [ "${NO_STD:-}" = "1" ]; then
2424
echo "nothing to do for no_std"
2525
else
2626
run="cargo test --manifest-path testcrate/Cargo.toml --no-fail-fast --target $target"
27-
$run
27+
28+
if [[ ! "$target" =~ sbf* && ! "$target" =~ sbpf-* && ! "$target" =~ sbpfv3- ]]; then
29+
# Not using release mode causes a stack overflow in SBPFv0
30+
# There is a bug in SBPFv3 whereby we were not adding returns to -O0 code
31+
$run
32+
$run --features c
33+
$run --features no-asm
34+
$run --features no-f16-f128
35+
fi
36+
2837
$run --release
29-
$run --features c
3038
$run --features c --release
31-
$run --features no-asm
3239
$run --features no-asm --release
33-
$run --features no-f16-f128
3440
$run --features no-f16-f128 --release
35-
$run --benches
36-
$run --benches --release
37-
fi
41+
42+
if [[ ! "$target" =~ sbf* && ! "$target" =~ sbpf* ]]; then
43+
# Benches require criterion, which is not compatible with SBPF
44+
$run --benches
45+
$run --benches --release
46+
fi
3847

3948
if [ "${TEST_VERBATIM:-}" = "1" ]; then
4049
verb_path=$(cmd.exe //C echo \\\\?\\%cd%\\testcrate\\target2)

testcrate/tests/conv.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ mod i_to_f {
8484
if !Float::eq_repr(f0, f1) && !cfg!(any(
8585
target_arch = "x86",
8686
target_arch = "powerpc",
87-
target_arch = "powerpc64"
87+
target_arch = "powerpc64",
88+
// In SBF, the rounding bug exists when ALU32 is disbaled.
89+
not(target_feature = "static-syscalls"),
8890
)) {
8991
panic!(
9092
"{}({}): std: {:?}, builtins: {:?}",

0 commit comments

Comments
 (0)