Skip to content

Commit aa44b91

Browse files
committed
[SOL] Fixes after Rust 1.84.1 upgrade
1 parent 6760cbe commit aa44b91

File tree

68 files changed

+532
-400
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+532
-400
lines changed

Diff for: .github/workflows/ci.yml

+12-41
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ jobs:
7979
continue-on-error: ${{ matrix.continue_on_error || false }}
8080
strategy:
8181
matrix:
82+
# Check the `calculate_matrix` job to see how is the matrix defined.
83+
include: ${{ fromJSON(needs.calculate_matrix.outputs.jobs) }}
8284
steps:
8385
- if: contains(matrix.os, 'windows')
8486
uses: msys2/[email protected]
@@ -130,8 +132,8 @@ jobs:
130132
# which then uses log commands to actually set them.
131133
EXTRA_VARIABLES: ${{ toJson(matrix.env) }}
132134

133-
- name: ensure the channel matches the target branch
134-
run: src/ci/scripts/verify-channel.sh
135+
# - name: ensure the channel matches the target branch
136+
# run: src/ci/scripts/verify-channel.sh
135137

136138
- name: collect CPU statistics
137139
run: src/ci/scripts/collect-cpu-stats.sh
@@ -180,14 +182,14 @@ jobs:
180182
- name: disable git crlf conversion
181183
run: src/ci/scripts/disable-git-crlf-conversion.sh
182184

183-
- name: ensure line endings are correct
184-
run: src/ci/scripts/verify-line-endings.sh
185-
186-
- name: ensure backported commits are in upstream branches
187-
run: src/ci/scripts/verify-backported-commits.sh
185+
# - name: ensure line endings are correct
186+
# run: src/ci/scripts/verify-line-endings.sh
187+
#
188+
# - name: ensure backported commits are in upstream branches
189+
# run: src/ci/scripts/verify-backported-commits.sh
188190

189-
- name: ensure the stable version number is correct
190-
run: src/ci/scripts/verify-stable-version-number.sh
191+
# - name: ensure the stable version number is correct
192+
# run: src/ci/scripts/verify-stable-version-number.sh
191193

192194
- name: run the build
193195
# Redirect stderr to stdout to avoid reordering the two streams in the GHA logs.
@@ -204,45 +206,14 @@ jobs:
204206
echo "disk usage:"
205207
df -h
206208
207-
- name: upload artifacts to github
208-
uses: actions/upload-artifact@v4
209-
with:
210-
# name is set in previous step
211-
name: ${{ env.DOC_ARTIFACT_NAME }}
212-
path: obj/artifacts/doc
213-
if-no-files-found: ignore
214-
retention-days: 5
215-
216-
- name: upload artifacts to S3
217-
run: src/ci/scripts/upload-artifacts.sh
218-
env:
219-
AWS_ACCESS_KEY_ID: ${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}
220-
AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}
221-
# Adding a condition on DEPLOY=1 or DEPLOY_ALT=1 is not needed as all deploy
222-
# builders *should* have the AWS credentials available. Still, explicitly
223-
# adding the condition is helpful as this way CI will not silently skip
224-
# deploying artifacts from a dist builder if the variables are misconfigured,
225-
# erroring about invalid credentials instead.
226-
if: github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1'
227-
228-
- name: upload job metrics to DataDog
229-
if: needs.calculate_matrix.outputs.run_type != 'pr'
230-
env:
231-
DATADOG_SITE: datadoghq.com
232-
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
233-
DD_GITHUB_JOB_NAME: ${{ matrix.name }}
234-
run: |
235-
npm install -g @datadog/datadog-ci@^2.x.x
236-
python3 src/ci/scripts/upload-build-metrics.py build/cpu-usage.csv
237-
238209
# This job isused to tell bors the final status of the build, as there is no practical way to detect
239210
# when a workflow is successful listening to webhooks only in our current bors implementation (homu).
240211
outcome:
241212
name: bors build finished
242213
runs-on: ubuntu-latest
243214
needs: [ calculate_matrix, job ]
244215
# !cancelled() executes the job regardless of whether the previous jobs passed or failed
245-
if: ${{ !cancelled() && contains(fromJSON('["auto", "try"]'), needs.calculate_matrix.outputs.run_type) }
216+
if: ${{ !cancelled() && contains(fromJSON('["auto", "try"]'), needs.calculate_matrix.outputs.run_type) }}
246217
steps:
247218
- name: checkout the source code
248219
uses: actions/checkout@v4

Diff for: Cargo.lock

+7-14
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,7 @@ checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
14341434
dependencies = [
14351435
"cfg-if",
14361436
"libc",
1437-
"wasi 0.11.0+wasi-snapshot-preview1",
1437+
"wasi",
14381438
]
14391439

14401440
[[package]]
@@ -2284,7 +2284,7 @@ dependencies = [
22842284
"colored",
22852285
"ctrlc",
22862286
"directories",
2287-
"getrandom 0.2.13",
2287+
"getrandom",
22882288
"jemalloc-sys",
22892289
"libc",
22902290
"libffi",
@@ -2925,7 +2925,7 @@ version = "0.6.4"
29252925
source = "registry+https://github.com/rust-lang/crates.io-index"
29262926
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
29272927
dependencies = [
2928-
"getrandom 0.2.13",
2928+
"getrandom",
29292929
]
29302930

29312931
[[package]]
@@ -2972,7 +2972,7 @@ version = "0.4.6"
29722972
source = "registry+https://github.com/rust-lang/crates.io-index"
29732973
checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
29742974
dependencies = [
2975-
"getrandom 0.2.13",
2975+
"getrandom",
29762976
"libredox",
29772977
"thiserror",
29782978
]
@@ -3117,9 +3117,8 @@ dependencies = [
31173117

31183118
[[package]]
31193119
name = "rustc-build-sysroot"
3120-
version = "0.5.4"
3121-
source = "registry+https://github.com/rust-lang/crates.io-index"
3122-
checksum = "d6d984a9db43148467059309bd1e5ad577085162f695d9fe2cf3543aeb25cd38"
3120+
version = "0.5.3"
3121+
source = "git+https://github.com/anza-xyz/rustc-build-sysroot?tag=solana-tools-v1.47#0d6d7ae18aaecf45f0a6e87bcf83b2293263f5bd"
31233122
dependencies = [
31243123
"anyhow",
31253124
"rustc_version",
@@ -5701,7 +5700,7 @@ version = "1.11.0"
57015700
source = "registry+https://github.com/rust-lang/crates.io-index"
57025701
checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a"
57035702
dependencies = [
5704-
"getrandom 0.2.13",
5703+
"getrandom",
57055704
]
57065705

57075706
[[package]]
@@ -5732,12 +5731,6 @@ dependencies = [
57325731
"winapi-util",
57335732
]
57345733

5735-
[[package]]
5736-
name = "wasi"
5737-
version = "0.9.0+wasi-snapshot-preview1"
5738-
source = "registry+https://github.com/rust-lang/crates.io-index"
5739-
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
5740-
57415734
[[package]]
57425735
name = "wasi"
57435736
version = "0.11.0+wasi-snapshot-preview1"

Diff for: build.sh

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# SPDX-FileCopyrightText: 2025 Anza Technology Inc. <https://www.anza.xyz>
2+
#
3+
# SPDX-License-Identifier: MIT
4+
15
#!/usr/bin/env bash
26

37
set -ex

Diff for: compiler/rustc_codegen_gcc/build_system/build_sysroot/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ resolver = "2"
66

77
[dependencies]
88
core = { path = "./sysroot_src/library/core" }
9-
compiler_builtins = "0.1"
9+
compiler_builtins = { git = "https://github.com/anza-xyz/compiler-builtins", tag = "solana-tools-v1.47" }
1010
alloc = { path = "./sysroot_src/library/alloc" }
1111
std = { path = "./sysroot_src/library/std", features = ["panic_unwind", "backtrace"] }
1212
test = { path = "./sysroot_src/library/test" }

Diff for: compiler/rustc_codegen_llvm/src/allocator.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ pub(crate) unsafe fn codegen(
8686
if tcx.sess.target.arch != "sbf" {
8787
let name = NO_ALLOC_SHIM_IS_UNSTABLE;
8888
let ll_g = llvm::LLVMRustGetOrInsertGlobal(llmod, name.as_ptr().cast(), name.len(), i8);
89-
if tcx.sess.default_hidden_visibility() {
90-
llvm::LLVMRustSetVisibility(ll_g, llvm::Visibility::Hidden);
91-
}
89+
llvm::set_visibility(ll_g, llvm::Visibility::from_generic(tcx.sess.default_visibility()));
9290
let llval = llvm::LLVMConstInt(i8, 0, False);
9391
llvm::LLVMSetInitializer(ll_g, llval);
9492
}

Diff for: compiler/rustc_codegen_ssa/src/back/linker.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -443,17 +443,19 @@ impl<'a> GccLinker<'a> {
443443
soname.push(name);
444444
self.link_arg(soname);
445445
}
446-
} else if self.sess.target.arch == "bpf" || self.sess.target.arch == "sbf" {
446+
}
447+
448+
if self.sess.target.arch == "bpf" || self.sess.target.arch == "sbf" {
447449
if self.sess.opts.test {
448-
self.linker_arg("--entry=main");
450+
self.link_arg("--entry=main");
449451
} else {
450-
self.linker_arg("--entry=entrypoint");
452+
self.link_arg("--entry=entrypoint");
451453
}
452454
if self.sess.opts.cg.target_cpu.as_ref()
453455
.unwrap_or(&self.sess.target.cpu.as_ref().to_string()) == "v3" {
454-
self.linker_arg("-Bsymbolic");
456+
self.link_arg("-Bsymbolic");
455457
if self.sess.opts.debuginfo == DebugInfo::None {
456-
self.linker_arg("--strip-all");
458+
self.link_arg("--strip-all");
457459
}
458460
}
459461
}

Diff for: compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ extern "C" void LLVMRustTimeTraceProfilerFinish(const char *FileName) {
197197
SUBTARGET_RISCV \
198198
SUBTARGET_LOONGARCH \
199199
SUBTARGET_BPF \
200-
SUBTARGET_SBF \
200+
SUBTARGET_SBF
201201

202202
#define SUBTARGET(x) \
203203
namespace llvm { \

Diff for: compiler/rustc_span/src/symbol.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1766,9 +1766,9 @@ symbols! {
17661766
saturating_add,
17671767
saturating_div,
17681768
saturating_sub,
1769+
sbf_target_feature,
17691770
search_unbox,
17701771
select_unpredictable,
1771-
sbf_target_feature,
17721772
self_in_typedefs,
17731773
self_struct_ctor,
17741774
semitransparent,

Diff for: compiler/rustc_target/src/callconv/sbf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fn classify_arg<Ty>(arg: &mut ArgAbi<'_, Ty>) {
3131
}
3232
}
3333

34-
pub fn compute_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
34+
pub(crate) fn compute_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
3535
if !fn_abi.ret.is_ignore() {
3636
classify_ret(&mut fn_abi.ret);
3737
}

Diff for: compiler/rustc_target/src/spec/base/sbf_base.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::abi::Endian;
2-
use crate::spec::{Cc, cvs, LinkerFlavor, Lld, PanicStrategy, Target, TargetOptions};
2+
use crate::spec::{Cc, cvs, LinkerFlavor, Lld, PanicStrategy, Target, TargetOptions, SymbolVisibility};
33

44
const V0_LINKER_SCRIPT: &str = r"
55
PHDRS
@@ -81,7 +81,7 @@ PHDRS
8181
}
8282
";
8383

84-
pub fn opts(version: &'static str) -> TargetOptions {
84+
pub(crate) fn opts(version: &'static str) -> TargetOptions {
8585
let mut linker_args: Vec<&str> = vec![
8686
"--threads=1", "-z", "notext", "--Bdynamic"
8787
];
@@ -118,7 +118,7 @@ pub fn opts(version: &'static str) -> TargetOptions {
118118
TargetOptions {
119119
allow_asm: true,
120120
c_int_width: "64".into(),
121-
default_hidden_visibility: true,
121+
default_visibility: Some(SymbolVisibility::Hidden),
122122
dll_prefix: "".into(),
123123
dynamic_linking: true,
124124
eh_frame_header: false,
@@ -148,7 +148,7 @@ pub fn opts(version: &'static str) -> TargetOptions {
148148
}
149149
}
150150

151-
pub fn sbf_target(version: &'static str) -> Target {
151+
pub(crate) fn sbf_target(version: &'static str) -> Target {
152152
Target {
153153
llvm_target: "sbf".into(),
154154
pointer_width: 64,
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::spec::Target;
22
use crate::spec::base::sbf_base;
33

4-
pub fn target() -> Target {
4+
pub(crate) fn target() -> Target {
55
sbf_base::sbf_target("v0")
66
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::spec::Target;
22
use crate::spec::base::sbf_base;
33

4-
pub fn target() -> Target {
4+
pub(crate) fn target() -> Target {
55
sbf_base::sbf_target("v0")
66
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::spec::Target;
22
use crate::spec::base::sbf_base;
33

4-
pub fn target() -> Target {
4+
pub(crate) fn target() -> Target {
55
sbf_base::sbf_target("v1")
66
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::spec::Target;
22
use crate::spec::base::sbf_base;
33

4-
pub fn target() -> Target {
4+
pub(crate) fn target() -> Target {
55
sbf_base::sbf_target("v2")
66
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::spec::Target;
22
use crate::spec::base::sbf_base;
33

4-
pub fn target() -> Target {
4+
pub(crate) fn target() -> Target {
55
sbf_base::sbf_target("v3")
66
}

Diff for: config.toml

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# SPDX-FileCopyrightText: 2025 Anza Technology Inc. <https://www.anza.xyz>
2+
#
3+
# SPDX-License-Identifier: MIT
4+
15
# Sample TOML configuration file for building Rust.
26
#
37
# To configure rustbuild, copy this file to the directory from which you will be

Diff for: library/Cargo.lock

+1-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ dependencies = [
6262
[[package]]
6363
name = "compiler_builtins"
6464
version = "0.1.138"
65-
source = "registry+https://github.com/rust-lang/crates.io-index"
66-
checksum = "53f0ea7fff95b51f84371588f06062557e96bbe363d2b36218ddb806f3ca8611"
65+
source = "git+https://github.com/anza-xyz/compiler-builtins?tag=solana-tools-v1.47#bf501f2f0a7d38d6dca6aab067017a288d2bf2dd"
6766
dependencies = [
6867
"cc",
6968
"rustc-std-workspace-core",

Diff for: library/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,4 @@ rustc-demangle.debug = 0
4545
rustc-std-workspace-core = { path = 'rustc-std-workspace-core' }
4646
rustc-std-workspace-alloc = { path = 'rustc-std-workspace-alloc' }
4747
rustc-std-workspace-std = { path = 'rustc-std-workspace-std' }
48+
compiler_builtins = { git = "https://github.com/anza-xyz/compiler-builtins", tag = "solana-tools-v1.47" }

Diff for: library/alloc/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ edition = "2021"
1010

1111
[dependencies]
1212
core = { path = "../core" }
13-
compiler_builtins = { git = "https://github.com/anza-xyz/compiler-builtins", tag = "solana-tools-v1.44" , features = ['rustc-dep-of-std'] }
13+
compiler_builtins = { git = "https://github.com/anza-xyz/compiler-builtins", tag = "solana-tools-v1.47", features = ['rustc-dep-of-std'] }
1414

1515
[dev-dependencies]
1616
rand = { version = "0.8.5", default-features = false, features = ["alloc"] }
@@ -53,4 +53,5 @@ check-cfg = [
5353
'cfg(no_rc)',
5454
'cfg(no_sync)',
5555
'cfg(randomized_layouts)',
56+
'cfg(target_family, values("solana"))'
5657
]

Diff for: library/alloc/src/alloc.rs

+1
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ pub unsafe fn alloc_zeroed(layout: Layout) -> *mut u8 {
179179
unsafe {
180180
// Make sure we don't accidentally allow omitting the allocator shim in
181181
// stable code until it is actually stabilized.
182+
#[cfg(not(target_family = "solana"))]
182183
core::ptr::read_volatile(&__rust_no_alloc_shim_is_unstable);
183184

184185
__rust_alloc_zeroed(layout.size(), layout.align())

0 commit comments

Comments
 (0)