Skip to content

Commit 586803a

Browse files
dmakarovLucasSte
authored andcommitted
[SOL] Adjust SBF customization after upgrading to rust 1.72.0
1 parent f43c32a commit 586803a

File tree

23 files changed

+88
-372
lines changed

23 files changed

+88
-372
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ jobs:
5656
CI_JOB_NAME: "${{ matrix.image }}"
5757
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
5858
HEAD_SHA: "${{ github.event.pull_request.head.sha || github.sha }}"
59-
DOCKER_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
60-
SCCACHE_BUCKET: rust-lang-ci-sccache2
59+
SCCACHE_BUCKET: cached-ci-artifacts
60+
SCCACHE_REGION: us-east-2
61+
SCCACHE_S3_NO_CREDENTIALS: 1
6162
TOOLSTATE_REPO: "https://github.com/rust-lang-nursery/rust-toolstate"
6263
CACHE_DOMAIN: cached-ci-artifacts.s3.us-east-2.amazonaws.com
6364
continue-on-error: "${{ matrix.continue_on_error || false }}"
@@ -77,7 +78,7 @@ jobs:
7778
env: {}
7879
- name: sbf-solana-solana
7980
tidy: false
80-
os: ubuntu-latest
81+
os: ubuntu-20.04-16core-64gb
8182
env: {}
8283
- name: x86_64-gnu-tools
8384
os: ubuntu-20.04-16core-64gb
@@ -175,6 +176,8 @@ jobs:
175176
name: push
176177
env:
177178
CI_JOB_NAME: "${{ matrix.name }}"
179+
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
180+
HEAD_SHA: "${{ github.event.pull_request.head.sha || github.sha }}"
178181
SCCACHE_BUCKET: cached-ci-artifacts
179182
SCCACHE_REGION: us-east-2
180183
DEPLOY_BUCKET: rust-lang-ci2
@@ -183,19 +186,20 @@ jobs:
183186
TOOLSTATE_PUBLISH: 0
184187
CACHES_AWS_ACCESS_KEY_ID: AKIASSXOBJJGY5HRQO4U
185188
ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZN24CBO55
186-
CACHE_DOMAIN: cached-ci-artifacts.s3.us-east-2.amazonaws.com
189+
AWS_REGION: us-west-1
190+
CACHE_DOMAIN: ci-caches.rust-lang.org
187191
if: "github.event_name == 'push' && startsWith(github.ref, 'refs/heads/solana-') && github.repository == 'solana-labs/rust'"
188192
strategy:
189193
matrix:
190194
include:
191195
- name: mingw-check
192-
os: ubuntu-latest
196+
os: ubuntu-20.04-16core-64gb
193197
env: {}
194198
- name: x86_64-gnu-llvm-12
195-
os: ubuntu-latest
199+
os: ubuntu-20.04-16core-64gb
196200
env: {}
197201
- name: sbf-solana-solana
198-
os: ubuntu-latest
202+
os: ubuntu-20.04-16core-64gb
199203
env: {}
200204
timeout-minutes: 600
201205
runs-on: "${{ matrix.os }}"
@@ -219,20 +223,12 @@ jobs:
219223
- name: decide whether to skip this job
220224
run: src/ci/scripts/should-skip-this.sh
221225
if: success() && !env.SKIP_JOB
222-
- name: configure GitHub Actions to kill the build when outdated
223-
uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
224-
with:
225-
github_token: "${{ secrets.github_token }}"
226-
if: "success() && !env.SKIP_JOB && github.ref != 'refs/heads/try' && github.ref != 'refs/heads/try-perf'"
227226
- name: collect CPU statistics
228227
run: src/ci/scripts/collect-cpu-stats.sh
229228
if: success() && !env.SKIP_JOB
230229
- name: show the current environment
231230
run: src/ci/scripts/dump-environment.sh
232231
if: success() && !env.SKIP_JOB
233-
- name: install awscli
234-
run: src/ci/scripts/install-awscli.sh
235-
if: success() && !env.SKIP_JOB
236232
- name: install sccache
237233
run: src/ci/scripts/install-sccache.sh
238234
if: success() && !env.SKIP_JOB
@@ -284,6 +280,17 @@ jobs:
284280
AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}"
285281
TOOLSTATE_REPO_ACCESS_TOKEN: "${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}"
286282
if: success() && !env.SKIP_JOB
283+
- name: create github artifacts
284+
run: src/ci/scripts/create-doc-artifacts.sh
285+
if: success() && !env.SKIP_JOB
286+
- name: upload artifacts to github
287+
uses: actions/upload-artifact@v3
288+
with:
289+
name: "${{ env.DOC_ARTIFACT_NAME }}"
290+
path: obj/artifacts/doc
291+
if-no-files-found: ignore
292+
retention-days: 5
293+
if: success() && !env.SKIP_JOB
287294
- name: upload artifacts to S3
288295
run: src/ci/scripts/upload-artifacts.sh
289296
env:
@@ -297,7 +304,8 @@ jobs:
297304
CI_JOB_NAME: "${{ matrix.name }}"
298305
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
299306
HEAD_SHA: "${{ github.event.pull_request.head.sha || github.sha }}"
300-
SCCACHE_BUCKET: rust-lang-ci-sccache2
307+
SCCACHE_BUCKET: cached-ci-artifacts
308+
SCCACHE_REGION: us-east-2
301309
DEPLOY_BUCKET: rust-lang-ci2
302310
TOOLSTATE_REPO: "https://github.com/rust-lang-nursery/rust-toolstate"
303311
TOOLSTATE_ISSUES_API_URL: "https://api.github.com/repos/rust-lang/rust/issues"
@@ -603,9 +611,6 @@ jobs:
603611
- name: decide whether to skip this job
604612
run: src/ci/scripts/should-skip-this.sh
605613
if: success() && !env.SKIP_JOB
606-
- name: ensure the channel matches the target branch
607-
run: src/ci/scripts/verify-channel.sh
608-
if: success() && !env.SKIP_JOB
609614
- name: collect CPU statistics
610615
run: src/ci/scripts/collect-cpu-stats.sh
611616
if: success() && !env.SKIP_JOB
@@ -694,7 +699,8 @@ jobs:
694699
CI_JOB_NAME: "${{ matrix.name }}"
695700
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
696701
HEAD_SHA: "${{ github.event.pull_request.head.sha || github.sha }}"
697-
SCCACHE_BUCKET: rust-lang-ci-sccache2
702+
SCCACHE_BUCKET: cached-ci-artifacts
703+
SCCACHE_REGION: us-east-2
698704
DEPLOY_BUCKET: rust-lang-ci2
699705
TOOLSTATE_REPO: "https://github.com/rust-lang-nursery/rust-toolstate"
700706
TOOLSTATE_ISSUES_API_URL: "https://api.github.com/repos/rust-lang/rust/issues"
@@ -733,9 +739,6 @@ jobs:
733739
- name: decide whether to skip this job
734740
run: src/ci/scripts/should-skip-this.sh
735741
if: success() && !env.SKIP_JOB
736-
- name: ensure the channel matches the target branch
737-
run: src/ci/scripts/verify-channel.sh
738-
if: success() && !env.SKIP_JOB
739742
- name: collect CPU statistics
740743
run: src/ci/scripts/collect-cpu-stats.sh
741744
if: success() && !env.SKIP_JOB

compiler/rustc_codegen_llvm/src/allocator.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,15 @@ pub(crate) unsafe fn codegen(
8383
let llval = llvm::LLVMConstInt(i8, val as u64, False);
8484
llvm::LLVMSetInitializer(ll_g, llval);
8585

86-
let name = NO_ALLOC_SHIM_IS_UNSTABLE;
87-
let ll_g = llvm::LLVMRustGetOrInsertGlobal(llmod, name.as_ptr().cast(), name.len(), i8);
88-
if tcx.sess.default_hidden_visibility() {
89-
llvm::LLVMRustSetVisibility(ll_g, llvm::Visibility::Hidden);
86+
if tcx.sess.target.arch != "sbf" {
87+
let name = NO_ALLOC_SHIM_IS_UNSTABLE;
88+
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+
}
92+
let llval = llvm::LLVMConstInt(i8, 0, False);
93+
llvm::LLVMSetInitializer(ll_g, llval);
9094
}
91-
let llval = llvm::LLVMConstInt(i8, 0, False);
92-
llvm::LLVMSetInitializer(ll_g, llval);
9395

9496
if tcx.sess.opts.debuginfo != DebugInfo::None {
9597
let dbg_cx = debuginfo::CodegenUnitDebugContext::new(llmod);

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2031,7 +2031,7 @@ fn patch_synthetic_object_file(sess: &Session, path: &PathBuf) {
20312031
sf.write(&EM_SBF).unwrap();
20322032
}
20332033
} else {
2034-
sess.fatal(&format!("failed to patch {}", path.display()));
2034+
sess.fatal(format!("failed to patch {}", path.display()));
20352035
}
20362036
}
20372037

config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ experimental-targets = "BPF;SBF"
7474
# each linker process.
7575
# If absent or 0, linker invocations are treated like any other job and
7676
# controlled by rustbuild's -j parameter.
77-
#link-jobs = 0
77+
link-jobs = 2
7878

7979
# When invoking `llvm-config` this configures whether the `--shared` argument is
8080
# passed to prefer linking to shared libraries.

library/alloc/src/alloc.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ extern "Rust" {
3636
#[rustc_nounwind]
3737
fn __rust_alloc_zeroed(size: usize, align: usize) -> *mut u8;
3838

39+
#[cfg(not(target_family = "solana"))]
3940
static __rust_no_alloc_shim_is_unstable: u8;
4041
}
4142

@@ -95,6 +96,7 @@ pub unsafe fn alloc(layout: Layout) -> *mut u8 {
9596
unsafe {
9697
// Make sure we don't accidentally allow omitting the allocator shim in
9798
// stable code until it is actually stabilized.
99+
#[cfg(not(target_family = "solana"))]
98100
core::ptr::read_volatile(&__rust_no_alloc_shim_is_unstable);
99101

100102
__rust_alloc(layout.size(), layout.align())

library/core/src/fmt/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
use crate::cell::{Cell, Ref, RefCell, RefMut, SyncUnsafeCell, UnsafeCell};
66
use crate::char::EscapeDebugExtArgs;
77
use crate::iter;
8-
#[cfg(target_family = "solana")]
9-
use crate::intrinsics::abort;
108
use crate::marker::PhantomData;
119
use crate::mem;
1210
use crate::num::fmt as numfmt;

library/std/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ crate-type = ["dylib", "rlib"]
1414
[dependencies]
1515
alloc = { path = "../alloc", public = true }
1616
cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }
17+
panic_unwind = { path = "../panic_unwind", optional = true }
1718
panic_abort = { path = "../panic_abort" }
1819
core = { path = "../core", public = true }
1920
compiler_builtins = { version = "0.1.105" }

library/std/src/io/stdio.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,9 @@ impl Read for Stdin {
518518
fn read(&mut self, _buf: &mut [u8]) -> io::Result<usize> {
519519
Ok(0)
520520
}
521+
fn read_buf(&mut self, _buf: BorrowedCursor<'_>) -> io::Result<()> {
522+
Ok(())
523+
}
521524
fn read_vectored(&mut self, _bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
522525
Ok(0)
523526
}

library/std/src/panicking.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ pub mod panic_count {
465465
})
466466
}
467467

468+
#[cfg(not(target_family = "solana"))]
468469
pub fn finished_panic_hook() {
469470
LOCAL_PANIC_COUNT.with(|c| {
470471
let (count, _) = c.get();

library/std/src/sync/mpmc/context.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use super::select::Selected;
44
use super::waker::current_thread_id;
55

6+
#[cfg(not(target_family = "solana"))]
67
use crate::cell::Cell;
78
use crate::ptr;
89
use crate::sync::atomic::{AtomicPtr, AtomicUsize, Ordering};
@@ -34,6 +35,7 @@ struct Inner {
3435

3536
impl Context {
3637
/// Creates a new context for the duration of the closure.
38+
#[cfg(not(target_family = "solana"))]
3739
#[inline]
3840
pub fn with<F, R>(f: F) -> R
3941
where
@@ -63,6 +65,15 @@ impl Context {
6365
.unwrap_or_else(|_| f(&Context::new()))
6466
}
6567

68+
#[cfg(target_family = "solana")]
69+
#[inline]
70+
pub fn with<F, R>(f: F) -> R
71+
where
72+
F: FnOnce(&Context) -> R,
73+
{
74+
f(&Context::new())
75+
}
76+
6677
/// Creates a new `Context`.
6778
#[cold]
6879
fn new() -> Context {
@@ -77,6 +88,7 @@ impl Context {
7788
}
7889

7990
/// Resets `select` and `packet`.
91+
#[cfg(not(target_family = "solana"))]
8092
#[inline]
8193
fn reset(&self) {
8294
self.inner.select.store(Selected::Waiting.into(), Ordering::Release);

0 commit comments

Comments
 (0)