Skip to content

Commit a9be914

Browse files
committed
[SOL] Fix CI and compile previously incompatible functions (anza-xyz#33)
1 parent 59f6d1d commit a9be914

File tree

8 files changed

+126
-19
lines changed

8 files changed

+126
-19
lines changed

builtins-test/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: {:?}",

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: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,27 @@ if [ "${BUILD_ONLY:-}" = "1" ]; then
3030
echo "no tests to run for build-only targets"
3131
else
3232
test_builtins=(cargo test --package builtins-test --no-fail-fast --target "$target")
33-
"${test_builtins[@]}"
33+
if [[ ! "$target" =~ ^sbf && ! "$target" =~ ^sbpf- && ! "$target" =~ ^sbpfv3- ]]; then
34+
# Not using release mode causes a stack overflow in SBPFv0
35+
# There is a bug in SBPFv3 whereby we were not adding returns to -O0 code
36+
"${test_builtins[@]}"
37+
"${test_builtins[@]}" --features c
38+
"${test_builtins[@]}" --features no-asm
39+
"${test_builtins[@]}" --features no-f16-f128
40+
fi
41+
3442
"${test_builtins[@]}" --release
35-
"${test_builtins[@]}" --features c
3643
"${test_builtins[@]}" --features c --release
37-
"${test_builtins[@]}" --features no-asm
3844
"${test_builtins[@]}" --features no-asm --release
39-
"${test_builtins[@]}" --features no-f16-f128
4045
"${test_builtins[@]}" --features no-f16-f128 --release
41-
"${test_builtins[@]}" --benches
42-
"${test_builtins[@]}" --benches --release
46+
47+
if [[ ! "$target" =~ ^sbf && ! "$target" =~ ^sbpf ]]; then
48+
# Benches require criterion, which is not compatible with SBPF
49+
"${test_builtins[@]}" --benches
50+
"${test_builtins[@]}" --benches --release
51+
"${test_builtins[@]}" --benches
52+
"${test_builtins[@]}" --benches --release
53+
fi
4354

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

compiler-builtins/build.rs

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

613613
if target.os == "solana" {
614614
cfg.define("__ELF__", None);
615-
// Remove the implementations that fail to build.
616-
// This list should shrink to zero
617-
sources.remove(&[
618-
"__int_util", // Unsupported architecture error
619-
"__mulvdi3", // Unsupported signed division
620-
"__mulvsi3", // Unsupported signed division
621-
]);
622615
}
623616

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

0 commit comments

Comments
 (0)