Skip to content

Commit 2c11327

Browse files
authored
Merge branch 'rust-lang:master' into fuzz_support
2 parents aa95fcd + f518ec5 commit 2c11327

21 files changed

+10474
-10030
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ jobs:
6464
- name: Set env
6565
run: |
6666
echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV
67-
echo "LIBRARY_PATH=/usr/lib" >> $GITHUB_ENV
68-
echo "LD_LIBRARY_PATH=/usr/lib" >> $GITHUB_ENV
6967
7068
#- name: Cache rust repository
7169
## We only clone the rust repository for rustc tests
@@ -80,8 +78,7 @@ jobs:
8078
run: |
8179
./y.sh prepare --only-libcore
8280
./y.sh build --sysroot
83-
./y.sh test --mini-tests
84-
cargo test
81+
./y.sh test --cargo-tests
8582
8683
- name: Run y.sh cargo build
8784
run: |

.github/workflows/failures.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ jobs:
6666
run: |
6767
sudo dpkg --force-overwrite -i gcc-15.deb
6868
echo 'gcc-path = "/usr/lib"' > config.toml
69-
echo "LIBRARY_PATH=/usr/lib" >> $GITHUB_ENV
70-
echo "LD_LIBRARY_PATH=/usr/lib" >> $GITHUB_ENV
69+
70+
7171
7272
- name: Set env
7373
run: |

.github/workflows/m68k.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ jobs:
6565
- name: Set env
6666
run: |
6767
echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV
68-
echo "LIBRARY_PATH=/usr/lib" >> $GITHUB_ENV
69-
echo "LD_LIBRARY_PATH=/usr/lib" >> $GITHUB_ENV
68+
69+
7070
7171
#- name: Cache rust repository
7272
## We only clone the rust repository for rustc tests
@@ -95,7 +95,7 @@ jobs:
9595
./y.sh prepare --only-libcore --cross
9696
./y.sh build --sysroot --features compiler_builtins/no-f16-f128 --target-triple m68k-unknown-linux-gnu
9797
./y.sh test --mini-tests
98-
CG_GCC_TEST_TARGET=m68k-unknown-linux-gnu cargo test
98+
CG_GCC_TEST_TARGET=m68k-unknown-linux-gnu ./y.sh test --cargo-tests
9999
./y.sh clean all
100100
101101
- name: Prepare dependencies

.github/workflows/release.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,14 @@ jobs:
4949
- name: Set env
5050
run: |
5151
echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV
52-
echo "LIBRARY_PATH=/usr/lib" >> $GITHUB_ENV
53-
echo "LD_LIBRARY_PATH=/usr/lib" >> $GITHUB_ENV
52+
53+
5454
5555
- name: Build
5656
run: |
5757
./y.sh prepare --only-libcore
5858
EMBED_LTO_BITCODE=1 ./y.sh build --sysroot --release --release-sysroot
59-
./y.sh test --mini-tests
60-
cargo test
59+
./y.sh test --cargo-tests
6160
./y.sh clean all
6261
6362
- name: Prepare dependencies

.github/workflows/stdarch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
if: ${{ !matrix.cargo_runner }}
9191
run: |
9292
./y.sh test --release --clean --release-sysroot --build-sysroot --mini-tests --std-tests --test-libcore
93-
cargo test
93+
./y.sh test --cargo-tests
9494
9595
- name: Run stdarch tests
9696
if: ${{ !matrix.cargo_runner }}

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ To run specific tests, use appropriate flags such as:
3333

3434
- `./y.sh test --test-libcore`
3535
- `./y.sh test --std-tests`
36-
- `cargo test -- <name of test>`
36+
- `./y.sh test --cargo-tests -- <name of test>`
3737

3838
Additionally, you can run the tests of `libgccjit`:
3939

build_system/src/test.rs

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn get_runners() -> Runners {
4242
);
4343
runners.insert("--extended-regex-tests", ("Run extended regex tests", extended_regex_tests));
4444
runners.insert("--mini-tests", ("Run mini tests", mini_tests));
45-
45+
runners.insert("--cargo-tests", ("Run cargo tests", cargo_tests));
4646
runners
4747
}
4848

@@ -88,6 +88,8 @@ struct TestArg {
8888
use_system_gcc: bool,
8989
runners: Vec<String>,
9090
flags: Vec<String>,
91+
/// Additional arguments, to be passed to commands like `cargo test`.
92+
test_args: Vec<String>,
9193
nb_parts: Option<usize>,
9294
current_part: Option<usize>,
9395
sysroot_panic_abort: bool,
@@ -144,6 +146,7 @@ impl TestArg {
144146
show_usage();
145147
return Ok(None);
146148
}
149+
"--" => test_arg.test_args.extend(&mut args),
147150
x if runners.contains_key(x)
148151
&& !test_arg.runners.iter().any(|runner| runner == x) =>
149152
{
@@ -203,6 +206,33 @@ fn clean(_env: &Env, args: &TestArg) -> Result<(), String> {
203206
create_dir(&path)
204207
}
205208

209+
fn cargo_tests(test_env: &Env, test_args: &TestArg) -> Result<(), String> {
210+
// First, we call `mini_tests` to build minicore for us. This ensures we are testing with a working `minicore`,
211+
// and that any changes we have made affect `minicore`(since it would get rebuilt).
212+
mini_tests(test_env, test_args)?;
213+
// Then, we copy some of the env vars from `test_env`
214+
// We don't want to pass things like `RUSTFLAGS`, since they contain the -Zcodegen-backend flag.
215+
// That would force `cg_gcc` to *rebuild itself* and only then run tests, which is undesirable.
216+
let mut env = HashMap::new();
217+
env.insert(
218+
"LD_LIBRARY_PATH".into(),
219+
test_env.get("LD_LIBRARY_PATH").expect("LD_LIBRARY_PATH missing!").to_string(),
220+
);
221+
env.insert(
222+
"LIBRARY_PATH".into(),
223+
test_env.get("LIBRARY_PATH").expect("LIBRARY_PATH missing!").to_string(),
224+
);
225+
env.insert(
226+
"CG_RUSTFLAGS".into(),
227+
test_env.get("CG_RUSTFLAGS").map(|s| s.as_str()).unwrap_or("").to_string(),
228+
);
229+
// Pass all the default args + the user-specified ones.
230+
let mut args: Vec<&dyn AsRef<OsStr>> = vec![&"cargo", &"test"];
231+
args.extend(test_args.test_args.iter().map(|s| s as &dyn AsRef<OsStr>));
232+
run_command_with_output_and_env(&args, None, Some(&env))?;
233+
Ok(())
234+
}
235+
206236
fn mini_tests(env: &Env, args: &TestArg) -> Result<(), String> {
207237
// FIXME: create a function "display_if_not_quiet" or something along the line.
208238
println!("[BUILD] mini_core");
@@ -680,7 +710,15 @@ fn test_libcore(env: &Env, args: &TestArg) -> Result<(), String> {
680710
println!("[TEST] libcore");
681711
let path = get_sysroot_dir().join("sysroot_src/library/coretests");
682712
let _ = remove_dir_all(path.join("target"));
683-
run_cargo_command(&[&"test"], Some(&path), env, args)?;
713+
// TODO(antoyo): run in release mode when we fix the failures.
714+
// TODO(antoyo): remove the --skip f16::test_total_cmp when this issue is fixed:
715+
// https://github.com/rust-lang/rust/issues/141503
716+
run_cargo_command(
717+
&[&"test", &"--", &"--skip", &"f16::test_total_cmp"],
718+
Some(&path),
719+
env,
720+
args,
721+
)?;
684722
Ok(())
685723
}
686724

@@ -1217,7 +1255,9 @@ fn run_all(env: &Env, args: &TestArg) -> Result<(), String> {
12171255
// asm_tests(env, args)?;
12181256
test_libcore(env, args)?;
12191257
extended_sysroot_tests(env, args)?;
1258+
cargo_tests(env, args)?;
12201259
test_rustc(env, args)?;
1260+
12211261
Ok(())
12221262
}
12231263

libgccjit.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8b194529188f9d3a98cc211caa805a5355bfa8f0
1+
04ce66d8c918de9273bd7101638ad8724edf5e21
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
From cdb3d407740e4f15c3746051f8ba89b8e74e99d3 Mon Sep 17 00:00:00 2001
2+
From: None <[email protected]>
3+
Date: Fri, 30 May 2025 13:46:22 -0400
4+
Subject: [PATCH] Pin compiler_builtins to 0.1.160
5+
6+
---
7+
library/alloc/Cargo.toml | 2 +-
8+
library/std/Cargo.toml | 2 +-
9+
2 files changed, 2 insertions(+), 2 deletions(-)
10+
11+
diff --git a/library/alloc/Cargo.toml b/library/alloc/Cargo.toml
12+
index 9d0d957..365c9dc 100644
13+
--- a/library/alloc/Cargo.toml
14+
+++ b/library/alloc/Cargo.toml
15+
@@ -16,7 +16,7 @@ bench = false
16+
17+
[dependencies]
18+
core = { path = "../core", public = true }
19+
-compiler_builtins = { version = "=0.1.159", features = ['rustc-dep-of-std'] }
20+
+compiler_builtins = { version = "=0.1.160", features = ['rustc-dep-of-std'] }
21+
22+
[features]
23+
compiler-builtins-mem = ['compiler_builtins/mem']
24+
diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml
25+
index 4ff4895..31371f0 100644
26+
--- a/library/std/Cargo.toml
27+
+++ b/library/std/Cargo.toml
28+
@@ -18,7 +18,7 @@ cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }
29+
panic_unwind = { path = "../panic_unwind", optional = true }
30+
panic_abort = { path = "../panic_abort" }
31+
core = { path = "../core", public = true }
32+
-compiler_builtins = { version = "=0.1.159" }
33+
+compiler_builtins = { version = "=0.1.160" }
34+
unwind = { path = "../unwind" }
35+
hashbrown = { version = "0.15", default-features = false, features = [
36+
'rustc-dep-of-std',
37+
--
38+
2.49.0
39+

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2025-05-12"
2+
channel = "nightly-2025-05-21"
33
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

src/asm.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,8 @@ fn explicit_reg_to_gcc(reg: InlineAsmReg) -> &'static str {
641641
},
642642
}
643643
}
644-
644+
InlineAsmReg::Arm(reg) => reg.name(),
645+
InlineAsmReg::AArch64(reg) => reg.name(),
645646
_ => unimplemented!(),
646647
}
647648
}

src/attributes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
use gccjit::FnAttribute;
33
use gccjit::Function;
44
#[cfg(feature = "master")]
5-
use rustc_attr_parsing::InlineAttr;
6-
use rustc_attr_parsing::InstructionSetAttr;
5+
use rustc_attr_data_structures::InlineAttr;
6+
use rustc_attr_data_structures::InstructionSetAttr;
77
#[cfg(feature = "master")]
88
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
99
#[cfg(feature = "master")]

src/builder.rs

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use std::convert::TryFrom;
44
use std::ops::Deref;
55

66
use gccjit::{
7-
BinaryOp, Block, ComparisonOp, Context, Function, LValue, Location, RValue, ToRValue, Type,
8-
UnaryOp,
7+
BinaryOp, Block, ComparisonOp, Context, Function, FunctionType, LValue, Location, RValue,
8+
ToRValue, Type, UnaryOp,
99
};
1010
use rustc_abi as abi;
1111
use rustc_abi::{Align, HasDataLayout, Size, TargetDataLayout, WrappingRange};
@@ -765,7 +765,15 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
765765

766766
#[cfg(feature = "master")]
767767
match self.cx.type_kind(a_type) {
768-
TypeKind::Half | TypeKind::Float => {
768+
TypeKind::Half => {
769+
let fmodf = self.context.get_builtin_function("fmodf");
770+
let f32_type = self.type_f32();
771+
let a = self.context.new_cast(self.location, a, f32_type);
772+
let b = self.context.new_cast(self.location, b, f32_type);
773+
let result = self.context.new_call(self.location, fmodf, &[a, b]);
774+
return self.context.new_cast(self.location, result, a_type);
775+
}
776+
TypeKind::Float => {
769777
let fmodf = self.context.get_builtin_function("fmodf");
770778
return self.context.new_call(self.location, fmodf, &[a, b]);
771779
}
@@ -774,8 +782,19 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
774782
return self.context.new_call(self.location, fmod, &[a, b]);
775783
}
776784
TypeKind::FP128 => {
777-
let fmodl = self.context.get_builtin_function("fmodl");
778-
return self.context.new_call(self.location, fmodl, &[a, b]);
785+
let f128_type = self.type_f128();
786+
let fmodf128 = self.context.new_function(
787+
None,
788+
FunctionType::Extern,
789+
f128_type,
790+
&[
791+
self.context.new_parameter(None, f128_type, "a"),
792+
self.context.new_parameter(None, f128_type, "b"),
793+
],
794+
"fmodf128",
795+
false,
796+
);
797+
return self.context.new_call(self.location, fmodf128, &[a, b]);
779798
}
780799
_ => (),
781800
}

src/callee.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ pub fn get_fn<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, instance: Instance<'tcx>)
106106
// This is a monomorphization of a generic function.
107107
if !(cx.tcx.sess.opts.share_generics()
108108
|| tcx.codegen_fn_attrs(instance_def_id).inline
109-
== rustc_attr_parsing::InlineAttr::Never)
109+
== rustc_attr_data_structures::InlineAttr::Never)
110110
{
111111
// When not sharing generics, all instances are in the same
112112
// crate and have hidden visibility.

src/common.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,15 @@ impl<'gcc, 'tcx> ConstCodegenMethods for CodegenCx<'gcc, 'tcx> {
237237

238238
// FIXME(antoyo): there's some issues with using the u128 code that follows, so hard-code
239239
// the paths for floating-point values.
240-
if ty == self.float_type {
240+
// TODO: Remove this code?
241+
/*if ty == self.float_type {
241242
return self
242243
.context
243244
.new_rvalue_from_double(ty, f32::from_bits(data as u32) as f64);
244245
}
245246
if ty == self.double_type {
246247
return self.context.new_rvalue_from_double(ty, f64::from_bits(data as u64));
247-
}
248+
}*/
248249

249250
let value = self.const_uint_big(self.type_ix(bitsize), data);
250251
let bytesize = layout.size(self).bytes();

src/int.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
915915
let name_suffix = match self.type_kind(dest_typ) {
916916
TypeKind::Float => "tisf",
917917
TypeKind::Double => "tidf",
918-
TypeKind::FP128 => "tixf",
918+
TypeKind::FP128 => "titf",
919919
kind => panic!("cannot cast a non-native integer to type {:?}", kind),
920920
};
921921
let sign = if signed { "" } else { "un" };

0 commit comments

Comments
 (0)