Skip to content

Rollup of 7 pull requests #142186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 18 commits into from
Closed
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 32 additions & 19 deletions Cargo.lock
Original file line number Diff line number Diff line change
@@ -162,7 +162,7 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01667f6f40216b9a0b2945e05fed5f1ad0ab6470e69cb9378001e37b1c0668e4"
dependencies = [
"object",
"object 0.36.7",
]

[[package]]
@@ -235,7 +235,7 @@ dependencies = [
"cfg-if",
"libc",
"miniz_oxide",
"object",
"object 0.36.7",
"rustc-demangle",
"windows-targets 0.52.6",
]
@@ -2509,7 +2509,19 @@ dependencies = [
"indexmap",
"memchr",
"ruzstd",
"wasmparser 0.222.1",
]

[[package]]
name = "object"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6273adb7096cf9ab4335f258e627d8230e69d40d45567d678f552dcec6245215"
dependencies = [
"crc32fast",
"hashbrown",
"indexmap",
"memchr",
"wasmparser 0.232.0",
]

[[package]]
@@ -3109,7 +3121,7 @@ dependencies = [
"build_helper",
"gimli",
"libc",
"object",
"object 0.36.7",
"regex",
"serde_json",
"similar",
@@ -3118,11 +3130,12 @@ dependencies = [

[[package]]
name = "rustc-build-sysroot"
version = "0.5.7"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10edc2e4393515193bd766e2f6c050b0536a68e56f2b6d56c07ababfdc114ff0"
checksum = "16d115ad7e26e0d1337f64ae6598f758194696afc2e9f34c8a6f24582529c3dc"
dependencies = [
"anyhow",
"regex",
"rustc_version",
"tempfile",
"walkdir",
@@ -3422,7 +3435,7 @@ dependencies = [
"itertools",
"libc",
"measureme",
"object",
"object 0.37.0",
"rustc-demangle",
"rustc_abi",
"rustc_ast",
@@ -3463,7 +3476,7 @@ dependencies = [
"either",
"itertools",
"libc",
"object",
"object 0.37.0",
"pathdiff",
"regex",
"rustc_abi",
@@ -4495,7 +4508,7 @@ name = "rustc_target"
version = "0.0.0"
dependencies = [
"bitflags",
"object",
"object 0.37.0",
"rustc_abi",
"rustc_data_structures",
"rustc_fs_util",
@@ -5247,7 +5260,7 @@ checksum = "9e9c1e705f82a260173f3eec93f2ff6d7807f23ad5a8cc2e7316a891733ea7a1"
dependencies = [
"gimli",
"hashbrown",
"object",
"object 0.36.7",
"tracing",
]

@@ -5908,15 +5921,6 @@ dependencies = [
"indexmap",
]

[[package]]
name = "wasmparser"
version = "0.222.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa210fd1788e6b37a1d1930f3389c48e1d6ebd1a013d34fa4b7f9e3e3bf03146"
dependencies = [
"bitflags",
]

[[package]]
name = "wasmparser"
version = "0.229.0"
@@ -5941,6 +5945,15 @@ dependencies = [
"semver",
]

[[package]]
name = "wasmparser"
version = "0.232.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "917739b33bb1eb0e9a49bcd2637a351931be4578d0cc4d37b908d7a797784fbb"
dependencies = [
"bitflags",
]

[[package]]
name = "wast"
version = "230.0.0"
28 changes: 13 additions & 15 deletions compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
Original file line number Diff line number Diff line change
@@ -875,7 +875,6 @@ fn codegen_regular_intrinsic_call<'tcx>(
let ptr = ptr.load_scalar(fx);

let ty = generic_args.type_at(0);
let _ord = generic_args.const_at(1).to_value(); // FIXME: forward this to cranelift once they support that
match ty.kind() {
ty::Uint(UintTy::U128) | ty::Int(IntTy::I128) => {
// FIXME implement 128bit atomics
@@ -906,7 +905,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
let val = CValue::by_val(val, fx.layout_of(ty));
ret.write_cvalue(fx, val);
}
_ if intrinsic.as_str().starts_with("atomic_store") => {
sym::atomic_store => {
intrinsic_args!(fx, args => (ptr, val); intrinsic);
let ptr = ptr.load_scalar(fx);

@@ -939,7 +938,7 @@ fn codegen_regular_intrinsic_call<'tcx>(

fx.bcx.ins().atomic_store(MemFlags::trusted(), val, ptr);
}
_ if intrinsic.as_str().starts_with("atomic_xchg") => {
sym::atomic_xchg => {
intrinsic_args!(fx, args => (ptr, new); intrinsic);
let ptr = ptr.load_scalar(fx);

@@ -960,8 +959,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
let old = CValue::by_val(old, layout);
ret.write_cvalue(fx, old);
}
_ if intrinsic.as_str().starts_with("atomic_cxchg") => {
// both atomic_cxchg_* and atomic_cxchgweak_*
sym::atomic_cxchg | sym::atomic_cxchgweak => {
intrinsic_args!(fx, args => (ptr, test_old, new); intrinsic);
let ptr = ptr.load_scalar(fx);

@@ -984,7 +982,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
ret.write_cvalue(fx, ret_val)
}

_ if intrinsic.as_str().starts_with("atomic_xadd") => {
sym::atomic_xadd => {
intrinsic_args!(fx, args => (ptr, amount); intrinsic);
let ptr = ptr.load_scalar(fx);

@@ -1006,7 +1004,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
let old = CValue::by_val(old, layout);
ret.write_cvalue(fx, old);
}
_ if intrinsic.as_str().starts_with("atomic_xsub") => {
sym::atomic_xsub => {
intrinsic_args!(fx, args => (ptr, amount); intrinsic);
let ptr = ptr.load_scalar(fx);

@@ -1028,7 +1026,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
let old = CValue::by_val(old, layout);
ret.write_cvalue(fx, old);
}
_ if intrinsic.as_str().starts_with("atomic_and") => {
sym::atomic_and => {
intrinsic_args!(fx, args => (ptr, src); intrinsic);
let ptr = ptr.load_scalar(fx);

@@ -1049,7 +1047,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
let old = CValue::by_val(old, layout);
ret.write_cvalue(fx, old);
}
_ if intrinsic.as_str().starts_with("atomic_or") => {
sym::atomic_or => {
intrinsic_args!(fx, args => (ptr, src); intrinsic);
let ptr = ptr.load_scalar(fx);

@@ -1070,7 +1068,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
let old = CValue::by_val(old, layout);
ret.write_cvalue(fx, old);
}
_ if intrinsic.as_str().starts_with("atomic_xor") => {
sym::atomic_xor => {
intrinsic_args!(fx, args => (ptr, src); intrinsic);
let ptr = ptr.load_scalar(fx);

@@ -1091,7 +1089,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
let old = CValue::by_val(old, layout);
ret.write_cvalue(fx, old);
}
_ if intrinsic.as_str().starts_with("atomic_nand") => {
sym::atomic_nand => {
intrinsic_args!(fx, args => (ptr, src); intrinsic);
let ptr = ptr.load_scalar(fx);

@@ -1112,7 +1110,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
let old = CValue::by_val(old, layout);
ret.write_cvalue(fx, old);
}
_ if intrinsic.as_str().starts_with("atomic_max") => {
sym::atomic_max => {
intrinsic_args!(fx, args => (ptr, src); intrinsic);
let ptr = ptr.load_scalar(fx);

@@ -1133,7 +1131,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
let old = CValue::by_val(old, layout);
ret.write_cvalue(fx, old);
}
_ if intrinsic.as_str().starts_with("atomic_umax") => {
sym::atomic_umax => {
intrinsic_args!(fx, args => (ptr, src); intrinsic);
let ptr = ptr.load_scalar(fx);

@@ -1154,7 +1152,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
let old = CValue::by_val(old, layout);
ret.write_cvalue(fx, old);
}
_ if intrinsic.as_str().starts_with("atomic_min") => {
sym::atomic_min => {
intrinsic_args!(fx, args => (ptr, src); intrinsic);
let ptr = ptr.load_scalar(fx);

@@ -1175,7 +1173,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
let old = CValue::by_val(old, layout);
ret.write_cvalue(fx, old);
}
_ if intrinsic.as_str().starts_with("atomic_umin") => {
sym::atomic_umin => {
intrinsic_args!(fx, args => (ptr, src); intrinsic);
let ptr = ptr.load_scalar(fx);

Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@ resolver = "2"

[dependencies]
core = { path = "./sysroot_src/library/core" }
compiler_builtins = "0.1"
alloc = { path = "./sysroot_src/library/alloc" }
std = { path = "./sysroot_src/library/std", features = ["panic_unwind", "backtrace"] }
test = { path = "./sysroot_src/library/test" }
@@ -16,6 +15,7 @@ proc_macro = { path = "./sysroot_src/library/proc_macro" }
rustc-std-workspace-core = { path = "./sysroot_src/library/rustc-std-workspace-core" }
rustc-std-workspace-alloc = { path = "./sysroot_src/library/rustc-std-workspace-alloc" }
rustc-std-workspace-std = { path = "./sysroot_src/library/rustc-std-workspace-std" }
compiler_builtins = { path = "./sysroot_src/library/compiler-builtins/compiler-builtins" }

# For compiler-builtins we always use a high number of codegen units.
# The goal here is to place every single intrinsic into its own object
1 change: 1 addition & 0 deletions compiler/rustc_codegen_gcc/example/alloc_system.rs
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
// add fast paths for low alignment values.
#[cfg(any(target_arch = "x86",
target_arch = "arm",
target_arch = "loongarch32",
target_arch = "m68k",
target_arch = "mips",
target_arch = "mips32r6",
3 changes: 0 additions & 3 deletions compiler/rustc_codegen_gcc/messages.ftl
Original file line number Diff line number Diff line change
@@ -2,9 +2,6 @@ codegen_gcc_unknown_ctarget_feature_prefix =
unknown feature specified for `-Ctarget-feature`: `{$feature}`
.note = features must begin with a `+` to enable or `-` to disable it

codegen_gcc_invalid_minimum_alignment =
invalid minimum global alignment: {$err}

codegen_gcc_forbidden_ctarget_feature =
target feature `{$feature}` cannot be toggled with `-Ctarget-feature`: {$reason}

10 changes: 2 additions & 8 deletions compiler/rustc_codegen_gcc/src/consts.rs
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@ use rustc_span::def_id::DefId;

use crate::base;
use crate::context::CodegenCx;
use crate::errors::InvalidMinimumAlignment;
use crate::type_of::LayoutGccExt;

fn set_global_alignment<'gcc, 'tcx>(
@@ -29,13 +28,8 @@ fn set_global_alignment<'gcc, 'tcx>(
// The target may require greater alignment for globals than the type does.
// Note: GCC and Clang also allow `__attribute__((aligned))` on variables,
// which can force it to be smaller. Rust doesn't support this yet.
if let Some(min) = cx.sess().target.min_global_align {
match Align::from_bits(min) {
Ok(min) => align = align.max(min),
Err(err) => {
cx.sess().dcx().emit_err(InvalidMinimumAlignment { err: err.to_string() });
}
}
if let Some(min_global) = cx.sess().target.min_global_align {
align = Ord::max(align, min_global);
}
gv.set_alignment(align.bytes() as i32);
}
6 changes: 0 additions & 6 deletions compiler/rustc_codegen_gcc/src/errors.rs
Original file line number Diff line number Diff line change
@@ -47,12 +47,6 @@ pub(crate) struct UnwindingInlineAsm {
pub span: Span,
}

#[derive(Diagnostic)]
#[diag(codegen_gcc_invalid_minimum_alignment)]
pub(crate) struct InvalidMinimumAlignment {
pub err: String,
}

#[derive(Diagnostic)]
#[diag(codegen_gcc_copy_bitcode)]
pub(crate) struct CopyBitcode {
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ gimli = "0.31"
itertools = "0.12"
libc = "0.2"
measureme = "12.0.1"
object = { version = "0.36.3", default-features = false, features = ["std", "read"] }
object = { version = "0.37.0", default-features = false, features = ["std", "read"] }
rustc-demangle = "0.1.21"
rustc_abi = { path = "../rustc_abi" }
rustc_ast = { path = "../rustc_ast" }
6 changes: 0 additions & 6 deletions compiler/rustc_codegen_llvm/messages.ftl
Original file line number Diff line number Diff line change
@@ -19,12 +19,6 @@ codegen_llvm_from_llvm_diag = {$message}

codegen_llvm_from_llvm_optimization_diag = {$filename}:{$line}:{$column} {$pass_name} ({$kind}): {$message}

codegen_llvm_invalid_minimum_alignment_not_power_of_two =
invalid minimum global alignment: {$align} is not power of 2

codegen_llvm_invalid_minimum_alignment_too_large =
invalid minimum global alignment: {$align} is too large

codegen_llvm_load_bitcode = failed to load bitcode of module "{$name}"
codegen_llvm_load_bitcode_with_llvm_err = failed to load bitcode of module "{$name}": {$llvm_err}

2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/asm.rs
Original file line number Diff line number Diff line change
@@ -251,7 +251,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
InlineAsmArch::Nvptx64 => {}
InlineAsmArch::PowerPC | InlineAsmArch::PowerPC64 => {}
InlineAsmArch::Hexagon => {}
InlineAsmArch::LoongArch64 => {
InlineAsmArch::LoongArch32 | InlineAsmArch::LoongArch64 => {
constraints.extend_from_slice(&[
"~{$fcc0}".to_string(),
"~{$fcc1}".to_string(),
Loading