Skip to content

Commit fe0d868

Browse files
committed
[SOL] Create sbpfv4 target for ABIv2 (anza-xyz#130)
* [SOL] Create sbpfv4 target for ABIv2 * Bump compiler builtins version * Fix platform-support.md typo
1 parent 8187160 commit fe0d868

File tree

14 files changed

+31
-13
lines changed

14 files changed

+31
-13
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3145,7 +3145,7 @@ dependencies = [
31453145
[[package]]
31463146
name = "rustc-build-sysroot"
31473147
version = "0.5.3"
3148-
source = "git+https://github.com/anza-xyz/rustc-build-sysroot?tag=solana-tools-v1.44#4f19dfe109fc80efbe62b6de9781125bc7ce7485"
3148+
source = "git+https://github.com/anza-xyz/rustc-build-sysroot?tag=solana-tools-v1.48#0e6a6c1127ca9b33158334029693344e2638ec57"
31493149
dependencies = [
31503150
"anyhow",
31513151
"rustc_version",

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ esac
2424
if [ "$1" == "--llvm" ]; then
2525
rm -f build/${HOST_TRIPLE}/llvm/llvm-finished-building;
2626
fi
27-
./x.py build --stage 1 --target ${HOST_TRIPLE},sbf-solana-solana,sbpf-solana-solana,sbpfv1-solana-solana,sbpfv2-solana-solana,sbpfv3-solana-solana
27+
./x.py build --stage 1 --target ${HOST_TRIPLE},sbf-solana-solana,sbpf-solana-solana,sbpfv1-solana-solana,sbpfv2-solana-solana,sbpfv3-solana-solana,sbpfv4-solana-solana

compiler/rustc_target/src/spec/base/sbf_base.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub(crate) fn opts(version: &'static str) -> TargetOptions {
9696
linker_args.as_slice(),
9797
);
9898

99-
let linker_script = if version == "v3" {
99+
let linker_script = if version == "v3" || version == "v4" {
100100
V3_LINKER_SCRIPT
101101
} else {
102102
V0_LINKER_SCRIPT
@@ -107,12 +107,11 @@ pub(crate) fn opts(version: &'static str) -> TargetOptions {
107107
version
108108
};
109109

110-
let features = if version == "v3" {
111-
"+static-syscalls"
112-
} else if version == "v0" {
113-
"+store-imm,+jmp-ext"
114-
} else {
115-
""
110+
let features = match version {
111+
"v4" => "+static-syscalls,+abi-v2",
112+
"v3" => "+static-syscalls",
113+
"v0" => "+store-imm,+jmp-ext",
114+
_ => ""
116115
};
117116

118117
TargetOptions {

compiler/rustc_target/src/spec/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2052,6 +2052,7 @@ supported_targets! {
20522052
("sbpfv1-solana-solana", sbpfv1_solana_solana),
20532053
("sbpfv2-solana-solana", sbpfv2_solana_solana),
20542054
("sbpfv3-solana-solana", sbpfv3_solana_solana),
2055+
("sbpfv4-solana-solana", sbpfv4_solana_solana),
20552056

20562057

20572058
("armv6k-nintendo-3ds", armv6k_nintendo_3ds),
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
use crate::spec::Target;
2+
use crate::spec::base::sbf_base;
3+
4+
pub(crate) fn target() -> Target {
5+
sbf_base::sbf_target("v4")
6+
}

compiler/rustc_target/src/target_features.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@ const SBF_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
653653
("alu32", Unstable(sym::sbf_target_feature), &[]),
654654
("static-syscalls", Stable, &[]),
655655
("dynamic-frames", Stable, &[]),
656+
("abi-v2", Stable, &[]),
656657
];
657658

658659
const CSKY_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[

library/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,8 @@ rustflags = ["-Cpanic=abort"]
6060
rustc-std-workspace-core = { path = 'rustc-std-workspace-core' }
6161
rustc-std-workspace-alloc = { path = 'rustc-std-workspace-alloc' }
6262
rustc-std-workspace-std = { path = 'rustc-std-workspace-std' }
63+
<<<<<<< HEAD
6364
compiler_builtins = { path = "compiler-builtins/compiler-builtins" }
65+
=======
66+
compiler_builtins = { git = "https://github.com/anza-xyz/compiler-builtins", tag = "solana-tools-v1.48" }
67+
>>>>>>> 293a1b6c60a ([SOL] Create sbpfv4 target for ABIv2 (#130))

src/bootstrap/src/core/sanity.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const STAGE0_MISSING_TARGETS: &[&str] = &[
4242
"sbpfv1-solana-solana",
4343
"sbpfv2-solana-solana",
4444
"sbpfv3-solana-solana",
45+
"sbpfv4-solana-solana",
4546
];
4647

4748
/// Minimum version threshold for libstdc++ required when using prebuilt LLVM

src/bootstrap/src/utils/cc_detect.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ fn default_compiler(
215215
| "sbpfv0-solana-solana"
216216
| "sbpfv1-solana-solana"
217217
| "sbpfv2-solana-solana"
218-
| "sbpfv3-solana-solana" => {
218+
| "sbpfv3-solana-solana"
219+
| "sbpfv4-solana-solana" => {
219220
Some(build.llvm_bin(target).join(compiler.clang()))
220221
}
221222

src/doc/rustc/src/platform-support.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ target | std | host | notes
396396
`sbpfv1-solana-solana` | ✓ | | SBPF v1
397397
`sbpfv2-solana-solana` | ✓ | | SBPF v2
398398
`sbpfv3-solana-solana` | ✓ | | SBPF v3
399+
`sbpfv4-solana-solana` | ✓ | | SBPF v4
399400
`sparc-unknown-linux-gnu` | ✓ | | 32-bit SPARC Linux
400401
[`sparc-unknown-none-elf`](./platform-support/sparc-unknown-none-elf.md) | * | | Bare 32-bit SPARC V7+
401402
[`sparc64-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | NetBSD/sparc64

0 commit comments

Comments
 (0)