Skip to content

Commit 3a791a3

Browse files
committed
[SOL] Fixes for the 1.95 release
1 parent cb5b0c3 commit 3a791a3

97 files changed

Lines changed: 526 additions & 505 deletions

File tree

Some content is hidden

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

bootstrap.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,10 @@ link-shared = false
108108
# Whether or not to specify `-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=YES`
109109
#allow-old-toolchain = false
110110

111+
clang = true
112+
111113
# Which LLVM projects to build along with the LLVM base libraries/tools
112-
enable-projects = "clang;lld;lldb"
114+
enable-projects = "lld;lldb"
113115

114116
download-ci-llvm = false
115117

compiler/rustc_codegen_llvm/src/allocator.rs

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
use crate::attributes::llfn_attrs_from_instance;
2+
use crate::builder::SBuilder;
3+
use crate::declare::declare_simple_fn;
4+
use crate::llvm::{self, FromGeneric, TRUE, Type};
5+
use crate::{SimpleCx, attributes, debuginfo};
16
use libc::c_uint;
27
use rustc_ast::expand::allocator::{
38
AllocatorMethod, AllocatorTy, NO_ALLOC_SHIM_IS_UNSTABLE, SpecialAllocatorMethod,
@@ -9,12 +14,6 @@ use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs}
914
use rustc_middle::ty::TyCtxt;
1015
use rustc_session::config::DebugInfo;
1116
use rustc_symbol_mangling::mangle_internal_symbol;
12-
use rustc_target::spec::Arch;
13-
use crate::attributes::llfn_attrs_from_instance;
14-
use crate::builder::SBuilder;
15-
use crate::declare::declare_simple_fn;
16-
use crate::llvm::{self, FromGeneric, TRUE, Type};
17-
use crate::{SimpleCx, attributes, debuginfo};
1817

1918
pub(crate) unsafe fn codegen(
2019
tcx: TyCtxt<'_>,
@@ -86,19 +85,16 @@ pub(crate) unsafe fn codegen(
8685
);
8786
}
8887

89-
if tcx.sess.target.arch != Arch::Sbf {
90-
// __rust_no_alloc_shim_is_unstable_v2
91-
create_wrapper_function(
92-
tcx,
93-
&cx,
94-
&mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE),
95-
None,
96-
&[],
97-
None,
98-
false,
99-
&CodegenFnAttrs::new(),
100-
);
101-
}
88+
create_wrapper_function(
89+
tcx,
90+
&cx,
91+
&mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE),
92+
None,
93+
&[],
94+
None,
95+
false,
96+
&CodegenFnAttrs::new(),
97+
);
10298

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

compiler/rustc_codegen_llvm/src/va_arg.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,7 @@ pub(super) fn emit_va_arg<'ll, 'tcx>(
11761176
),
11771177

11781178
Arch::Bpf => bug!("bpf does not support c-variadic functions"),
1179+
Arch::Sbf => bug!("sbf does not support c-variadic functions"),
11791180
Arch::SpirV => bug!("spirv does not support c-variadic functions"),
11801181

11811182
Arch::Mips | Arch::Mips32r6 | Arch::Mips64 | Arch::Mips64r6 => {

compiler/rustc_codegen_ssa/src/back/linker.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,14 +482,20 @@ impl<'a> GccLinker<'a> {
482482
}
483483
}
484484

485-
if self.sess.target.arch == "bpf" || self.sess.target.arch == "sbf" {
485+
if let Arch::Bpf | Arch::Sbf = self.sess.target.arch {
486486
if self.sess.opts.test {
487487
self.link_arg("--entry=main");
488488
} else {
489489
self.link_arg("--entry=entrypoint");
490490
}
491491

492-
let cpu_type = self.sess.opts.cg.target_cpu.as_ref().cloned()
492+
let cpu_type = self
493+
.sess
494+
.opts
495+
.cg
496+
.target_cpu
497+
.as_ref()
498+
.cloned()
493499
.unwrap_or(self.sess.target.cpu.as_ref().to_string());
494500
if cpu_type == "v3" || cpu_type == "v4" {
495501
self.link_arg("-Bsymbolic");

compiler/rustc_codegen_ssa/src/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,6 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
498498
) -> Bx::Function {
499499
// The entry function is either `int main(void)` or `int main(int argc, char **argv)`, or
500500
// `usize efi_main(void *handle, void *system_table)` depending on the target.
501-
let is_bpf = cx.sess().target.arch == "bpf" && cx.sess().opts.test;
502501
let llfty = if cx.sess().target.os == Os::Uefi {
503502
cx.type_func(&[cx.type_ptr(), cx.type_ptr()], cx.type_isize())
504503
} else if cx.sess().target.main_needs_argc_argv {
@@ -560,6 +559,7 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
560559
)
561560
};
562561

562+
let result = bx.call(start_ty, None, None, start_fn, &args, None, instance);
563563
if cx.sess().target.os == Os::Uefi {
564564
bx.ret(result);
565565
} else {

compiler/rustc_interface/src/passes.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use rustc_span::{
4444
};
4545
use rustc_trait_selection::{solve, traits};
4646
use tracing::{info, instrument};
47-
47+
use rustc_target::spec::Arch;
4848
use crate::interface::Compiler;
4949
use crate::{errors, limits, proc_macro_decls, util};
5050

@@ -1328,6 +1328,10 @@ pub fn collect_crate_types(
13281328
// If we're generating a test executable, then ignore all other output
13291329
// styles at all other locations
13301330
if session.opts.test {
1331+
if session.target.arch == Arch::Sbf || session.target.arch == Arch::Bpf {
1332+
return vec![CrateType::Cdylib];
1333+
}
1334+
13311335
if !session.target.executables {
13321336
session.dcx().emit_warn(errors::UnsupportedCrateTypeForTarget {
13331337
crate_type: CrateType::Executable,

compiler/rustc_passes/src/entry.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use rustc_middle::query::Providers;
66
use rustc_middle::ty::TyCtxt;
77
use rustc_session::config::{CrateType, EntryFnType, sigpipe};
88
use rustc_span::{RemapPathScopeComponents, Span};
9+
use rustc_target::spec::Arch;
910

1011
use crate::errors::{ExternMain, MultipleRustcMain, NoMainErr};
1112

@@ -22,7 +23,7 @@ struct EntryContext<'tcx> {
2223

2324
fn entry_fn(tcx: TyCtxt<'_>, (): ()) -> Option<(DefId, EntryFnType)> {
2425
let any_exe = tcx.crate_types().contains(&CrateType::Executable);
25-
let exe_only = (tcx.sess.target.arch != "bpf" && tcx.sess.target.arch != "sbf") || !tcx.sess.opts.test;
26+
let exe_only = !matches!(tcx.sess.target.arch, Arch::Bpf | Arch::Sbf) || !tcx.sess.opts.test;
2627
if !any_exe && exe_only {
2728
// No need to find a main function.
2829
return None;

compiler/rustc_session/src/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ impl Session {
853853
// and most benchmarks agreed it was roughly a local optimum. Not very
854854
// scientific.
855855

856-
if self.target.options.vendor == "solana" {
856+
if self.target.options.is_like_solana {
857857
// Default to 1 for SBF programs. It makes a huge difference in
858858
// terms of generated code size for us
859859
// (https://github.com/rust-lang/rust/issues/47745) and compilation

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,6 +1808,7 @@ symbols! {
18081808
sanitizer_runtime,
18091809
saturating_add,
18101810
saturating_sub,
1811+
sbf,
18111812
sbf_target_feature,
18121813
sdylib,
18131814
search_unbox,

compiler/rustc_target/src/callconv/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ impl<'a, Ty> FnAbi<'a, Ty> {
703703
Arch::RiscV32 | Arch::RiscV64 => riscv::compute_abi_info(cx, self),
704704
Arch::Wasm32 | Arch::Wasm64 => wasm::compute_abi_info(cx, self),
705705
Arch::Bpf => bpf::compute_abi_info(cx, self),
706-
Arch::Sbf => sbf::compute_abi_info(self),
706+
Arch::Sbf => sbf::compute_abi_info(cx, self),
707707
arch @ (Arch::SpirV | Arch::Other(_)) => {
708708
panic!("no lowering implemented for {arch}")
709709
}

0 commit comments

Comments
 (0)