From 38262aa3b85e965e37c3307bc0e095cd3e02b009 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 3 Jul 2026 14:28:32 +0200 Subject: [PATCH 01/12] Update to LLVM 23 --- .gitmodules | 2 +- src/llvm-project | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 9f9d573668245..9d04fae237505 100644 --- a/.gitmodules +++ b/.gitmodules @@ -25,7 +25,7 @@ [submodule "src/llvm-project"] path = src/llvm-project url = https://github.com/rust-lang/llvm-project.git - branch = rustc/22.1-2026-05-19 + branch = rustc/23.1-2026-07-22 shallow = true [submodule "src/doc/embedded-book"] path = src/doc/embedded-book diff --git a/src/llvm-project b/src/llvm-project index 52ed14fcd56af..21cf284327989 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 52ed14fcd56afc30f9cccd8ca8ce237c2eef7e04 +Subproject commit 21cf28432798952d942bacc6bcee3a328faa3638 From 7c1a8caa8afcf81d6fc67be853b52b7ea6f71b4d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 13 Jul 2026 15:09:07 +0200 Subject: [PATCH 02/12] Update host toolchain --- src/ci/docker/scripts/build-clang.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/docker/scripts/build-clang.sh b/src/ci/docker/scripts/build-clang.sh index b3b1dc47e2ef7..ed293b2211598 100755 --- a/src/ci/docker/scripts/build-clang.sh +++ b/src/ci/docker/scripts/build-clang.sh @@ -5,7 +5,7 @@ set -ex source shared.sh # Try to keep the LLVM version here in sync with src/ci/scripts/install-clang.sh -LLVM=llvmorg-22.1.0-rc2 +LLVM=llvmorg-23.1.0-rc1 mkdir llvm-project cd llvm-project From 39c595d761c20477733419e0275b1b26184faa50 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 3 Jul 2026 15:29:32 +0200 Subject: [PATCH 03/12] Update cov-map tests for LLVM 23 There is a minor change in sorted order due to: https://github.com/llvm/llvm-project/commit/593103465326850f23bc9a6078ae7fb01065d46e --- tests/coverage/async.cov-map | 8 ++++---- tests/coverage/async.coverage | 2 +- tests/coverage/async.rs | 2 +- tests/coverage/coroutine.cov-map | 16 ++++++++-------- tests/coverage/coroutine.coverage | 1 + tests/coverage/coroutine.rs | 1 + tests/coverage/yield.cov-map | 28 ++++++++++++++-------------- tests/coverage/yield.coverage | 1 + tests/coverage/yield.rs | 1 + 9 files changed, 32 insertions(+), 28 deletions(-) diff --git a/tests/coverage/async.cov-map b/tests/coverage/async.cov-map index d75c4b5981a05..b4304a43d64e6 100644 --- a/tests/coverage/async.cov-map +++ b/tests/coverage/async.cov-map @@ -166,7 +166,7 @@ Number of file 0 mappings: 1 Highest counter ID seen: c0 Function name: async::i::{closure#0} -Raw bytes (75): 0x[01, 01, 03, 05, 09, 11, 15, 0d, 11, 0d, 01, 2c, 13, 00, 14, 01, 04, 0b, 00, 0c, 09, 01, 09, 00, 0a, 01, 00, 0e, 00, 0f, 01, 00, 0e, 00, 18, 05, 00, 1c, 00, 21, 09, 00, 27, 00, 30, 15, 01, 09, 00, 0a, 02, 00, 0e, 00, 17, 11, 00, 1b, 00, 20, 15, 00, 24, 00, 26, 06, 01, 0e, 00, 10, 0b, 02, 01, 00, 02] +Raw bytes (75): 0x[01, 01, 03, 05, 09, 11, 15, 0d, 11, 0d, 01, 2c, 13, 00, 14, 01, 04, 0b, 00, 0c, 09, 01, 09, 00, 0a, 01, 00, 0e, 00, 18, 01, 00, 0e, 00, 0f, 05, 00, 1c, 00, 21, 09, 00, 27, 00, 30, 15, 01, 09, 00, 0a, 02, 00, 0e, 00, 17, 11, 00, 1b, 00, 20, 15, 00, 24, 00, 26, 06, 01, 0e, 00, 10, 0b, 02, 01, 00, 02] Number of files: 1 - file 0 => $DIR/async.rs Number of expressions: 3 @@ -177,8 +177,8 @@ Number of file 0 mappings: 13 - Code(Counter(0)) at (prev + 44, 19) to (start + 0, 20) - Code(Counter(0)) at (prev + 4, 11) to (start + 0, 12) - Code(Counter(2)) at (prev + 1, 9) to (start + 0, 10) -- Code(Counter(0)) at (prev + 0, 14) to (start + 0, 15) - Code(Counter(0)) at (prev + 0, 14) to (start + 0, 24) +- Code(Counter(0)) at (prev + 0, 14) to (start + 0, 15) - Code(Counter(1)) at (prev + 0, 28) to (start + 0, 33) - Code(Counter(2)) at (prev + 0, 39) to (start + 0, 48) - Code(Counter(5)) at (prev + 1, 9) to (start + 0, 10) @@ -193,7 +193,7 @@ Number of file 0 mappings: 13 Highest counter ID seen: c5 Function name: async::j -Raw bytes (65): 0x[01, 01, 03, 01, 05, 01, 0b, 05, 09, 0b, 01, 37, 01, 00, 0c, 01, 0b, 0b, 00, 0c, 05, 01, 09, 00, 0a, 01, 00, 0e, 00, 0f, 01, 00, 0e, 00, 1b, 05, 00, 1f, 00, 27, 09, 01, 09, 00, 0a, 02, 00, 0e, 00, 1a, 09, 00, 1e, 00, 20, 06, 01, 0e, 00, 10, 01, 02, 01, 00, 02] +Raw bytes (65): 0x[01, 01, 03, 01, 05, 01, 0b, 05, 09, 0b, 01, 37, 01, 00, 0c, 01, 0b, 0b, 00, 0c, 05, 01, 09, 00, 0a, 01, 00, 0e, 00, 1b, 01, 00, 0e, 00, 0f, 05, 00, 1f, 00, 27, 09, 01, 09, 00, 0a, 02, 00, 0e, 00, 1a, 09, 00, 1e, 00, 20, 06, 01, 0e, 00, 10, 01, 02, 01, 00, 02] Number of files: 1 - file 0 => $DIR/async.rs Number of expressions: 3 @@ -204,8 +204,8 @@ Number of file 0 mappings: 11 - Code(Counter(0)) at (prev + 55, 1) to (start + 0, 12) - Code(Counter(0)) at (prev + 11, 11) to (start + 0, 12) - Code(Counter(1)) at (prev + 1, 9) to (start + 0, 10) -- Code(Counter(0)) at (prev + 0, 14) to (start + 0, 15) - Code(Counter(0)) at (prev + 0, 14) to (start + 0, 27) +- Code(Counter(0)) at (prev + 0, 14) to (start + 0, 15) - Code(Counter(1)) at (prev + 0, 31) to (start + 0, 39) - Code(Counter(2)) at (prev + 1, 9) to (start + 0, 10) - Code(Expression(0, Sub)) at (prev + 0, 14) to (start + 0, 26) diff --git a/tests/coverage/async.coverage b/tests/coverage/async.coverage index 9409e6b1deb85..fe1a353b5f1a1 100644 --- a/tests/coverage/async.coverage +++ b/tests/coverage/async.coverage @@ -4,7 +4,7 @@ LL| |#![rustfmt::skip] LL| |//@ edition: 2018 LL| |//@ compile-flags: -Copt-level=1 - LL| | + LL| |//@ min-llvm-version: 23 LL| |//@ aux-build: executor.rs LL| |extern crate executor; LL| | diff --git a/tests/coverage/async.rs b/tests/coverage/async.rs index 777ad7ce7c0c3..d8f608df81535 100644 --- a/tests/coverage/async.rs +++ b/tests/coverage/async.rs @@ -4,7 +4,7 @@ #![rustfmt::skip] //@ edition: 2018 //@ compile-flags: -Copt-level=1 - +//@ min-llvm-version: 23 //@ aux-build: executor.rs extern crate executor; diff --git a/tests/coverage/coroutine.cov-map b/tests/coverage/coroutine.cov-map index daa42915a4af5..9599af9f0ab2c 100644 --- a/tests/coverage/coroutine.cov-map +++ b/tests/coverage/coroutine.cov-map @@ -1,11 +1,11 @@ Function name: coroutine::get_u32 -Raw bytes (31): 0x[01, 01, 01, 01, 05, 05, 01, 0b, 01, 00, 2d, 01, 01, 08, 00, 0b, 05, 01, 09, 00, 0e, 02, 02, 09, 00, 28, 01, 02, 01, 00, 02] +Raw bytes (31): 0x[01, 01, 01, 01, 05, 05, 01, 0c, 01, 00, 2d, 01, 01, 08, 00, 0b, 05, 01, 09, 00, 0e, 02, 02, 09, 00, 28, 01, 02, 01, 00, 02] Number of files: 1 - file 0 => $DIR/coroutine.rs Number of expressions: 1 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) Number of file 0 mappings: 5 -- Code(Counter(0)) at (prev + 11, 1) to (start + 0, 45) +- Code(Counter(0)) at (prev + 12, 1) to (start + 0, 45) - Code(Counter(0)) at (prev + 1, 8) to (start + 0, 11) - Code(Counter(1)) at (prev + 1, 9) to (start + 0, 14) - Code(Expression(0, Sub)) at (prev + 2, 9) to (start + 0, 40) @@ -14,14 +14,14 @@ Number of file 0 mappings: 5 Highest counter ID seen: c1 Function name: coroutine::main -Raw bytes (93): 0x[01, 01, 02, 01, 05, 05, 09, 11, 01, 13, 01, 00, 0a, 01, 01, 09, 00, 10, 01, 00, 13, 00, 2e, 01, 01, 09, 00, 16, 01, 06, 0b, 00, 13, 01, 00, 14, 00, 22, 01, 00, 24, 00, 2a, 01, 00, 2b, 00, 2d, 05, 01, 2b, 00, 2d, 02, 01, 0e, 00, 14, 05, 02, 0b, 00, 13, 05, 00, 0b, 00, 2e, 05, 00, 14, 00, 22, 0d, 01, 22, 00, 27, 09, 00, 2c, 00, 2e, 06, 01, 0e, 00, 14, 09, 02, 01, 00, 02] +Raw bytes (93): 0x[01, 01, 02, 01, 05, 05, 09, 11, 01, 14, 01, 00, 0a, 01, 01, 09, 00, 10, 01, 00, 13, 00, 2e, 01, 01, 09, 00, 16, 01, 06, 0b, 00, 13, 01, 00, 14, 00, 22, 01, 00, 24, 00, 2a, 01, 00, 2b, 00, 2d, 05, 01, 2b, 00, 2d, 02, 01, 0e, 00, 14, 05, 02, 0b, 00, 2e, 05, 00, 0b, 00, 13, 05, 00, 14, 00, 22, 0d, 01, 22, 00, 27, 09, 00, 2c, 00, 2e, 06, 01, 0e, 00, 14, 09, 02, 01, 00, 02] Number of files: 1 - file 0 => $DIR/coroutine.rs Number of expressions: 2 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) - expression 1 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 17 -- Code(Counter(0)) at (prev + 19, 1) to (start + 0, 10) +- Code(Counter(0)) at (prev + 20, 1) to (start + 0, 10) - Code(Counter(0)) at (prev + 1, 9) to (start + 0, 16) - Code(Counter(0)) at (prev + 0, 19) to (start + 0, 46) - Code(Counter(0)) at (prev + 1, 9) to (start + 0, 22) @@ -32,8 +32,8 @@ Number of file 0 mappings: 17 - Code(Counter(1)) at (prev + 1, 43) to (start + 0, 45) - Code(Expression(0, Sub)) at (prev + 1, 14) to (start + 0, 20) = (c0 - c1) -- Code(Counter(1)) at (prev + 2, 11) to (start + 0, 19) -- Code(Counter(1)) at (prev + 0, 11) to (start + 0, 46) +- Code(Counter(1)) at (prev + 2, 11) to (start + 0, 46) +- Code(Counter(1)) at (prev + 0, 11) to (start + 0, 19) - Code(Counter(1)) at (prev + 0, 20) to (start + 0, 34) - Code(Counter(3)) at (prev + 1, 34) to (start + 0, 39) - Code(Counter(2)) at (prev + 0, 44) to (start + 0, 46) @@ -43,12 +43,12 @@ Number of file 0 mappings: 17 Highest counter ID seen: c3 Function name: coroutine::main::{closure#0} -Raw bytes (24): 0x[01, 01, 00, 04, 01, 16, 08, 00, 09, 01, 01, 09, 00, 1f, 05, 01, 10, 00, 15, 05, 01, 05, 00, 06] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 17, 08, 00, 09, 01, 01, 09, 00, 1f, 05, 01, 10, 00, 15, 05, 01, 05, 00, 06] Number of files: 1 - file 0 => $DIR/coroutine.rs Number of expressions: 0 Number of file 0 mappings: 4 -- Code(Counter(0)) at (prev + 22, 8) to (start + 0, 9) +- Code(Counter(0)) at (prev + 23, 8) to (start + 0, 9) - Code(Counter(0)) at (prev + 1, 9) to (start + 0, 31) - Code(Counter(1)) at (prev + 1, 16) to (start + 0, 21) - Code(Counter(1)) at (prev + 1, 5) to (start + 0, 6) diff --git a/tests/coverage/coroutine.coverage b/tests/coverage/coroutine.coverage index 611470c577388..02fc91bcf5863 100644 --- a/tests/coverage/coroutine.coverage +++ b/tests/coverage/coroutine.coverage @@ -1,3 +1,4 @@ + LL| |//@ min-llvm-version: 23 LL| |#![feature(coroutines, coroutine_trait, stmt_expr_attributes)] LL| | LL| |use std::ops::{Coroutine, CoroutineState}; diff --git a/tests/coverage/coroutine.rs b/tests/coverage/coroutine.rs index bd149764b3737..9a11abd934e4a 100644 --- a/tests/coverage/coroutine.rs +++ b/tests/coverage/coroutine.rs @@ -1,3 +1,4 @@ +//@ min-llvm-version: 23 #![feature(coroutines, coroutine_trait, stmt_expr_attributes)] use std::ops::{Coroutine, CoroutineState}; diff --git a/tests/coverage/yield.cov-map b/tests/coverage/yield.cov-map index 87d0a0472615f..8c1da30c08b6c 100644 --- a/tests/coverage/yield.cov-map +++ b/tests/coverage/yield.cov-map @@ -1,5 +1,5 @@ Function name: yield::main -Raw bytes (139): 0x[01, 01, 05, 01, 05, 05, 09, 09, 11, 11, 15, 11, 15, 19, 01, 07, 01, 00, 0a, 01, 01, 09, 00, 16, 01, 06, 0b, 00, 13, 01, 00, 0b, 00, 2e, 01, 00, 14, 00, 22, 05, 01, 27, 00, 29, 02, 01, 0e, 00, 14, 05, 02, 0b, 00, 13, 05, 00, 0b, 00, 2e, 05, 00, 14, 00, 22, 0d, 01, 22, 00, 27, 09, 00, 2c, 00, 2e, 06, 01, 0e, 00, 14, 09, 03, 09, 00, 16, 09, 08, 0b, 00, 13, 09, 00, 0b, 00, 2e, 09, 00, 14, 00, 22, 11, 01, 27, 00, 29, 0a, 01, 0e, 00, 14, 11, 02, 0b, 00, 13, 11, 00, 0b, 00, 2e, 11, 00, 14, 00, 22, 12, 01, 27, 00, 29, 15, 01, 0e, 00, 14, 12, 02, 01, 00, 02] +Raw bytes (139): 0x[01, 01, 05, 01, 05, 05, 09, 09, 11, 11, 15, 11, 15, 19, 01, 08, 01, 00, 0a, 01, 01, 09, 00, 16, 01, 06, 0b, 00, 2e, 01, 00, 0b, 00, 13, 01, 00, 14, 00, 22, 05, 01, 27, 00, 29, 02, 01, 0e, 00, 14, 05, 02, 0b, 00, 2e, 05, 00, 0b, 00, 13, 05, 00, 14, 00, 22, 0d, 01, 22, 00, 27, 09, 00, 2c, 00, 2e, 06, 01, 0e, 00, 14, 09, 03, 09, 00, 16, 09, 08, 0b, 00, 2e, 09, 00, 0b, 00, 13, 09, 00, 14, 00, 22, 11, 01, 27, 00, 29, 0a, 01, 0e, 00, 14, 11, 02, 0b, 00, 2e, 11, 00, 0b, 00, 13, 11, 00, 14, 00, 22, 12, 01, 27, 00, 29, 15, 01, 0e, 00, 14, 12, 02, 01, 00, 02] Number of files: 1 - file 0 => $DIR/yield.rs Number of expressions: 5 @@ -9,30 +9,30 @@ Number of expressions: 5 - expression 3 operands: lhs = Counter(4), rhs = Counter(5) - expression 4 operands: lhs = Counter(4), rhs = Counter(5) Number of file 0 mappings: 25 -- Code(Counter(0)) at (prev + 7, 1) to (start + 0, 10) +- Code(Counter(0)) at (prev + 8, 1) to (start + 0, 10) - Code(Counter(0)) at (prev + 1, 9) to (start + 0, 22) -- Code(Counter(0)) at (prev + 6, 11) to (start + 0, 19) -- Code(Counter(0)) at (prev + 0, 11) to (start + 0, 46) +- Code(Counter(0)) at (prev + 6, 11) to (start + 0, 46) +- Code(Counter(0)) at (prev + 0, 11) to (start + 0, 19) - Code(Counter(0)) at (prev + 0, 20) to (start + 0, 34) - Code(Counter(1)) at (prev + 1, 39) to (start + 0, 41) - Code(Expression(0, Sub)) at (prev + 1, 14) to (start + 0, 20) = (c0 - c1) -- Code(Counter(1)) at (prev + 2, 11) to (start + 0, 19) -- Code(Counter(1)) at (prev + 0, 11) to (start + 0, 46) +- Code(Counter(1)) at (prev + 2, 11) to (start + 0, 46) +- Code(Counter(1)) at (prev + 0, 11) to (start + 0, 19) - Code(Counter(1)) at (prev + 0, 20) to (start + 0, 34) - Code(Counter(3)) at (prev + 1, 34) to (start + 0, 39) - Code(Counter(2)) at (prev + 0, 44) to (start + 0, 46) - Code(Expression(1, Sub)) at (prev + 1, 14) to (start + 0, 20) = (c1 - c2) - Code(Counter(2)) at (prev + 3, 9) to (start + 0, 22) -- Code(Counter(2)) at (prev + 8, 11) to (start + 0, 19) -- Code(Counter(2)) at (prev + 0, 11) to (start + 0, 46) +- Code(Counter(2)) at (prev + 8, 11) to (start + 0, 46) +- Code(Counter(2)) at (prev + 0, 11) to (start + 0, 19) - Code(Counter(2)) at (prev + 0, 20) to (start + 0, 34) - Code(Counter(4)) at (prev + 1, 39) to (start + 0, 41) - Code(Expression(2, Sub)) at (prev + 1, 14) to (start + 0, 20) = (c2 - c4) -- Code(Counter(4)) at (prev + 2, 11) to (start + 0, 19) -- Code(Counter(4)) at (prev + 0, 11) to (start + 0, 46) +- Code(Counter(4)) at (prev + 2, 11) to (start + 0, 46) +- Code(Counter(4)) at (prev + 0, 11) to (start + 0, 19) - Code(Counter(4)) at (prev + 0, 20) to (start + 0, 34) - Code(Expression(4, Sub)) at (prev + 1, 39) to (start + 0, 41) = (c4 - c5) @@ -42,24 +42,24 @@ Number of file 0 mappings: 25 Highest counter ID seen: c5 Function name: yield::main::{closure#0} -Raw bytes (24): 0x[01, 01, 00, 04, 01, 09, 08, 00, 09, 01, 01, 09, 00, 10, 05, 01, 10, 00, 15, 05, 01, 05, 00, 06] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 0a, 08, 00, 09, 01, 01, 09, 00, 10, 05, 01, 10, 00, 15, 05, 01, 05, 00, 06] Number of files: 1 - file 0 => $DIR/yield.rs Number of expressions: 0 Number of file 0 mappings: 4 -- Code(Counter(0)) at (prev + 9, 8) to (start + 0, 9) +- Code(Counter(0)) at (prev + 10, 8) to (start + 0, 9) - Code(Counter(0)) at (prev + 1, 9) to (start + 0, 16) - Code(Counter(1)) at (prev + 1, 16) to (start + 0, 21) - Code(Counter(1)) at (prev + 1, 5) to (start + 0, 6) Highest counter ID seen: c1 Function name: yield::main::{closure#1} -Raw bytes (34): 0x[01, 01, 00, 06, 01, 18, 08, 00, 09, 01, 01, 09, 00, 10, 05, 01, 09, 00, 10, 09, 01, 09, 00, 10, 0d, 01, 10, 00, 15, 0d, 01, 05, 00, 06] +Raw bytes (34): 0x[01, 01, 00, 06, 01, 19, 08, 00, 09, 01, 01, 09, 00, 10, 05, 01, 09, 00, 10, 09, 01, 09, 00, 10, 0d, 01, 10, 00, 15, 0d, 01, 05, 00, 06] Number of files: 1 - file 0 => $DIR/yield.rs Number of expressions: 0 Number of file 0 mappings: 6 -- Code(Counter(0)) at (prev + 24, 8) to (start + 0, 9) +- Code(Counter(0)) at (prev + 25, 8) to (start + 0, 9) - Code(Counter(0)) at (prev + 1, 9) to (start + 0, 16) - Code(Counter(1)) at (prev + 1, 9) to (start + 0, 16) - Code(Counter(2)) at (prev + 1, 9) to (start + 0, 16) diff --git a/tests/coverage/yield.coverage b/tests/coverage/yield.coverage index 2c133cbec5495..2fea2d94dae4b 100644 --- a/tests/coverage/yield.coverage +++ b/tests/coverage/yield.coverage @@ -1,3 +1,4 @@ + LL| |//@ min-llvm-version: 23 LL| |#![feature(coroutines, coroutine_trait, stmt_expr_attributes)] LL| |#![allow(unused_assignments)] LL| | diff --git a/tests/coverage/yield.rs b/tests/coverage/yield.rs index e02e3d3561243..da868e39f5893 100644 --- a/tests/coverage/yield.rs +++ b/tests/coverage/yield.rs @@ -1,3 +1,4 @@ +//@ min-llvm-version: 23 #![feature(coroutines, coroutine_trait, stmt_expr_attributes)] #![allow(unused_assignments)] From 809e1a27910a93bba6bb545ed8621281a7cf91d8 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 16 Jul 2026 10:10:59 +0200 Subject: [PATCH 04/12] Set LLVM_VERSIONED_DYLIB_NAME_ON_DARWIN=OFF We probably want to change this to align with Linux, but for now keep the old behavior. --- src/bootstrap/src/core/build_steps/llvm.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs index 0a13bf5d487b3..fae9b313c8364 100644 --- a/src/bootstrap/src/core/build_steps/llvm.rs +++ b/src/bootstrap/src/core/build_steps/llvm.rs @@ -409,6 +409,8 @@ impl Step for Llvm { // equally well everywhere. if builder.llvm_link_shared() { cfg.define("LLVM_LINK_LLVM_DYLIB", "ON"); + // Keep the pre-LLVM23 behavior for now. + cfg.define("LLVM_VERSIONED_DYLIB_NAME_ON_DARWIN", "OFF"); } if (target.starts_with("csky") From 533ccb485074b4816a43d6109c9da4fafa690c33 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 16 Jul 2026 10:18:14 +0200 Subject: [PATCH 05/12] Distribute llvm-project/libc It's a dependency of LLVM now. --- src/bootstrap/src/core/build_steps/dist.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index b74dd7dc3b987..fdc22577747da 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -1070,6 +1070,7 @@ fn copy_src_dirs( static LLVM_PROJECTS: &[&str] = &[ "llvm-project/clang", + "llvm-project/libc", "llvm-project/libunwind", "llvm-project/lld", "llvm-project/lldb", From 273b647f183e19c4e17a03f71929491e05d39b20 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Tue, 7 Jul 2026 16:42:27 +0000 Subject: [PATCH 06/12] x86_64-win: Return f128 on the stack, matching LLVM We can start matching the codegen introduced by LLVM at [1]. This alone isn't enough to make f128 functional on the platform because libcalls use the LLVM ABI. Current behavior originally introduced in RUST-128388. [1]: https://github.com/llvm/llvm-project/commit/aa47e59245e24edb6d0c7d5f91b3a1c5a7bb35f1 --- compiler/rustc_target/src/callconv/x86_win64.rs | 8 ++------ tests/assembly-llvm/x86_64-windows-float-abi.rs | 13 ++++--------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/compiler/rustc_target/src/callconv/x86_win64.rs b/compiler/rustc_target/src/callconv/x86_win64.rs index 4aaf34e56ce4b..8e6f50bc9e5c4 100644 --- a/compiler/rustc_target/src/callconv/x86_win64.rs +++ b/compiler/rustc_target/src/callconv/x86_win64.rs @@ -1,4 +1,4 @@ -use rustc_abi::{BackendRepr, Float, Integer, Primitive, Size, TyAbiInterface}; +use rustc_abi::{BackendRepr, Integer, Primitive, Size, TyAbiInterface}; use crate::callconv::{ArgAbi, FnAbi, Reg}; use crate::spec::{HasTargetSpec, RustcAbi}; @@ -35,11 +35,7 @@ where // FIXME(#134288): This may change for the `-msvc` targets in the future. a.cast_to(Reg::opaque_vector(Size::from_bits(128))); } - } else if a.layout.size.bytes() > 8 - && !matches!(scalar.primitive(), Primitive::Float(Float::F128)) - { - // Match what LLVM does for `f128` so that `compiler-builtins` builtins match up - // with what LLVM expects. + } else if a.layout.size.bytes() > 8 { a.make_indirect(); } else { a.extend_integer_width_to(32); diff --git a/tests/assembly-llvm/x86_64-windows-float-abi.rs b/tests/assembly-llvm/x86_64-windows-float-abi.rs index b6ab9995fdb3e..3b9d85b279ca7 100644 --- a/tests/assembly-llvm/x86_64-windows-float-abi.rs +++ b/tests/assembly-llvm/x86_64-windows-float-abi.rs @@ -3,9 +3,6 @@ //@ compile-flags: --target x86_64-pc-windows-msvc //@ needs-llvm-components: x86 //@ add-minicore -//@ revisions: LLVM22 LLVM23 -//@ [LLVM22] max-llvm-major-version: 22 -//@ [LLVM23] min-llvm-version: 23 #![feature(f16, f128)] #![feature(no_core)] @@ -40,12 +37,10 @@ pub extern "C" fn second_f64(_: f64, x: f64) -> f64 { } // CHECK-LABEL: second_f128 -// LLVM22: movaps (%rdx), %xmm0 -// LLVM22-NEXT: retq -// LLVM23: movq %rcx, %rax -// LLVM23-NEXT: movaps (%r8), %xmm0 -// LLVM23-NEXT: movaps %xmm0, (%rcx) -// LLVM23-NEXT: retq +// CHECK: movq %rcx, %rax +// CHECK-NEXT: movaps (%r8), %xmm0 +// CHECK-NEXT: movaps %xmm0, (%rcx) +// CHECK-NEXT: retq #[no_mangle] pub extern "C" fn second_f128(_: f128, x: f128) -> f128 { x From e75aa57510c9ef6d89a860201bbc48d0367404a6 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Fri, 10 Jul 2026 15:37:45 +0200 Subject: [PATCH 07/12] fix f128 libcall abi in the cranelift backend --- .../rustc_codegen_cranelift/src/abi/mod.rs | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/compiler/rustc_codegen_cranelift/src/abi/mod.rs b/compiler/rustc_codegen_cranelift/src/abi/mod.rs index 5e152af835613..d24064b793390 100644 --- a/compiler/rustc_codegen_cranelift/src/abi/mod.rs +++ b/compiler/rustc_codegen_cranelift/src/abi/mod.rs @@ -141,7 +141,11 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> { ) -> Cow<'_, [Value]> { // FIXME any way to reuse the abi adjustment code in rustc_target? - // Pass i128 arguments by-ref on Windows. + // Pass and return f128 indirectly on s390x and x86_64 Windows. + let indirect_f128 = self.tcx.sess.target.arch == Arch::S390x + || (self.tcx.sess.target.is_like_windows && self.tcx.sess.target.arch == Arch::X86_64); + + // Pass i128 arguments by-ref on s390x and Windows. let (params, args): (Vec<_>, Cow<'_, [_]>) = if self.tcx.sess.target.is_like_windows || self.tcx.sess.target.arch == Arch::S390x { let (params, args): (Vec<_>, Vec<_>) = params @@ -149,8 +153,7 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> { .zip(args) .map(|(param, &arg)| { if param.value_type == types::I128 - || (self.tcx.sess.target.arch == Arch::S390x - && param.value_type == types::F128) + || (indirect_f128 && param.value_type == types::F128) { let arg_ptr = self.create_stack_slot(16, 16); arg_ptr.store(self, arg, MemFlagsData::trusted()); @@ -166,19 +169,20 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> { (params, args.into()) }; - if self.tcx.sess.target.is_like_windows - && matches!(*returns, [AbiParam { value_type: types::I128, .. }]) - { + let ret_single_i128 = matches!(*returns, [AbiParam { value_type: types::I128, .. }]); + let ret_single_f128 = matches!(*returns, [AbiParam { value_type: types::F128, .. }]); + if ret_single_i128 && self.tcx.sess.target.is_like_windows { // Return i128 using the vector ABI on Windows returns[0].value_type = types::I64X2; let ret = self.lib_call_unadjusted(name, params, returns, &args)[0]; Cow::Owned(vec![codegen_bitcast(self, types::I128, ret)]) - } else if self.tcx.sess.target.arch == Arch::S390x - && matches!(*returns, [AbiParam { value_type: types::I128 | types::F128, .. }]) + } else if (ret_single_i128 && self.tcx.sess.target.arch == Arch::S390x) + || (ret_single_f128 && indirect_f128) { - // Return i128 and f128 using a return area pointer on s390x. + // Return x86_64 Windows f128 and s390x i128 indirectly (sret in LLVM terminology). + let ret_ty = returns[0].value_type; let mut params = params; let mut args = args.to_vec(); @@ -188,7 +192,7 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> { self.lib_call_unadjusted(name, params, vec![], &args); - Cow::Owned(vec![ret_ptr.load(self, types::I128, MemFlagsData::trusted())]) + Cow::Owned(vec![ret_ptr.load(self, ret_ty, MemFlagsData::trusted())]) } else { Cow::Borrowed(self.lib_call_unadjusted(name, params, returns, &args)) } From 81cd9a0dd06f55f57da25904d817b54c85043a15 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 20 Jul 2026 09:15:29 +0200 Subject: [PATCH 08/12] Disable RISCV on dist-i686-mingw --- src/ci/github-actions/jobs.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index a236effaa9b40..ce2a66693db99 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -742,9 +742,11 @@ auto: - name: dist-i686-mingw env: + # Disable RISCV target because building it OOMs. RUST_CONFIGURE_ARGS: >- --build=i686-pc-windows-gnu --enable-full-tools + --set llvm.targets=AArch64;AMDGPU;ARM;BPF;Hexagon;LoongArch;MSP430;Mips;NVPTX;PowerPC;Sparc;SystemZ;WebAssembly;X86 SCRIPT: python x.py dist bootstrap --include-default-paths DIST_REQUIRE_ALL_TOOLS: 1 CODEGEN_BACKENDS: llvm,cranelift From f76af74688cb50e8c3bc59f1c67a1864b0bfcb69 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 24 Jul 2026 10:13:34 +0200 Subject: [PATCH 09/12] Fetch GCC prerequisites from ci-mirror The GCC mirror now needs TLS 1.3. --- src/ci/docker/scripts/build-gcc.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ci/docker/scripts/build-gcc.sh b/src/ci/docker/scripts/build-gcc.sh index ab4cae21e0254..6a96b82d3f924 100755 --- a/src/ci/docker/scripts/build-gcc.sh +++ b/src/ci/docker/scripts/build-gcc.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +# ignore-tidy-file-linelength set -eux source shared.sh @@ -29,7 +30,7 @@ cd gcc-$GCC # the expression will need to be updated. That new URL is available at: # https://github.com/gcc-mirror/gcc/blob/6e6e3f144a33ae504149dc992453b4f6dea12fdb/contrib/download_prerequisites#L35 # -sed -i'' 's|ftp://gcc\.gnu\.org/|https://gcc.gnu.org/|g' ./contrib/download_prerequisites +sed -i'' 's|ftp://gcc\.gnu\.org/pub/gcc/infrastructure|https://ci-mirrors.rust-lang.org/rustc/gcc|g' ./contrib/download_prerequisites ./contrib/download_prerequisites mkdir ../gcc-build From 40a124927e3cafe6edc9cdfd87c8baf5b256faa3 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 25 Jul 2026 14:57:33 +0200 Subject: [PATCH 10/12] Build aeabi uread/uwrite builtins These are used for unaligned accesses since LLVM 23. --- library/compiler-builtins/compiler-builtins/build.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/compiler-builtins/compiler-builtins/build.rs b/library/compiler-builtins/compiler-builtins/build.rs index e86c784b5c631..8869add9f5ee4 100644 --- a/library/compiler-builtins/compiler-builtins/build.rs +++ b/library/compiler-builtins/compiler-builtins/build.rs @@ -362,6 +362,10 @@ mod c { ("__aeabi_div0", "arm/aeabi_div0.c"), ("__aeabi_drsub", "arm/aeabi_drsub.c"), ("__aeabi_frsub", "arm/aeabi_frsub.c"), + ("__aeabi_uread4", "arm/aeabi_uread4.S"), + ("__aeabi_uread8", "arm/aeabi_uread8.S"), + ("__aeabi_uwrite4", "arm/aeabi_uwrite4.S"), + ("__aeabi_uwrite8", "arm/aeabi_uwrite8.S"), ("__bswapdi2", "arm/bswapdi2.S"), ("__bswapsi2", "arm/bswapsi2.S"), ("__divmodsi4", "arm/divmodsi4.S"), From 60d1bbf6535b6d7205bf8ac4d7af9eedd33c983b Mon Sep 17 00:00:00 2001 From: Manuel Drehwald Date: Tue, 28 Jul 2026 06:27:19 -0400 Subject: [PATCH 11/12] Update gcc version used in the netbsd dist builder --- .../host-x86_64/dist-x86_64-netbsd/Dockerfile | 2 +- .../build-netbsd-toolchain.sh | 34 +++++++++---------- src/doc/rustc/src/platform-support/netbsd.md | 1 + 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/ci/docker/host-x86_64/dist-x86_64-netbsd/Dockerfile b/src/ci/docker/host-x86_64/dist-x86_64-netbsd/Dockerfile index 3bb2c7433e03c..efe0e2cdd9c0d 100644 --- a/src/ci/docker/host-x86_64/dist-x86_64-netbsd/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-x86_64-netbsd/Dockerfile @@ -6,7 +6,7 @@ RUN sh /scripts/cross-apt-packages.sh RUN apt-get install -y zlib1g-dev COPY host-x86_64/dist-x86_64-netbsd/build-netbsd-toolchain.sh /tmp/ -# GCC 10 changed the default to -fno-common, which causes errors with the NetBSD-9.0 sources like: +# GCC 10 changed the default to -fno-common, which causes errors with the NetBSD sources like: # /usr/bin/ld: buf.o:(.bss+0x0): multiple definition of `debug_file'; arch.o:(.bss+0x0): first defined here RUN env HOST_CFLAGS="-O -fcommon" /tmp/build-netbsd-toolchain.sh diff --git a/src/ci/docker/host-x86_64/dist-x86_64-netbsd/build-netbsd-toolchain.sh b/src/ci/docker/host-x86_64/dist-x86_64-netbsd/build-netbsd-toolchain.sh index c5e9054126e78..627e7ef69fb6f 100755 --- a/src/ci/docker/host-x86_64/dist-x86_64-netbsd/build-netbsd-toolchain.sh +++ b/src/ci/docker/host-x86_64/dist-x86_64-netbsd/build-netbsd-toolchain.sh @@ -41,24 +41,24 @@ cd netbsd mkdir -p /x-tools/x86_64-unknown-netbsd/sysroot -# Hashes come from https://cdn.netbsd.org/pub/NetBSD/security/hashes/NetBSD-9.0_hashes.asc -SRC_SHA=2c791ae009a6929c6fc893ec5df7e62910ee8207e0b2159d6937309c03efe175b6ae1e445829a13d041b6851334ad35c521f2fa03c97675d4a05f1fafe58ede0 -GNUSRC_SHA=3710085a73feecf6a843415271ec794c90146b03f6bbd30f07c9e0c79febf8995d557e40194f1e05db655e4f5ef2fae97563f8456fceaae65d4ea98857a83b1c -SHARESRC_SHA=f080776ed82c3ac5d6272dee39746f87897d8e6984996caf5bf6d87bf11d9c9e0c1ad5c437c21258bd278bb6fd76974946e878f548517885f71c556096231369 -SYSSRC_SHA=60b9ddf4cc6402256473e2e1eefeabd9001aa4e205208715ecc6d6fc3f5b400e469944580077271b8e80562a4c2f601249e69e07a504f46744e0c50335f1cbf1 -BASE_SHA=b5926b107cebf40c3c19b4f6cd039b610987dd7f819e7cdde3bd1e5230a856906e7930b15ab242d52ced9f0bda01d574be59488b8dbb95fa5df2987d0a70995f -COMP_SHA=38ea54f30d5fc2afea87e5096f06873e00182789e8ad9cec0cb3e9f7c538c1aa4779e63fd401a36ba02676158e83fa5c95e8e87898db59c1914fb206aecd82d2 - -SOURCE_URL=https://ci-mirrors.rust-lang.org/rustc/2025-03-14-netbsd-9.0-src -download src.tgz "$SOURCE_URL-src.tgz" "$SRC_SHA" tar xzf src.tgz -download gnusrc.tgz "$SOURCE_URL-gnusrc.tgz" "$GNUSRC_SHA" tar xzf gnusrc.tgz -download sharesrc.tgz "$SOURCE_URL-sharesrc.tgz" "$SHARESRC_SHA" tar xzf sharesrc.tgz -download syssrc.tgz "$SOURCE_URL-syssrc.tgz" "$SYSSRC_SHA" tar xzf syssrc.tgz - -BINARY_URL=https://ci-mirrors.rust-lang.org/rustc/2025-03-14-netbsd-9.0-amd64-binary -download base.tar.xz "$BINARY_URL-base.tar.xz" "$BASE_SHA" \ +# Hashes come from https://cdn.netbsd.org/pub/NetBSD/security/hashes/NetBSD-10.1_hashes.asc +SRC_SHA=6ae2053b4b75821238c0757d4f7258daece425de72524c616e07d3adee7c48d87422dd47d852a137918cec3dd3c0d339e372f4504dfe9f1bc5520011775bdb86 +GNUSRC_SHA=8a1c42030ba44eb2a0c7a5111187bc02e8f4d0860d8491b7863579e612333665c478625c37b01f08732e3cfd29ec31335f1db1274fd7dcfdc048b09d1b4bbb83 +SHARESRC_SHA=703eeb306fc0328cad7e6f0e100d2e7af194f82e613338f4611a7bcd5f6d773d8789e7ce03ec25268ec2b95ccdb97c3b4289a838a629716498b4d7c3184cb1ef +SYSSRC_SHA=766ac21f33cfe0e701dfedb894fa07f36d811da1a12e979181e8fca7af4e627852680ce42a7b29e97dd3e2e402ddf9ae7bfba60c8d7dc6b8a3354d8ce8c06926 +BASE_SHA=1c6b74cedd7fc92adfe51239808d41e63fc6eb9e9877c1101c1da515a38457278c7774e8fc3041d69cefc49821bad836cfdcc5147ad757f2f4a1f59f9e3862e5 +COMP_SHA=ea90d527d1475bd64d2b4c36d9d6ae53cb353cbc8c4feaa2b2bf006710282d2f47349a8aeeb64531f9da04268ed368ff2603c1e11a30bdfc8b2539ad73fe725f + +SOURCE_URL=https://cdn.netbsd.org/pub/NetBSD/NetBSD-10.1/source/sets +download src.tgz "$SOURCE_URL/src.tgz" "$SRC_SHA" tar xzf src.tgz +download gnusrc.tgz "$SOURCE_URL/gnusrc.tgz" "$GNUSRC_SHA" tar xzf gnusrc.tgz +download sharesrc.tgz "$SOURCE_URL/sharesrc.tgz" "$SHARESRC_SHA" tar xzf sharesrc.tgz +download syssrc.tgz "$SOURCE_URL/syssrc.tgz" "$SYSSRC_SHA" tar xzf syssrc.tgz + +BINARY_URL=https://cdn.netbsd.org/pub/NetBSD/NetBSD-10.1/amd64/binary/sets +download base.tar.xz "$BINARY_URL/base.tar.xz" "$BASE_SHA" \ tar xJf base.tar.xz -C /x-tools/x86_64-unknown-netbsd/sysroot ./usr/include ./usr/lib ./lib -download comp.tar.xz "$BINARY_URL-comp.tar.xz" "$COMP_SHA" \ +download comp.tar.xz "$BINARY_URL/comp.tar.xz" "$COMP_SHA" \ tar xJf comp.tar.xz -C /x-tools/x86_64-unknown-netbsd/sysroot ./usr/include ./usr/lib cd usr/src diff --git a/src/doc/rustc/src/platform-support/netbsd.md b/src/doc/rustc/src/platform-support/netbsd.md index b173bf82b4402..f7b57fff8a1f9 100644 --- a/src/doc/rustc/src/platform-support/netbsd.md +++ b/src/doc/rustc/src/platform-support/netbsd.md @@ -27,6 +27,7 @@ All use the "native" `stdc++` library which goes along with the natively supplied GNU C++ compiler for the given OS version. Many of the bootstraps are built for NetBSD 9.x, although some exceptions exist (some are built for NetBSD 8.x but also work on newer OS versions). +`x86_64-unknown-netbsd` is built for NetBSD 10.x to access a newer gcc. ## Target Maintainers From d5edb3a8336600d5668b18e53b6629d9492f1870 Mon Sep 17 00:00:00 2001 From: Manuel Drehwald Date: Tue, 28 Jul 2026 15:47:41 -0400 Subject: [PATCH 12/12] Update aarch64-msvc pauth test --- tests/run-make/pointer-auth-link-with-c/rmake.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/run-make/pointer-auth-link-with-c/rmake.rs b/tests/run-make/pointer-auth-link-with-c/rmake.rs index 1ac68c95559c6..f126b303ca816 100644 --- a/tests/run-make/pointer-auth-link-with-c/rmake.rs +++ b/tests/run-make/pointer-auth-link-with-c/rmake.rs @@ -15,9 +15,16 @@ use run_make_support::{build_native_static_lib, cc, is_windows_msvc, llvm_ar, ru fn main() { build_native_static_lib("test"); + + let branch_protection = if is_windows_msvc() { + "-Zbranch-protection=bti,gcs,pac-ret,leaf,b-key" + } else { + "-Zbranch-protection=bti,gcs,pac-ret,leaf" + }; + rustc() .arg("-Cunsafe-allow-abi-mismatch=branch-protection") - .arg("-Zbranch-protection=bti,gcs,pac-ret,leaf") + .arg(branch_protection) .input("test.rs") .run(); run("test"); @@ -31,7 +38,7 @@ fn main() { llvm_ar().obj_to_ar().output_input("libtest.a", &obj_file).run(); rustc() .arg("-Cunsafe-allow-abi-mismatch=branch-protection") - .arg("-Zbranch-protection=bti,gcs,pac-ret,leaf") + .arg(branch_protection) .input("test.rs") .run(); run("test");