Skip to content

Commit

Permalink
Auto merge of rust-lang#118078 - compiler-errors:rollup-8ln8dvl, r=co…
Browse files Browse the repository at this point in the history
…mpiler-errors

Rollup of 8 pull requests

Successful merges:

 - rust-lang#115526 (Add arm64e-apple-ios & arm64e-apple-darwin targets)
 - rust-lang#115691 (Add `$message_type` field to distinguish json diagnostic outputs)
 - rust-lang#117828 (Avoid iterating over hashmaps in astconv)
 - rust-lang#117832 (interpret: simplify handling of shifts by no longer trying to handle signed and unsigned shift amounts in the same branch)
 - rust-lang#117891 (Recover `dyn` and `impl` after `for<...>`)
 - rust-lang#117957 (if available use a Child's pidfd for kill/wait)
 - rust-lang#117994 (Ignore but do not assume region obligations from unifying headers in negative coherence)
 - rust-lang#118068 (subtree update cg_gcc 2023/11/17)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Nov 20, 2023
2 parents 4f3da90 + ad735c9 commit 68f060a
Show file tree
Hide file tree
Showing 64 changed files with 713 additions and 219 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2591,9 +2591,9 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3"

[[package]]
name = "object"
version = "0.32.0"
version = "0.32.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe"
checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0"
dependencies = [
"compiler_builtins",
"crc32fast",
Expand Down
9 changes: 6 additions & 3 deletions compiler/rustc_codegen_gcc/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ jobs:
- name: Build
run: |
./y.sh prepare --only-libcore
./y.sh build
cargo test
# TODO: remove --features master when it is back to the default.
./y.sh build --features master
# TODO: remove --features master when it is back to the default.
cargo test --features master
./clean_all.sh
- name: Prepare dependencies
Expand All @@ -121,7 +123,8 @@ jobs:

- name: Run tests
run: |
./test.sh --release --clean --build-sysroot ${{ matrix.commands }}
# TODO: remove --features master when it is back to the default.
./test.sh --features master --release --clean --build-sysroot ${{ matrix.commands }}
duplicates:
runs-on: ubuntu-latest
Expand Down
5 changes: 4 additions & 1 deletion compiler/rustc_codegen_gcc/.github/workflows/failures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ jobs:
libgccjit_version:
- gcc: "libgccjit.so"
artifacts_branch: "master"
# TODO: switch back to --no-default-features in the case of libgccjit 12 when the default is to enable
# master again.
extra: "--features master"
- gcc: "libgccjit_without_int128.so"
artifacts_branch: "master-without-128bit-integers"
extra: "--features master"
- gcc: "libgccjit12.so"
artifacts_branch: "gcc12"
extra: "--no-default-features"
# FIXME(antoyo): we need to set GCC_EXEC_PREFIX so that the linker can find the linker plugin.
# Not sure why it's not found otherwise.
env_extra: "TEST_FLAGS='-Cpanic=abort -Zpanic-abort-tests' GCC_EXEC_PREFIX=/usr/lib/gcc/"
Expand Down
9 changes: 6 additions & 3 deletions compiler/rustc_codegen_gcc/.github/workflows/m68k.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ jobs:
- name: Build
run: |
./y.sh prepare --only-libcore --cross
./y.sh build --target-triple m68k-unknown-linux-gnu
CG_GCC_TEST_TARGET=m68k-unknown-linux-gnu cargo test
# TODO: remove --features master when it is back to the default.
./y.sh build --target-triple m68k-unknown-linux-gnu --features master
# TODO: remove --features master when it is back to the default.
CG_GCC_TEST_TARGET=m68k-unknown-linux-gnu cargo test --features master
./clean_all.sh
- name: Prepare dependencies
Expand All @@ -136,4 +138,5 @@ jobs:

- name: Run tests
run: |
./test.sh --release --clean --build-sysroot ${{ matrix.commands }}
# TODO: remove --features master when it is back to the default.
./test.sh --release --features master --clean --build-sysroot ${{ matrix.commands }}
9 changes: 6 additions & 3 deletions compiler/rustc_codegen_gcc/.github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ jobs:
- name: Build
run: |
./y.sh prepare --only-libcore
EMBED_LTO_BITCODE=1 ./y.sh build --release --release-sysroot
cargo test
# TODO: remove --features master when it is back to the default.
EMBED_LTO_BITCODE=1 ./y.sh build --release --release-sysroot --features master
# TODO: remove --features master when it is back to the default.
cargo test --features master
./clean_all.sh
- name: Prepare dependencies
Expand All @@ -102,4 +104,5 @@ jobs:

- name: Run tests
run: |
EMBED_LTO_BITCODE=1 ./test.sh --release --clean --release-sysroot --build-sysroot ${{ matrix.commands }}
# TODO: remove --features master when it is back to the default.
EMBED_LTO_BITCODE=1 ./test.sh --release --clean --release-sysroot --build-sysroot ${{ matrix.commands }} --features master
12 changes: 8 additions & 4 deletions compiler/rustc_codegen_gcc/.github/workflows/stdarch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ jobs:
- name: Build
run: |
./y.sh prepare --only-libcore
./y.sh build --release --release-sysroot
cargo test
# TODO: remove `--features master` when it is back to the default.
./y.sh build --release --release-sysroot --features master
# TODO: remove --features master when it is back to the default.
cargo test --features master
- name: Clean
if: ${{ !matrix.cargo_runner }}
Expand All @@ -111,12 +113,14 @@ jobs:
uses: actions-rs/[email protected]
with:
command: build
args: --release
# TODO: remove `--features master` when it is back to the default.
args: --release --features master

- name: Run tests
if: ${{ !matrix.cargo_runner }}
run: |
./test.sh --release --clean --release-sysroot --build-sysroot --mini-tests --std-tests --test-libcore
# TODO: remove `--features master` when it is back to the default.
./test.sh --release --clean --release-sysroot --build-sysroot --mini-tests --std-tests --test-libcore --features master
- name: Run stdarch tests
if: ${{ !matrix.cargo_runner }}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_gcc/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ dependencies = [
[[package]]
name = "gccjit"
version = "1.0.0"
source = "git+https://github.com/antoyo/gccjit.rs#c52a218f5529321285b4489e5562a00e5428e033"
source = "git+https://github.com/antoyo/gccjit.rs#6e290f25b1d1edab5ae9ace486fd2dc8c08d6421"
dependencies = [
"gccjit_sys",
]

[[package]]
name = "gccjit_sys"
version = "0.0.1"
source = "git+https://github.com/antoyo/gccjit.rs#c52a218f5529321285b4489e5562a00e5428e033"
source = "git+https://github.com/antoyo/gccjit.rs#6e290f25b1d1edab5ae9ace486fd2dc8c08d6421"
dependencies = [
"libc",
]
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_codegen_gcc/build_sysroot/build_sysroot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ fi
# Copy files to sysroot
mkdir -p sysroot/lib/rustlib/$TARGET_TRIPLE/lib/
cp -r target/$TARGET_TRIPLE/$sysroot_channel/deps/* sysroot/lib/rustlib/$TARGET_TRIPLE/lib/
# Copy the source files to the sysroot (Rust for Linux needs this).
source_dir=sysroot/lib/rustlib/src/rust
mkdir -p $source_dir
cp -r sysroot_src/library/ $source_dir
6 changes: 6 additions & 0 deletions compiler/rustc_codegen_gcc/build_system/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ fn build_sysroot(
copier,
)?;

// Copy the source files to the sysroot (Rust for Linux needs this).
let sysroot_src_path = "sysroot/lib/rustlib/src/rust";
fs::create_dir_all(&sysroot_src_path)
.map_err(|error| format!("Failed to create directory `{}`: {:?}", sysroot_src_path, error))?;
run_command(&[&"cp", &"-r", &"sysroot_src/library/", &sysroot_src_path], None)?;

Ok(())
}

Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_codegen_gcc/failing-ui-tests12.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ tests/ui/target-feature/missing-plusminus.rs
tests/ui/sse2.rs
tests/ui/codegen/issue-79865-llvm-miscompile.rs
tests/ui/intrinsics/intrinsics-integer.rs
tests/ui/std-backtrace.rs
tests/ui/mir/alignment/packed.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
From 7bcd24ec6d4a96121874cb1ae5a23ea274aeff34 Mon Sep 17 00:00:00 2001
From a5663265f797a43c502915c356fe7899c16cee92 Mon Sep 17 00:00:00 2001
From: None <[email protected]>
Date: Thu, 19 Oct 2023 13:12:51 -0400
Date: Sat, 18 Nov 2023 10:50:36 -0500
Subject: [PATCH] [core] Disable portable-simd test

---
library/core/tests/lib.rs | 2 --
1 file changed, 2 deletions(-)

diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs
index 5814ed4..194ad4c 100644
index d0a119c..76fdece 100644
--- a/library/core/tests/lib.rs
+++ b/library/core/tests/lib.rs
@@ -90,7 +90,6 @@
@@ -89,7 +89,6 @@
#![feature(never_type)]
#![feature(unwrap_infallible)]
#![feature(pointer_byte_offsets)]
#![feature(pointer_is_aligned)]
-#![feature(portable_simd)]
#![feature(ptr_metadata)]
#![feature(lazy_cell)]
#![feature(unsized_tuple_coercion)]
@@ -157,7 +156,6 @@ mod pin;
@@ -155,7 +154,6 @@ mod pin;
mod pin_macro;
mod ptr;
mod result;
Expand All @@ -28,5 +28,5 @@ index 5814ed4..194ad4c 100644
mod str;
mod str_lossy;
--
2.42.0
2.42.1

2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2023-10-21"
channel = "nightly-2023-11-17"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
16 changes: 7 additions & 9 deletions compiler/rustc_codegen_gcc/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::env;
use std::time::Instant;

use gccjit::{
Context,
FunctionType,
GlobalKind,
};
Expand All @@ -18,8 +17,9 @@ use rustc_codegen_ssa::mono_item::MonoItemExt;
use rustc_codegen_ssa::traits::DebugInfoMethods;
use rustc_session::config::DebugInfo;
use rustc_span::Symbol;
use rustc_target::spec::PanicStrategy;

use crate::{LockedTargetInfo, gcc_util};
use crate::{LockedTargetInfo, gcc_util, new_context};
use crate::GccContext;
use crate::builder::Builder;
use crate::context::CodegenCx;
Expand Down Expand Up @@ -88,20 +88,18 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'_>, cgu_name: Symbol, target_info: Lock
fn module_codegen(tcx: TyCtxt<'_>, (cgu_name, target_info): (Symbol, LockedTargetInfo)) -> ModuleCodegen<GccContext> {
let cgu = tcx.codegen_unit(cgu_name);
// Instantiate monomorphizations without filling out definitions yet...
let context = Context::default();
let context = new_context(tcx);

context.add_command_line_option("-fexceptions");
context.add_driver_option("-fexceptions");
if tcx.sess.panic_strategy() == PanicStrategy::Unwind {
context.add_command_line_option("-fexceptions");
context.add_driver_option("-fexceptions");
}

let disabled_features: HashSet<_> = tcx.sess.opts.cg.target_feature.split(',')
.filter(|feature| feature.starts_with('-'))
.map(|string| &string[1..])
.collect();

if tcx.sess.target.arch == "x86" || tcx.sess.target.arch == "x86_64" {
context.add_command_line_option("-masm=intel");
}

if !disabled_features.contains("avx") && tcx.sess.target.arch == "x86_64" {
// NOTE: we always enable AVX because the equivalent of llvm.x86.sse2.cmp.pd in GCC for
// SSE2 is multiple builtins, so we use the AVX __builtin_ia32_cmppd instead.
Expand Down
25 changes: 22 additions & 3 deletions compiler/rustc_codegen_gcc/src/int.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
a >> b
}
}
else if a_type.is_vector() && a_type.is_vector() {
a >> b
}
else if a_native && !b_native {
self.gcc_lshr(a, self.gcc_int_cast(b, a_type))
}
Expand Down Expand Up @@ -144,7 +147,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
fn additive_operation(&self, operation: BinaryOp, a: RValue<'gcc>, mut b: RValue<'gcc>) -> RValue<'gcc> {
let a_type = a.get_type();
let b_type = b.get_type();
if self.is_native_int_type_or_bool(a_type) && self.is_native_int_type_or_bool(b_type) {
if (self.is_native_int_type_or_bool(a_type) && self.is_native_int_type_or_bool(b_type)) || (a_type.is_vector() && b_type.is_vector()) {
if a_type != b_type {
if a_type.is_vector() {
// Vector types need to be bitcast.
Expand All @@ -158,6 +161,8 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
self.context.new_binary_op(None, operation, a_type, a, b)
}
else {
debug_assert!(a_type.dyncast_array().is_some());
debug_assert!(b_type.dyncast_array().is_some());
let signed = a_type.is_compatible_with(self.i128_type);
let func_name =
match (operation, signed) {
Expand Down Expand Up @@ -189,10 +194,12 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
fn multiplicative_operation(&self, operation: BinaryOp, operation_name: &str, signed: bool, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
let a_type = a.get_type();
let b_type = b.get_type();
if self.is_native_int_type_or_bool(a_type) && self.is_native_int_type_or_bool(b_type) {
if (self.is_native_int_type_or_bool(a_type) && self.is_native_int_type_or_bool(b_type)) || (a_type.is_vector() && b_type.is_vector()) {
self.context.new_binary_op(None, operation, a_type, a, b)
}
else {
debug_assert!(a_type.dyncast_array().is_some());
debug_assert!(b_type.dyncast_array().is_some());
let sign =
if signed {
""
Expand Down Expand Up @@ -337,6 +344,8 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
pub fn operation_with_overflow(&self, func_name: &str, lhs: RValue<'gcc>, rhs: RValue<'gcc>) -> (RValue<'gcc>, RValue<'gcc>) {
let a_type = lhs.get_type();
let b_type = rhs.get_type();
debug_assert!(a_type.dyncast_array().is_some());
debug_assert!(b_type.dyncast_array().is_some());
let param_a = self.context.new_parameter(None, a_type, "a");
let param_b = self.context.new_parameter(None, b_type, "b");
let result_field = self.context.new_field(None, a_type, "result");
Expand Down Expand Up @@ -496,7 +505,11 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
pub fn gcc_xor(&self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
let a_type = a.get_type();
let b_type = b.get_type();
if self.is_native_int_type_or_bool(a_type) && self.is_native_int_type_or_bool(b_type) {
if a_type.is_vector() && b_type.is_vector() {
let b = self.bitcast_if_needed(b, a_type);
a ^ b
}
else if self.is_native_int_type_or_bool(a_type) && self.is_native_int_type_or_bool(b_type) {
a ^ b
}
else {
Expand Down Expand Up @@ -527,6 +540,9 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
a << b
}
}
else if a_type.is_vector() && a_type.is_vector() {
a << b
}
else if a_native && !b_native {
self.gcc_shl(a, self.gcc_int_cast(b, a_type))
}
Expand Down Expand Up @@ -690,6 +706,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
let a_native = self.is_native_int_type_or_bool(a_type);
let b_native = self.is_native_int_type_or_bool(b_type);
if a_type.is_vector() && b_type.is_vector() {
let b = self.bitcast_if_needed(b, a_type);
self.context.new_binary_op(None, operation, a_type, a, b)
}
else if a_native && b_native {
Expand Down Expand Up @@ -748,6 +765,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
return self.context.new_cast(None, value, dest_typ);
}

debug_assert!(value_type.dyncast_array().is_some());
let name_suffix =
match self.type_kind(dest_typ) {
TypeKind::Float => "tisf",
Expand Down Expand Up @@ -781,6 +799,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
return self.context.new_cast(None, value, dest_typ);
}

debug_assert!(value_type.dyncast_array().is_some());
let name_suffix =
match self.type_kind(value_type) {
TypeKind::Float => "sfti",
Expand Down
Loading

0 comments on commit 68f060a

Please sign in to comment.