Skip to content

Commit ad7f604

Browse files
committed
[SOL] Adjust compiler after upgrade to 1.75.0
1 parent df535d9 commit ad7f604

File tree

18 files changed

+73
-40
lines changed

18 files changed

+73
-40
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ jobs:
208208
- name: disable git crlf conversion
209209
run: git config --global core.autocrlf false
210210
- name: checkout the source code
211-
uses: actions/checkout@v3
211+
uses: actions/checkout@v4
212212
with:
213213
fetch-depth: 0
214214
- name: configure the PR in which the error message will be posted
@@ -230,6 +230,9 @@ jobs:
230230
- name: show the current environment
231231
run: src/ci/scripts/dump-environment.sh
232232
if: success() && !env.SKIP_JOB
233+
- name: install awscli
234+
run: src/ci/scripts/install-awscli.sh
235+
if: success() && !env.SKIP_JOB
233236
- name: install sccache
234237
run: src/ci/scripts/install-sccache.sh
235238
if: success() && !env.SKIP_JOB
@@ -239,6 +242,9 @@ jobs:
239242
- name: install clang
240243
run: src/ci/scripts/install-clang.sh
241244
if: success() && !env.SKIP_JOB
245+
- name: install tidy
246+
run: src/ci/scripts/install-tidy.sh
247+
if: success() && !env.SKIP_JOB
242248
- name: install WIX
243249
run: src/ci/scripts/install-wix.sh
244250
if: success() && !env.SKIP_JOB
@@ -431,7 +437,7 @@ jobs:
431437
- name: x86_64-gnu-llvm-17
432438
env:
433439
RUST_BACKTRACE: 1
434-
os: ubuntu-20.04-8core-32gb
440+
os: ubuntu-latest
435441
- name: x86_64-gnu-llvm-16
436442
env:
437443
RUST_BACKTRACE: 1

Cargo.lock

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -723,8 +723,7 @@ checksum = "55b672471b4e9f9e95499ea597ff64941a309b2cdbffcc46f2cc5e2d971fd335"
723723
[[package]]
724724
name = "compiler_builtins"
725725
version = "0.1.103"
726-
source = "registry+https://github.com/rust-lang/crates.io-index"
727-
checksum = "a3b73c3443a5fd2438d7ba4853c64e4c8efc2404a9e28a9234cc2d5eebc6c242"
726+
source = "git+https://github.com/solana-labs/compiler-builtins?tag=solana-tools-v1.40#81ef46f3fe1357095acdd089a700890fe4e13974"
728727
dependencies = [
729728
"cc",
730729
"rustc-std-workspace-core",
@@ -781,8 +780,8 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
781780
name = "core"
782781
version = "0.0.0"
783782
dependencies = [
784-
"getrandom 0.1.14",
785-
"rand 0.7.3",
783+
"getrandom 0.1.16",
784+
"rand",
786785
"rand_xorshift",
787786
]
788787

@@ -1592,6 +1591,17 @@ dependencies = [
15921591
"unicode-width",
15931592
]
15941593

1594+
[[package]]
1595+
name = "getrandom"
1596+
version = "0.1.16"
1597+
source = "registry+https://github.com/rust-lang/crates.io-index"
1598+
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
1599+
dependencies = [
1600+
"cfg-if",
1601+
"libc",
1602+
"wasi 0.9.0+wasi-snapshot-preview1",
1603+
]
1604+
15951605
[[package]]
15961606
name = "getrandom"
15971607
version = "0.2.10"
@@ -1600,7 +1610,7 @@ checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
16001610
dependencies = [
16011611
"cfg-if",
16021612
"libc",
1603-
"wasi",
1613+
"wasi 0.11.0+wasi-snapshot-preview1",
16041614
]
16051615

16061616
[[package]]
@@ -2524,7 +2534,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
25242534
checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2"
25252535
dependencies = [
25262536
"libc",
2527-
"wasi",
2537+
"wasi 0.11.0+wasi-snapshot-preview1",
25282538
"windows-sys 0.48.0",
25292539
]
25302540

@@ -2545,7 +2555,7 @@ dependencies = [
25452555
"colored",
25462556
"ctrlc",
25472557
"env_logger 0.10.0",
2548-
"getrandom",
2558+
"getrandom 0.2.10",
25492559
"lazy_static",
25502560
"libc",
25512561
"libffi",
@@ -3176,7 +3186,7 @@ version = "0.6.4"
31763186
source = "registry+https://github.com/rust-lang/crates.io-index"
31773187
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
31783188
dependencies = [
3179-
"getrandom",
3189+
"getrandom 0.2.10",
31803190
]
31813191

31823192
[[package]]
@@ -3241,7 +3251,7 @@ version = "0.4.3"
32413251
source = "registry+https://github.com/rust-lang/crates.io-index"
32423252
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
32433253
dependencies = [
3244-
"getrandom",
3254+
"getrandom 0.2.10",
32453255
"redox_syscall 0.2.16",
32463256
"thiserror",
32473257
]
@@ -5138,7 +5148,7 @@ dependencies = [
51385148
"rustc-demangle",
51395149
"std_detect",
51405150
"unwind",
5141-
"wasi",
5151+
"wasi 0.11.0+wasi-snapshot-preview1",
51425152
]
51435153

51445154
[[package]]
@@ -5964,7 +5974,7 @@ version = "1.4.0"
59645974
source = "registry+https://github.com/rust-lang/crates.io-index"
59655975
checksum = "d023da39d1fde5a8a3fe1f3e01ca9632ada0a63e9797de55a879d6e2236277be"
59665976
dependencies = [
5967-
"getrandom",
5977+
"getrandom 0.2.10",
59685978
]
59695979

59705980
[[package]]
@@ -6004,6 +6014,12 @@ dependencies = [
60046014
"try-lock",
60056015
]
60066016

6017+
[[package]]
6018+
name = "wasi"
6019+
version = "0.9.0+wasi-snapshot-preview1"
6020+
source = "registry+https://github.com/rust-lang/crates.io-index"
6021+
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
6022+
60076023
[[package]]
60086024
name = "wasi"
60096025
version = "0.11.0+wasi-snapshot-preview1"
@@ -6439,8 +6455,3 @@ dependencies = [
64396455
"crossbeam-utils",
64406456
"flate2",
64416457
]
6442-
6443-
[[patch.unused]]
6444-
name = "compiler_builtins"
6445-
version = "0.1.76"
6446-
source = "git+https://github.com/solana-labs/compiler-builtins#2044d7e16a99d951853ce362e384027dec4c5b92"

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ miniz_oxide.debug = 0
105105
object.debug = 0
106106

107107
[patch.crates-io]
108-
compiler_builtins = { git = "https://github.com/solana-labs/compiler-builtins" }
108+
compiler_builtins = { git = "https://github.com/solana-labs/compiler-builtins", tag = "solana-tools-v1.40" }
109109
# See comments in `library/rustc-std-workspace-core/README.md` for what's going on
110110
# here
111111
rustc-std-workspace-core = { path = 'library/rustc-std-workspace-core' }

compiler/rustc_codegen_gcc/src/intrinsic/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue};
1414
use rustc_codegen_ssa::mir::place::PlaceRef;
1515
use rustc_codegen_ssa::traits::{ArgAbiMethods, BuilderMethods, ConstMethods, IntrinsicCallMethods};
1616
#[cfg(feature="master")]
17-
use rustc_codegen_ssa::traits::{BaseTypeMethods, MiscMethods};
17+
use rustc_codegen_ssa::traits::MiscMethods;
18+
use rustc_codegen_ssa::traits::BaseTypeMethods;
1819
use rustc_codegen_ssa::errors::InvalidMonomorphization;
1920
use rustc_middle::bug;
2021
use rustc_middle::ty::{self, Instance, Ty};

compiler/rustc_codegen_ssa/src/base.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,6 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
422422
) -> Bx::Function {
423423
// The entry function is either `int main(void)` or `int main(int argc, char **argv)`, or
424424
// `usize efi_main(void *handle, void *system_table)` depending on the target.
425-
let is_bpf = cx.sess().target.arch == "bpf" && cx.sess().opts.test;
426425
let llfty = if cx.sess().target.os.contains("uefi") {
427426
cx.type_func(&[cx.type_ptr(), cx.type_ptr()], cx.type_isize())
428427
} else if cx.sess().target.main_needs_argc_argv {
@@ -487,7 +486,7 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
487486
(rust_main, start_ty, vec![arg_argc, arg_argv])
488487
};
489488

490-
let result = bx.call(start_ty, None, start_fn, &args, None);
489+
let result = bx.call(start_ty, None, None, start_fn, &args, None);
491490
if cx.sess().target.os.contains("uefi") {
492491
bx.ret(result);
493492
} else {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub(crate) mod netbsd;
2222
pub(crate) mod nto_qnx;
2323
pub(crate) mod openbsd;
2424
pub(crate) mod redox;
25+
pub(crate) mod sbf_base;
2526
pub(crate) mod solaris;
2627
pub(crate) mod solid;
2728
pub(crate) mod teeos;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::abi::Endian;
2-
use super::{Cc, cvs, LinkerFlavor, Lld, PanicStrategy, TargetOptions};
2+
use crate::spec::{Cc, cvs, LinkerFlavor, Lld, PanicStrategy, TargetOptions};
33

44
pub fn opts() -> TargetOptions {
55
let linker_script = r"

compiler/rustc_target/src/spec/bpfel_unknown_unknown.rs renamed to compiler/rustc_target/src/spec/targets/bpfel_unknown_unknown.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::spec::Target;
2-
use crate::spec::sbf_base;
2+
use crate::spec::base::sbf_base;
33

44
pub fn target() -> Target {
55
Target {

compiler/rustc_target/src/spec/sbf_solana_solana.rs renamed to compiler/rustc_target/src/spec/targets/sbf_solana_solana.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::spec::Target;
2-
use crate::spec::sbf_base;
2+
use crate::spec::base::sbf_base;
33

44
pub fn target() -> Target {
55
Target {

library/alloc/src/alloc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ pub mod __alloc_error_handler {
430430
pub unsafe fn __rdl_oom(size: usize, _align: usize) -> ! {
431431
core::panicking::panic_nounwind_fmt(format_args!(
432432
"memory allocation of {size} bytes failed"
433-
))
433+
), /* force_no_backtrace */ false)
434434
}
435435
}
436436

library/std/src/backtrace.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ use crate::env;
9696
use crate::ffi::c_void;
9797
use crate::fmt;
9898
#[cfg(not(target_family = "solana"))]
99+
use crate::panic::UnwindSafe;
100+
#[cfg(not(target_family = "solana"))]
99101
use crate::sync::atomic::{AtomicUsize, Ordering::Relaxed};
100102
#[cfg(not(target_family = "solana"))]
101103
use crate::sync::LazyLock;
@@ -485,9 +487,10 @@ impl fmt::Display for Backtrace {
485487
}
486488
}
487489

488-
490+
#[cfg(not(target_family = "solana"))]
489491
type LazyResolve = impl (FnOnce() -> Capture) + Send + Sync + UnwindSafe;
490492

493+
#[cfg(not(target_family = "solana"))]
491494
fn lazy_resolve(mut capture: Capture) -> LazyResolve {
492495
move || {
493496
// Use the global backtrace lock to synchronize this as it's a

library/std/src/panicking.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#[cfg(not(target_family = "solana"))]
1313
use crate::panic::BacktraceStyle;
14-
#[cfg(not(target_os = "solana"))]
14+
#[cfg(not(target_family = "solana"))]
1515
use core::panic::{PanicPayload};
1616
use core::panic::{Location, PanicInfo};
1717

@@ -521,14 +521,12 @@ pub use realstd::rt::panic_count;
521521

522522
/// Invoke a closure, capturing the cause of an unwinding panic if one occurs.
523523
#[cfg(feature = "panic_immediate_abort")]
524-
#[cfg(not(target_arch = "bpf"))]
525524
pub unsafe fn r#try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<dyn Any + Send>> {
526525
Ok(f())
527526
}
528527

529528
/// Invoke a closure, capturing the cause of an unwinding panic if one occurs.
530529
#[cfg(not(feature = "panic_immediate_abort"))]
531-
#[cfg(not(target_arch = "bpf"))]
532530
pub unsafe fn r#try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<dyn Any + Send>> {
533531
union Data<F, R> {
534532
f: ManuallyDrop<F>,
@@ -915,6 +913,7 @@ fn rust_panic(_: &mut dyn PanicPayload) -> ! {
915913
unsafe {
916914
crate::intrinsics::abort();
917915
}
916+
}
918917

919918
// Note: The panicking functions have been stripped and rewritten
920919
// in order to save space in SBF programs. Panic messages
@@ -956,6 +955,7 @@ pub fn begin_panic<M: Any + Send>(_msg: M) -> ! {
956955
None,
957956
Location::caller(),
958957
false,
958+
false,
959959
);
960960
crate::sys::panic(&info);
961961
}
@@ -974,6 +974,7 @@ pub fn begin_panic_fmt(msg: &fmt::Arguments<'_>) -> ! {
974974
Some(msg),
975975
Location::caller(),
976976
false,
977+
false,
977978
);
978979
crate::sys::panic(&info);
979980
}

library/std/src/sys/sbf/cmath.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@ extern {
2626
pub fn tanf(n: f32) -> f32;
2727
pub fn tanh(n: f64) -> f64;
2828
pub fn tanhf(n: f32) -> f32;
29+
pub fn tgamma(n: f64) -> f64;
30+
pub fn tgammaf(n: f32) -> f32;
31+
pub fn lgamma_r(n: f64, s: &mut i32) -> f64;
32+
pub fn lgammaf_r(n: f32, s: &mut i32) -> f32;
2933
}

library/std/src/sys/sbf/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,8 @@ pub fn abort_internal() -> ! {
120120
pub fn hashmap_random_keys() -> (u64, u64) {
121121
(1, 2)
122122
}
123+
124+
#[inline]
125+
pub fn is_interrupted(_errno: i32) -> bool {
126+
false
127+
}

library/std/src/sys/sbf/os.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ pub fn current_exe() -> io::Result<PathBuf> {
6161
unsupported()
6262
}
6363

64+
#[derive(Debug)]
6465
pub struct Env(Void);
6566

6667
impl Iterator for Env {
@@ -70,6 +71,12 @@ impl Iterator for Env {
7071
}
7172
}
7273

74+
impl Env {
75+
pub fn str_debug(&self) -> impl fmt::Debug + '_ {
76+
[OsString::new(), OsString::new()]
77+
}
78+
}
79+
7380
pub fn env() -> Env {
7481
panic!();
7582
}

src/bootstrap/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ test = false
2424

2525
[[bin]]
2626
name = "rustdoc"
27-
path = "bin/rustdoc.rs"
27+
path = "src/bin/rustdoc.rs"
2828
test = false
2929

3030
[[bin]]

src/bootstrap/src/utils/cc_detect.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,6 @@ pub fn find_target(build: &Build, target: TargetSelection) {
138138
{
139139
cfg.compiler(cxx);
140140
true
141-
} else if &*target.triple == "sbf-solana-solana" || &*target.triple == "bpfel-unknown-unknown" {
142-
set_compiler(&mut cfg, Language::CPlusPlus, target, config, build);
143-
true
144141
} else {
145142
// Use an auto-detected compiler (or one configured via `CXX_target_triple` env vars).
146143
cfg.try_get_compiler().is_ok()
@@ -222,11 +219,9 @@ fn default_compiler(
222219
None
223220
}
224221
}
225-
"bpfel-unknown-unknown" => {
226-
cfg.compiler(build.llvm_bin(target).join(compiler.clang()));
227-
}
228-
"sbf-solana-solana" => {
229-
cfg.compiler(build.llvm_bin(target).join(compiler.clang()));
222+
223+
"bpfel-unknown-unknown" | "sbf-solana-solana" => {
224+
Some(PathBuf::from(build.llvm_bin(target).join(compiler.clang())))
230225
}
231226

232227
t if t.contains("musl") && compiler == Language::C => {

src/tools/tidy/src/extdeps.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::path::Path;
55

66
/// List of allowed sources for packages.
77
const ALLOWED_SOURCES: &[&str] = &["\"registry+https://github.com/rust-lang/crates.io-index\"",
8-
"\"git+https://github.com/solana-labs/compiler-builtins?tag=bpf-tools-v1.7#875087b410b77e0561b653882b431c84515eb044\""];
8+
"\"git+https://github.com/solana-labs/compiler-builtins?tag=solana-tools-v1.40#81ef46f3fe1357095acdd089a700890fe4e13974\""];
99

1010
/// Checks for external package sources. `root` is the path to the directory that contains the
1111
/// workspace `Cargo.toml`.

0 commit comments

Comments
 (0)