Skip to content

Commit 0e5c305

Browse files
committed
Auto merge of #158734 - nikic:llvm23, r=cuviper
Update to LLVM 23 Changes in this PR (apart from the LLVM update): * Updated cov-map tests due to minor ordering changes introduced in llvm/llvm-project@5931034. The affected tests are limited to LLVM >= 23 now. * Set `LLVM_VERSIONED_DYLIB_NAME_ON_DARWIN=OFF`, which restores the previous unversioned naming of the LLVM dylib on Darwin. I expect we'll want to change this for consistency with Linux, but given the amount of trouble Darwin dylibs have caused in the past, I'm not trying to do it in this PR. * Distribute the llvm-project/libc subproject, which is now a build dependency of LLVM. * Pull in f128 Windows ABI changes from #158778. These need to land in sync with the LLVM update (as ABI of libcalls is controlled by LLVM, not our ABI lowering). * Disable RISCV backend on dist-i686-mingw, because the build OOMs on a large generated file. This is a temporary measure until host tools are removed by rust-lang/compiler-team#1020. * The llvm-project fork includes a new downstream patch for mingw: rust-lang/llvm-project@b89cd8e It works around mingw having broken TLS prior to GCC 16. (We're currently on GCC 14.) Issues: * [x] llvm/llvm-project#209512 * [x] llvm/llvm-project#209714 * [x] llvm/llvm-project#209718 * [x] rust-lang/stdarch#2190 (synced in #159517) * [x] llvm/llvm-project#210025 * [x] #159391 * [x] EnzymeAD/Enzyme#2951 * [x] #159301 * [x] llvm/llvm-project#210300
2 parents 0b63def + d1cc268 commit 0e5c305

25 files changed

Lines changed: 86 additions & 70 deletions

File tree

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
[submodule "src/llvm-project"]
2626
path = src/llvm-project
2727
url = https://github.com/rust-lang/llvm-project.git
28-
branch = rustc/22.1-2026-05-19
28+
branch = rustc/23.1-2026-07-22
2929
shallow = true
3030
[submodule "src/doc/embedded-book"]
3131
path = src/doc/embedded-book

compiler/rustc_codegen_cranelift/src/abi/mod.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,19 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> {
141141
) -> Cow<'_, [Value]> {
142142
// FIXME any way to reuse the abi adjustment code in rustc_target?
143143

144-
// Pass i128 arguments by-ref on Windows.
144+
// Pass and return f128 indirectly on s390x and x86_64 Windows.
145+
let indirect_f128 = self.tcx.sess.target.arch == Arch::S390x
146+
|| (self.tcx.sess.target.is_like_windows && self.tcx.sess.target.arch == Arch::X86_64);
147+
148+
// Pass i128 arguments by-ref on s390x and Windows.
145149
let (params, args): (Vec<_>, Cow<'_, [_]>) =
146150
if self.tcx.sess.target.is_like_windows || self.tcx.sess.target.arch == Arch::S390x {
147151
let (params, args): (Vec<_>, Vec<_>) = params
148152
.into_iter()
149153
.zip(args)
150154
.map(|(param, &arg)| {
151155
if param.value_type == types::I128
152-
|| (self.tcx.sess.target.arch == Arch::S390x
153-
&& param.value_type == types::F128)
156+
|| (indirect_f128 && param.value_type == types::F128)
154157
{
155158
let arg_ptr = self.create_stack_slot(16, 16);
156159
arg_ptr.store(self, arg, MemFlagsData::trusted());
@@ -166,19 +169,20 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> {
166169
(params, args.into())
167170
};
168171

169-
if self.tcx.sess.target.is_like_windows
170-
&& matches!(*returns, [AbiParam { value_type: types::I128, .. }])
171-
{
172+
let ret_single_i128 = matches!(*returns, [AbiParam { value_type: types::I128, .. }]);
173+
let ret_single_f128 = matches!(*returns, [AbiParam { value_type: types::F128, .. }]);
174+
if ret_single_i128 && self.tcx.sess.target.is_like_windows {
172175
// Return i128 using the vector ABI on Windows
173176
returns[0].value_type = types::I64X2;
174177

175178
let ret = self.lib_call_unadjusted(name, params, returns, &args)[0];
176179

177180
Cow::Owned(vec![codegen_bitcast(self, types::I128, ret)])
178-
} else if self.tcx.sess.target.arch == Arch::S390x
179-
&& matches!(*returns, [AbiParam { value_type: types::I128 | types::F128, .. }])
181+
} else if (ret_single_i128 && self.tcx.sess.target.arch == Arch::S390x)
182+
|| (ret_single_f128 && indirect_f128)
180183
{
181-
// Return i128 and f128 using a return area pointer on s390x.
184+
// Return x86_64 Windows f128 and s390x i128 indirectly (sret in LLVM terminology).
185+
let ret_ty = returns[0].value_type;
182186
let mut params = params;
183187
let mut args = args.to_vec();
184188

@@ -188,7 +192,7 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> {
188192

189193
self.lib_call_unadjusted(name, params, vec![], &args);
190194

191-
Cow::Owned(vec![ret_ptr.load(self, types::I128, MemFlagsData::trusted())])
195+
Cow::Owned(vec![ret_ptr.load(self, ret_ty, MemFlagsData::trusted())])
192196
} else {
193197
Cow::Borrowed(self.lib_call_unadjusted(name, params, returns, &args))
194198
}

compiler/rustc_llvm/build.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,11 @@ fn main() {
251251
// for this platform. See https://github.com/rust-lang/rust/pull/145031#issuecomment-3162677202.
252252
// Moreover, LLVM generally guarantees warning-freedom only when building with Clang, as other
253253
// compilers have too many false positives. This is typically the case for MSVC, which throws
254-
// many false-positive warnings. We keep it excluded, for these reasons.
255-
if std::env::var_os("CI").is_some() && !target.contains("msvc") {
254+
// many false-positive warnings, and also GCC. We keep these excluded, for these reasons.
255+
let is_msvc = target.contains("msvc");
256+
let compiler_is_gcc =
257+
tracked_env_var_os("LLVM_COMPILER_IS_GNU_LIKE").as_deref() == Some(OsStr::new("1"));
258+
if std::env::var_os("CI").is_some() && !is_msvc && !compiler_is_gcc {
256259
cfg.warnings_into_errors(true);
257260
}
258261
for flag in &cxxflags {

compiler/rustc_target/src/callconv/x86_win64.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use rustc_abi::{BackendRepr, Float, Integer, Primitive, Size, TyAbiInterface};
1+
use rustc_abi::{BackendRepr, Integer, Primitive, Size, TyAbiInterface};
22

33
use crate::callconv::{ArgAbi, FnAbi, Reg};
44
use crate::spec::{HasTargetSpec, RustcAbi};
@@ -35,11 +35,7 @@ where
3535
// FIXME(#134288): This may change for the `-msvc` targets in the future.
3636
a.cast_to(Reg::opaque_vector(Size::from_bits(128)));
3737
}
38-
} else if a.layout.size.bytes() > 8
39-
&& !matches!(scalar.primitive(), Primitive::Float(Float::F128))
40-
{
41-
// Match what LLVM does for `f128` so that `compiler-builtins` builtins match up
42-
// with what LLVM expects.
38+
} else if a.layout.size.bytes() > 8 {
4339
a.make_indirect();
4440
} else {
4541
a.extend_integer_width_to(32);

library/compiler-builtins/compiler-builtins/build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,10 @@ mod c {
362362
("__aeabi_div0", "arm/aeabi_div0.c"),
363363
("__aeabi_drsub", "arm/aeabi_drsub.c"),
364364
("__aeabi_frsub", "arm/aeabi_frsub.c"),
365+
("__aeabi_uread4", "arm/aeabi_uread4.S"),
366+
("__aeabi_uread8", "arm/aeabi_uread8.S"),
367+
("__aeabi_uwrite4", "arm/aeabi_uwrite4.S"),
368+
("__aeabi_uwrite8", "arm/aeabi_uwrite8.S"),
365369
("__bswapdi2", "arm/bswapdi2.S"),
366370
("__bswapsi2", "arm/bswapsi2.S"),
367371
("__divmodsi4", "arm/divmodsi4.S"),

src/bootstrap/src/core/build_steps/compile.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,6 +1487,9 @@ fn rustc_llvm_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelect
14871487
if builder.config.llvm_assertions {
14881488
cargo.env("LLVM_ASSERTIONS", "1");
14891489
}
1490+
if builder.cxx_tool(target).is_like_gnu() || builder.cc_tool(target).is_like_gnu() {
1491+
cargo.env("LLVM_COMPILER_IS_GNU_LIKE", "1");
1492+
}
14901493
}
14911494

14921495
/// `RustcLink` copies compiler rlibs from a rustc build into a compiler sysroot.

src/bootstrap/src/core/build_steps/dist.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,7 @@ fn copy_src_dirs(
10681068

10691069
static LLVM_PROJECTS: &[&str] = &[
10701070
"llvm-project/clang",
1071+
"llvm-project/libc",
10711072
"llvm-project/libunwind",
10721073
"llvm-project/lld",
10731074
"llvm-project/lldb",

src/bootstrap/src/core/build_steps/llvm.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,8 @@ impl CommandLineStep for Llvm {
410410
// equally well everywhere.
411411
if builder.llvm_link_shared() {
412412
cfg.define("LLVM_LINK_LLVM_DYLIB", "ON");
413+
// Keep the pre-LLVM23 behavior for now.
414+
cfg.define("LLVM_VERSIONED_DYLIB_NAME_ON_DARWIN", "OFF");
413415
}
414416

415417
if (target.starts_with("csky")

src/ci/docker/host-x86_64/dist-x86_64-netbsd/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ RUN sh /scripts/cross-apt-packages.sh
66
RUN apt-get install -y zlib1g-dev
77

88
COPY host-x86_64/dist-x86_64-netbsd/build-netbsd-toolchain.sh /tmp/
9-
# GCC 10 changed the default to -fno-common, which causes errors with the NetBSD-9.0 sources like:
9+
# GCC 10 changed the default to -fno-common, which causes errors with the NetBSD sources like:
1010
# /usr/bin/ld: buf.o:(.bss+0x0): multiple definition of `debug_file'; arch.o:(.bss+0x0): first defined here
1111
RUN env HOST_CFLAGS="-O -fcommon" /tmp/build-netbsd-toolchain.sh
1212

src/ci/docker/host-x86_64/dist-x86_64-netbsd/build-netbsd-toolchain.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,21 @@ cd netbsd
4141

4242
mkdir -p /x-tools/x86_64-unknown-netbsd/sysroot
4343

44-
# Hashes come from https://cdn.netbsd.org/pub/NetBSD/security/hashes/NetBSD-9.0_hashes.asc
45-
SRC_SHA=2c791ae009a6929c6fc893ec5df7e62910ee8207e0b2159d6937309c03efe175b6ae1e445829a13d041b6851334ad35c521f2fa03c97675d4a05f1fafe58ede0
46-
GNUSRC_SHA=3710085a73feecf6a843415271ec794c90146b03f6bbd30f07c9e0c79febf8995d557e40194f1e05db655e4f5ef2fae97563f8456fceaae65d4ea98857a83b1c
47-
SHARESRC_SHA=f080776ed82c3ac5d6272dee39746f87897d8e6984996caf5bf6d87bf11d9c9e0c1ad5c437c21258bd278bb6fd76974946e878f548517885f71c556096231369
48-
SYSSRC_SHA=60b9ddf4cc6402256473e2e1eefeabd9001aa4e205208715ecc6d6fc3f5b400e469944580077271b8e80562a4c2f601249e69e07a504f46744e0c50335f1cbf1
49-
BASE_SHA=b5926b107cebf40c3c19b4f6cd039b610987dd7f819e7cdde3bd1e5230a856906e7930b15ab242d52ced9f0bda01d574be59488b8dbb95fa5df2987d0a70995f
50-
COMP_SHA=38ea54f30d5fc2afea87e5096f06873e00182789e8ad9cec0cb3e9f7c538c1aa4779e63fd401a36ba02676158e83fa5c95e8e87898db59c1914fb206aecd82d2
51-
52-
SOURCE_URL=https://ci-mirrors.rust-lang.org/rustc/2025-03-14-netbsd-9.0-src
44+
# Hashes come from https://cdn.netbsd.org/pub/NetBSD/security/hashes/NetBSD-10.1_hashes.asc
45+
SRC_SHA=6ae2053b4b75821238c0757d4f7258daece425de72524c616e07d3adee7c48d87422dd47d852a137918cec3dd3c0d339e372f4504dfe9f1bc5520011775bdb86
46+
GNUSRC_SHA=8a1c42030ba44eb2a0c7a5111187bc02e8f4d0860d8491b7863579e612333665c478625c37b01f08732e3cfd29ec31335f1db1274fd7dcfdc048b09d1b4bbb83
47+
SHARESRC_SHA=703eeb306fc0328cad7e6f0e100d2e7af194f82e613338f4611a7bcd5f6d773d8789e7ce03ec25268ec2b95ccdb97c3b4289a838a629716498b4d7c3184cb1ef
48+
SYSSRC_SHA=766ac21f33cfe0e701dfedb894fa07f36d811da1a12e979181e8fca7af4e627852680ce42a7b29e97dd3e2e402ddf9ae7bfba60c8d7dc6b8a3354d8ce8c06926
49+
BASE_SHA=1c6b74cedd7fc92adfe51239808d41e63fc6eb9e9877c1101c1da515a38457278c7774e8fc3041d69cefc49821bad836cfdcc5147ad757f2f4a1f59f9e3862e5
50+
COMP_SHA=ea90d527d1475bd64d2b4c36d9d6ae53cb353cbc8c4feaa2b2bf006710282d2f47349a8aeeb64531f9da04268ed368ff2603c1e11a30bdfc8b2539ad73fe725f
51+
52+
SOURCE_URL=https://ci-mirrors.rust-lang.org/rustc/netbsd/2026-07-28-netbsd-10.1-src
5353
download src.tgz "$SOURCE_URL-src.tgz" "$SRC_SHA" tar xzf src.tgz
5454
download gnusrc.tgz "$SOURCE_URL-gnusrc.tgz" "$GNUSRC_SHA" tar xzf gnusrc.tgz
5555
download sharesrc.tgz "$SOURCE_URL-sharesrc.tgz" "$SHARESRC_SHA" tar xzf sharesrc.tgz
5656
download syssrc.tgz "$SOURCE_URL-syssrc.tgz" "$SYSSRC_SHA" tar xzf syssrc.tgz
5757

58-
BINARY_URL=https://ci-mirrors.rust-lang.org/rustc/2025-03-14-netbsd-9.0-amd64-binary
58+
BINARY_URL=https://ci-mirrors.rust-lang.org/rustc/netbsd/2026-07-28-netbsd-10.1-amd64-binary
5959
download base.tar.xz "$BINARY_URL-base.tar.xz" "$BASE_SHA" \
6060
tar xJf base.tar.xz -C /x-tools/x86_64-unknown-netbsd/sysroot ./usr/include ./usr/lib ./lib
6161
download comp.tar.xz "$BINARY_URL-comp.tar.xz" "$COMP_SHA" \

0 commit comments

Comments
 (0)