Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 6 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,10 @@ jobs:
- name: mingw-check-tidy
os: ubuntu-latest
env: {}
- name: x86_64-gnu-llvm-15
env:
ENABLE_GCC_CODEGEN: "1"
os: ubuntu-latest
- name: sbf-solana-solana
- name: sbpfv3-solana-solana
tidy: false
os: ubuntu-latest
env: {}
- name: x86_64-gnu-tools
os: ubuntu-latest
env: {}
timeout-minutes: 600
runs-on: "${{ matrix.os }}"
steps:
Expand Down Expand Up @@ -161,7 +154,7 @@ jobs:
run: src/ci/scripts/create-doc-artifacts.sh
if: success() && !env.SKIP_JOB
- name: upload artifacts to github
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: "${{ env.DOC_ARTIFACT_NAME }}"
path: obj/artifacts/doc
Expand Down Expand Up @@ -201,7 +194,7 @@ jobs:
- name: x86_64-gnu-llvm-12
os: ubuntu-latest
env: {}
- name: sbf-solana-solana
- name: sbpfv3-solana-solana
os: ubuntu-latest
env: {}
timeout-minutes: 600
Expand Down Expand Up @@ -295,7 +288,7 @@ jobs:
run: src/ci/scripts/create-doc-artifacts.sh
if: success() && !env.SKIP_JOB
- name: upload artifacts to github
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: "${{ env.DOC_ARTIFACT_NAME }}"
path: obj/artifacts/doc
Expand Down Expand Up @@ -442,14 +435,6 @@ jobs:
env:
RUST_BACKTRACE: 1
os: ubuntu-latest
- name: x86_64-gnu-llvm-16
env:
RUST_BACKTRACE: 1
os: ubuntu-latest
- name: x86_64-gnu-llvm-15
env:
RUST_BACKTRACE: 1
os: ubuntu-latest
- name: x86_64-gnu-nopt
os: ubuntu-latest
env: {}
Expand Down Expand Up @@ -691,7 +676,7 @@ jobs:
run: src/ci/scripts/create-doc-artifacts.sh
if: success() && !env.SKIP_JOB
- name: upload artifacts to github
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: "${{ env.DOC_ARTIFACT_NAME }}"
path: obj/artifacts/doc
Expand Down Expand Up @@ -821,7 +806,7 @@ jobs:
run: src/ci/scripts/create-doc-artifacts.sh
if: success() && !env.SKIP_JOB
- name: upload artifacts to github
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: "${{ env.DOC_ARTIFACT_NAME }}"
path: obj/artifacts/doc
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ checksum = "55b672471b4e9f9e95499ea597ff64941a309b2cdbffcc46f2cc5e2d971fd335"
[[package]]
name = "compiler_builtins"
version = "0.1.103"
source = "git+https://github.com/anza-xyz/compiler-builtins?tag=solana-tools-v1.40#81ef46f3fe1357095acdd089a700890fe4e13974"
source = "git+https://github.com/anza-xyz/compiler-builtins?tag=solana-tools-v1.42.1#b9d3bd3463c95deac85d25c8fa19e754f6e92b9e"
dependencies = [
"cc",
"rustc-std-workspace-core",
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ miniz_oxide.debug = 0
object.debug = 0

[patch.crates-io]
compiler_builtins = { git = "https://github.com/anza-xyz/compiler-builtins", tag = "solana-tools-v1.40" }
compiler_builtins = { git = "https://github.com/anza-xyz/compiler-builtins", tag = "solana-tools-v1.42.1" }
# See comments in `library/rustc-std-workspace-core/README.md` for what's going on
# here
rustc-std-workspace-core = { path = 'library/rustc-std-workspace-core' }
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ esac
if [ "$1" == "--llvm" ]; then
rm -f build/${HOST_TRIPLE}/llvm/llvm-finished-building;
fi
./x.py build --stage 1 --target ${HOST_TRIPLE},bpfel-unknown-unknown,sbf-solana-solana
./x.py build --stage 1 --target ${HOST_TRIPLE},sbpfv3-solana-solana
1 change: 1 addition & 0 deletions compiler/rustc_codegen_ssa/src/back/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
"loongarch64" => Architecture::LoongArch64,
"csky" => Architecture::Csky,
"bpf" => Architecture::Bpf,
"sbf" if sess.target.options.cpu.as_ref() == "v3" => Architecture::Bpf,
"sbf" => Architecture::Bpf,
Comment on lines +214 to 215

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition is not necessary, as SBF already points to BPF.

// Unsupported architecture.
_ => return None,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/target_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ const WASM_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
// tidy-alphabetical-end
];

const BPF_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[("alu32", Some(sym::bpf_target_feature))];
const BPF_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[("alu32", None)];

const SBF_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] =
&[("alu32", Some(sym::sbf_target_feature)), ("static-syscalls", Some(sym::sbf_target_feature))];
Expand Down
83 changes: 78 additions & 5 deletions compiler/rustc_target/src/spec/base/sbf_base.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::abi::Endian;
use crate::spec::{Cc, cvs, LinkerFlavor, Lld, PanicStrategy, TargetOptions};
use crate::spec::{Cc, cvs, LinkerFlavor, Lld, PanicStrategy, Target, TargetOptions};

pub fn opts() -> TargetOptions {
let linker_script = r"
const V0_LINKER_SCRIPT: &str = r"
PHDRS
{
text PT_LOAD ;
Expand All @@ -28,11 +27,74 @@ SECTIONS
}
}
";

const V3_LINKER_SCRIPT: &str = r"
SECTIONS
{
.rodata 0x000000000 : SUBALIGN(8) {
BYTE(0);
*(.rodata*)
*(.data.rel.ro*)
. = ALIGN(8);
} :rodata
.text 0x100000000 : {
*(.text*)
} :text
/DISCARD/ : {
*(.comment*)
*(.eh_frame*)
*(*hash*)
*(.bss*)
*(.data*)
*(.rel.dyn*)
*(.dynamic)
*(.dynsym)
*(.dynstr)
}
}

PHDRS
{
rodata PT_LOAD FLAGS(4);
text PT_LOAD FLAGS(1);
other PT_NULL FLAGS(0);
}
";

pub fn opts(version: &'static str) -> TargetOptions {
let mut linker_args: Vec<&str> = vec![
"--threads=1", "-z", "notext"
];

if version != "v3" {
linker_args.push("-z");
linker_args.push("max-page-size=4096");
}

let pre_link_args = TargetOptions::link_args(
LinkerFlavor::Gnu(Cc::No, Lld::No),
&["--threads=1", "-z", "notext"],
linker_args.as_slice(),
);

let linker_script = if version == "v3" {
V3_LINKER_SCRIPT
} else {
V0_LINKER_SCRIPT
};
let cpu = if version == "v0" {
"generic"
} else {
version
};

let features = if version == "v3" {
"+static-syscalls"
} else if version == "v0" {
"+store-imm,+jmp-ext"
} else {
""
};

TargetOptions {
allow_asm: true,
c_int_width: "64".into(),
Expand All @@ -44,7 +106,6 @@ SECTIONS
endian: Endian::Little,
env: "".into(),
executables: true,
features: "+solana".into(),
families: cvs!["solana"],
link_script: Some(linker_script.into()),
linker: Some("rust-lld".into()),
Expand All @@ -61,6 +122,18 @@ SECTIONS
singlethread: true,
vendor: "solana".into(),
c_enum_min_bits: Some(32),
cpu: cpu.into(),
features: features.into(),
.. Default::default()
}
}

pub fn sbf_target(version: &'static str) -> Target {
Target {
llvm_target: "sbf".into(),
pointer_width: 64,
arch: "sbf".into(),
data_layout: "e-m:e-p:64:64-i64:64-n32:64-S128".into(),
options: opts(version),
}
}
2 changes: 1 addition & 1 deletion compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1692,7 +1692,7 @@ supported_targets! {
("bpfeb-unknown-none", bpfeb_unknown_none),
("bpfel-unknown-none", bpfel_unknown_none),
("bpfel-unknown-unknown", bpfel_unknown_unknown),
("sbf-solana-solana", sbf_solana_solana),
("sbpfv3-solana-solana", sbpfv3_solana_solana),

("armv6k-nintendo-3ds", armv6k_nintendo_3ds),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ pub fn target() -> Target {
pointer_width: 64,
arch: "bpf".into(),
data_layout: "e-m:e-p:64:64-i64:64-n32:64-S128".into(),
options: sbf_base::opts(),
options: sbf_base::opts("v0"),
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ pub fn target() -> Target {
pointer_width: 64,
arch: "sbf".into(),
data_layout: "e-m:e-p:64:64-i64:64-n32:64-S128".into(),
options: sbf_base::opts(),
options: sbf_base::opts("v0"),
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use crate::spec::Target;
use crate::spec::base::sbf_base;

pub fn target() -> Target {
sbf_base::sbf_target("v3")
}
2 changes: 1 addition & 1 deletion src/bootstrap/src/utils/cc_detect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ fn default_compiler(
}
}

"bpfel-unknown-unknown" | "sbf-solana-solana" => {
"bpfel-unknown-unknown" | "sbf-solana-solana" | "sbpfv3-solana-solana" => {
Some(PathBuf::from(build.llvm_bin(target).join(compiler.clang())))
}

Expand Down
44 changes: 44 additions & 0 deletions src/ci/docker/host-x86_64/sbpfv3-solana-solana/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
FROM ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
python3 \
git \
cmake \
sudo \
gdb \
libssl-dev \
pkg-config \
xz-utils

ENV RUSTUP_INIT_SKIP_PATH_CHECK="yes"
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

RUN PATH="${HOME}/.cargo/bin:${PATH}" \
cargo install --git https://github.com/anza-xyz/cargo-run-solana-tests.git \
--rev db104fd1ce22986a0935f10f07e7e1f889db7e80 \
--bin cargo-run-solana-tests --root /usr/local

COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh

# We are disabling CI LLVM since this builder is intentionally using a host
# LLVM, rather than the typical src/llvm-project LLVM.
ENV NO_DOWNLOAD_CI_LLVM 1

ENV RUST_CONFIGURE_ARGS \
--set rust.lld \
--set llvm.clang

ENV SCRIPT CARGO_TARGET_SBPFV3_SOLANA_SOLANA_RUNNER=\"cargo-run-solana-tests --heap-size 104857600\" \
LLVM_HOME=/checkout/obj/build/x86_64-unknown-linux-gnu/llvm \
PATH="${HOME}/.cargo/bin:${PATH}" \
python3 /checkout/x.py --stage 1 test --host='' --target sbpfv3-solana-solana \
library/core
4 changes: 2 additions & 2 deletions src/ci/docker/scripts/sccache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ set -ex

case "$(uname -m)" in
x86_64)
url="https://cached-ci-artifacts.s3.us-east-2.amazonaws.com/sccache-5d2a373-x86_64-unknown-linux-musl"
url="https://ci-mirrors.rust-lang.org/rustc/2021-08-24-sccache-v0.2.15-x86_64-unknown-linux-musl"
;;
aarch64)
url="https://ci-mirrors.rust-lang.org/rustc/2021-08-25-sccache-v0.2.15-aarch64-unknown-linux-musl"
url="https://ci-mirrors.rust-lang.org/rustc/2025-02-24-sccache-v0.10.0-aarch64-unknown-linux-musl"
;;
*)
echo "unsupported architecture: $(uname -m)"
Expand Down
24 changes: 3 additions & 21 deletions src/ci/github-actions/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ x--expand-yaml-anchors--remove:
<<: *step

- name: upload artifacts to github
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
# name is set in previous step
name: ${{ env.DOC_ARTIFACT_NAME }}
Expand Down Expand Up @@ -350,18 +350,10 @@ jobs:
- name: mingw-check-tidy
<<: *job-linux-4c

- name: x86_64-gnu-llvm-15
env:
ENABLE_GCC_CODEGEN: "1"
<<: *job-linux-16c

- name: sbf-solana-solana
- name: sbpfv3-solana-solana
<<: *job-linux-16c
tidy: false

- name: x86_64-gnu-tools
<<: *job-linux-16c

push:
<<: *base-ci-job
name: push
Expand All @@ -377,7 +369,7 @@ jobs:
- name: x86_64-gnu-llvm-12
<<: *job-linux-16c

- name: sbf-solana-solana
- name: sbpfv3-solana-solana
<<: *job-linux-16c

auto:
Expand Down Expand Up @@ -519,16 +511,6 @@ jobs:
RUST_BACKTRACE: 1
<<: *job-linux-8c

- name: x86_64-gnu-llvm-16
env:
RUST_BACKTRACE: 1
<<: *job-linux-8c

- name: x86_64-gnu-llvm-15
env:
RUST_BACKTRACE: 1
<<: *job-linux-8c

- name: x86_64-gnu-nopt
<<: *job-linux-4c

Expand Down
2 changes: 1 addition & 1 deletion src/llvm-project
Submodule llvm-project updated 137 files
1 change: 1 addition & 0 deletions src/tools/build-manifest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ static TARGETS: &[&str] = &[
"riscv64gc-unknown-linux-gnu",
"s390x-unknown-linux-gnu",
"sbf-solana-solana",
"sbpfv3-solana-solana",
"sparc64-unknown-linux-gnu",
"sparcv9-sun-solaris",
"sparc-unknown-none-elf",
Expand Down
Loading
Loading