diff options
Diffstat (limited to 'dev-lang/rust/files')
21 files changed, 0 insertions, 1416 deletions
diff --git a/dev-lang/rust/files/1.62.1-musl-dynamic-linking.patch b/dev-lang/rust/files/1.62.1-musl-dynamic-linking.patch deleted file mode 100644 index fd56396d127e..000000000000 --- a/dev-lang/rust/files/1.62.1-musl-dynamic-linking.patch +++ /dev/null @@ -1,25 +0,0 @@ -From e42709c46647dab342b826d30324f3e6e5590e00 Mon Sep 17 00:00:00 2001 -From: Jory Pratt <anarchy@gentoo.org> -Date: Tue, 2 Aug 2022 18:32:53 -0500 -Subject: [PATCH] Enable dynamic linking by default for musl - -Signed-off-by: Jory Pratt <anarchy@gentoo.org> ---- - compiler/rustc_target/src/spec/linux_musl_base.rs | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/compiler/rustc_target/src/spec/linux_musl_base.rs b/compiler/rustc_target/src/spec/linux_musl_base.rs -index 207a87ab0..8a5a43363 100644 ---- a/compiler/rustc_target/src/spec/linux_musl_base.rs -+++ b/compiler/rustc_target/src/spec/linux_musl_base.rs -@@ -10,7 +10,7 @@ pub fn opts() -> TargetOptions { - base.crt_objects_fallback = Some(CrtObjectsFallback::Musl); - - // These targets statically link libc by default -- base.crt_static_default = true; -+ base.crt_static_default = false; - - base - } --- -2.35.1 diff --git a/dev-lang/rust/files/1.67.0-doc-wasm.patch b/dev-lang/rust/files/1.67.0-doc-wasm.patch deleted file mode 100644 index 06011deb795b..000000000000 --- a/dev-lang/rust/files/1.67.0-doc-wasm.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 92aa5f6b272bcdc020a34f8d90f9ef851b5b4504 Mon Sep 17 00:00:00 2001 -From: John Millikin <john@john-millikin.com> -Date: Mon, 9 Jan 2023 13:54:21 +0900 -Subject: [PATCH] Disable `linux_ext` in wasm32 and fortanix rustdoc builds. - -The `std::os::unix` module is stubbed out when building docs for these -target platforms. The introduction of Linux-specific extension traits -caused `std::os::net` to depend on sub-modules of `std::os::unix`, -which broke rustdoc for the `wasm32-unknown-unknown` target. - -Adding an additional `#[cfg]` guard solves that rustdoc failure by -not declaring `linux_ext` on targets with a stubbed `std::os::unix`. ---- - library/std/src/os/net/mod.rs | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/library/std/src/os/net/mod.rs b/library/std/src/os/net/mod.rs -index 5ec267c41e97c..b7046dd7c598c 100644 ---- a/library/std/src/os/net/mod.rs -+++ b/library/std/src/os/net/mod.rs -@@ -1,4 +1,13 @@ - //! OS-specific networking functionality. - -+// See cfg macros in `library/std/src/os/mod.rs` for why these platforms must -+// be special-cased during rustdoc generation. -+#[cfg(not(all( -+ doc, -+ any( -+ all(target_arch = "wasm32", not(target_os = "wasi")), -+ all(target_vendor = "fortanix", target_env = "sgx") -+ ) -+)))] - #[cfg(any(target_os = "linux", target_os = "android", doc))] - pub(super) mod linux_ext; diff --git a/dev-lang/rust/files/1.70.0-ignore-broken-and-non-applicable-tests.patch b/dev-lang/rust/files/1.70.0-ignore-broken-and-non-applicable-tests.patch deleted file mode 100644 index 2e12c7820550..000000000000 --- a/dev-lang/rust/files/1.70.0-ignore-broken-and-non-applicable-tests.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 1879d1d1a284bf51c752e47db284ce22701ed5d0 Mon Sep 17 00:00:00 2001 -From: Samuel Holland <samuel@sholland.org> -Date: Sun, 16 Sep 2018 16:38:48 +0000 -Subject: [PATCH 12/15] Ignore broken and non-applicable tests - -c-link-to-rust-va-list-fn: unstable feature, broken on aarch64, #56475 -env-funky-keys: can't handle LD_PRELOAD (e.g. sandbox) -long-linker-command-lines: takes >10 minutes to run (but still passes) -simd-intrinsic-generic-bitmask.rs: broken on BE, #59356 -sparc-struct-abi: no sparc target -sysroot-crates-are-unstable: can't run rustc without RPATH ---- - test/ui/env-funky-keys.rs | 1 + - 6 files changed, 10 insertions(+) - -diff --git a/tests/ui/env-funky-keys.rs b/tests/ui/env-funky-keys.rs -index c5c824ac58d..f3fe047a79c 100644 ---- a/tests/ui/env-funky-keys.rs -+++ b/tests/ui/env-funky-keys.rs -@@ -1,6 +1,7 @@ - // run-pass - // Ignore this test on Android, because it segfaults there. - -+// ignore-test - // ignore-android - // ignore-windows - // ignore-cloudabi no execve --- -2.24.1 - diff --git a/dev-lang/rust/files/1.74.1-cross-compile-libz.patch b/dev-lang/rust/files/1.74.1-cross-compile-libz.patch deleted file mode 100644 index 98cec093d006..000000000000 --- a/dev-lang/rust/files/1.74.1-cross-compile-libz.patch +++ /dev/null @@ -1,17 +0,0 @@ -https://paste.sr.ht/~kchibisov/682321e0fd4a3ece4a4b7b71591896f5cd3cdb22 -https://github.com/gentoo/gentoo/pull/35246#discussion_r1484525497 - ---- a/compiler/rustc_llvm/build.rs -+++ b/compiler/rustc_llvm/build.rs -@@ -237,10 +237,7 @@ fn main() { - // of llvm-config, not the target that we're attempting to link. - let mut cmd = Command::new(&llvm_config); - cmd.arg(llvm_link_arg).arg("--libs"); -- -- if !is_crossed { -- cmd.arg("--system-libs"); -- } -+ cmd.arg("--system-libs"); - - if (target.starts_with("arm") && !target.contains("freebsd")) - || target.starts_with("mips-") diff --git a/dev-lang/rust/files/1.75.0-handle-vendored-sources.patch b/dev-lang/rust/files/1.75.0-handle-vendored-sources.patch deleted file mode 100644 index c68ceba15e82..000000000000 --- a/dev-lang/rust/files/1.75.0-handle-vendored-sources.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 4b7e0a0b56aa2446e670dfd6558380a1039a86aa Mon Sep 17 00:00:00 2001 -From: Arlo Siemsen <arsiem@microsoft.com> -Date: Thu, 4 Jan 2024 11:40:56 -0600 -Subject: [PATCH] Handle vendored sources when remapping paths - -Signed-off-by: Randy Barlow <randy@electronsweatshop.com> ---- - src/bootstrap/src/core/builder.rs | 19 ++++++++++++------- - 1 file changed, 12 insertions(+), 7 deletions(-) - -diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs -index 4e20babc55a..3770d0687b2 100644 ---- a/src/bootstrap/src/core/builder.rs -+++ b/src/bootstrap/src/core/builder.rs -@@ -1799,15 +1799,20 @@ pub fn cargo( - } - - if self.config.rust_remap_debuginfo { -- // FIXME: handle vendored sources -- let registry_src = t!(home::cargo_home()).join("registry").join("src"); - let mut env_var = OsString::new(); -- for entry in t!(std::fs::read_dir(registry_src)) { -- if !env_var.is_empty() { -- env_var.push("\t"); -- } -- env_var.push(t!(entry).path()); -+ if self.config.vendor { -+ let vendor = self.build.src.join("vendor"); -+ env_var.push(vendor); - env_var.push("=/rust/deps"); -+ } else { -+ let registry_src = t!(home::cargo_home()).join("registry").join("src"); -+ for entry in t!(std::fs::read_dir(registry_src)) { -+ if !env_var.is_empty() { -+ env_var.push("\t"); -+ } -+ env_var.push(t!(entry).path()); -+ env_var.push("=/rust/deps"); -+ } - } - cargo.env("RUSTC_CARGO_REGISTRY_SRC_TO_REMAP", env_var); - } --- -2.43.0 - diff --git a/dev-lang/rust/files/1.75.0-musl-dynamic-linking.patch b/dev-lang/rust/files/1.75.0-musl-dynamic-linking.patch deleted file mode 100644 index 7dc34f8ad6b8..000000000000 --- a/dev-lang/rust/files/1.75.0-musl-dynamic-linking.patch +++ /dev/null @@ -1,19 +0,0 @@ -From e42709c46647dab342b826d30324f3e6e5590e00 Mon Sep 17 00:00:00 2001 -From: Jory Pratt <anarchy@gentoo.org> -Date: Tue, 2 Aug 2022 18:32:53 -0500 -Subject: [PATCH] Enable dynamic linking by default for musl - -Signed-off-by: Jory Pratt <anarchy@gentoo.org> ---- a/compiler/rustc_target/src/spec/base/linux_musl.rs -+++ b/compiler/rustc_target/src/spec/base/linux_musl.rs -@@ -10,7 +10,7 @@ pub fn opts() -> TargetOptions { - base.crt_objects_fallback = Some(CrtObjectsFallback::Musl); - - // These targets statically link libc by default -- base.crt_static_default = true; -+ base.crt_static_default = false; - - base - } --- -2.35.1 diff --git a/dev-lang/rust/files/1.76.0-loong-code-model.patch b/dev-lang/rust/files/1.76.0-loong-code-model.patch deleted file mode 100644 index 02bfeca55b1d..000000000000 --- a/dev-lang/rust/files/1.76.0-loong-code-model.patch +++ /dev/null @@ -1,73 +0,0 @@ -https://github.com/rust-lang/rust/pull/120661 -From: WANG Xuerui <xen0n@gentoo.org> -Date: Mon, 5 Feb 2024 13:18:32 +0800 -Subject: [PATCH] target: default to the medium code model on LoongArch targets -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The Rust LoongArch targets have been using the default LLVM code model -so far, which is "small" in LLVM-speak and "normal" in LoongArch-speak. -As described in the "Code Model" section of LoongArch ELF psABI spec -v20231219 [1], one can only make function calls as far as ±128MiB with -the "normal" code model; this is insufficient for very large software -containing Rust components that needs to be linked into the big text -section, such as Chromium. - -Because: - -* we do not want to ask users to recompile std if they are to build - such software, -* objects compiled with larger code models can be linked with those - with smaller code models without problems, and -* the "medium" code model is comparable to the "small"/"normal" one - performance-wise (same data access pattern; each function call - becomes 2-insn long and indirect, but this may be relaxed back into - the direct 1-insn form in a future LLVM version), but is able to - perform function calls within ±128GiB, - -it is better to just switch the targets to the "medium" code model, -which is also "medium" in LLVM-speak. - -[1]: https://github.com/loongson/la-abi-specs/blob/v2.30/laelf.adoc#code-models ---- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs -+++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs -@@ -1,4 +1,4 @@ --use crate::spec::{base, Target, TargetOptions}; -+use crate::spec::{base, CodeModel, Target, TargetOptions}; - - pub fn target() -> Target { - Target { -@@ -7,6 +7,7 @@ pub fn target() -> Target { - data_layout: "e-m:e-p:64:64-i64:64-i128:128-n64-S128".into(), - arch: "loongarch64".into(), - options: TargetOptions { -+ code_model: Some(CodeModel::Medium), - cpu: "generic".into(), - features: "+f,+d".into(), - llvm_abiname: "lp64d".into(), ---- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs -+++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs -@@ -16,7 +16,7 @@ pub fn target() -> Target { - max_atomic_width: Some(64), - relocation_model: RelocModel::Static, - panic_strategy: PanicStrategy::Abort, -- code_model: Some(CodeModel::Small), -+ code_model: Some(CodeModel::Medium), - ..Default::default() - }, - } ---- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs -+++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs -@@ -17,7 +17,7 @@ pub fn target() -> Target { - max_atomic_width: Some(64), - relocation_model: RelocModel::Static, - panic_strategy: PanicStrategy::Abort, -- code_model: Some(CodeModel::Small), -+ code_model: Some(CodeModel::Medium), - ..Default::default() - }, - } --- -2.43.0 - diff --git a/dev-lang/rust/files/1.78.0-ignore-broken-and-non-applicable-tests.patch b/dev-lang/rust/files/1.78.0-ignore-broken-and-non-applicable-tests.patch deleted file mode 100644 index 610e5d04ea2b..000000000000 --- a/dev-lang/rust/files/1.78.0-ignore-broken-and-non-applicable-tests.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 1879d1d1a284bf51c752e47db284ce22701ed5d0 Mon Sep 17 00:00:00 2001 -From: Samuel Holland <samuel@sholland.org> -Date: Sun, 16 Sep 2018 16:38:48 +0000 -Subject: [PATCH 12/15] Ignore broken and non-applicable tests - -c-link-to-rust-va-list-fn: unstable feature, broken on aarch64, #56475 -env-funky-keys: can't handle LD_PRELOAD (e.g. sandbox) -long-linker-command-lines: takes >10 minutes to run (but still passes) -simd-intrinsic-generic-bitmask.rs: broken on BE, #59356 -sparc-struct-abi: no sparc target -sysroot-crates-are-unstable: can't run rustc without RPATH ---- - test/ui/env-funky-keys.rs | 1 + - 6 files changed, 10 insertions(+) - -diff --git a/tests/ui/env-funky-keys.rs b/tests/ui/env-funky-keys.rs -index c5c824ac58d..f3fe047a79c 100644 ---- a/tests/ui/env-funky-keys.rs -+++ b/tests/ui/env-funky-keys.rs -@@ -1,6 +1,7 @@ - //@ run-pass - //@ Ignore this test on Android, because it segfaults there. - -+//@ ignore-test - //@ ignore-android - //@ ignore-windows - //@ ignore-cloudabi no execve --- -2.24.1 - diff --git a/dev-lang/rust/files/1.78.0-musl-dynamic-linking.patch b/dev-lang/rust/files/1.78.0-musl-dynamic-linking.patch deleted file mode 100644 index 25a281ceaaaf..000000000000 --- a/dev-lang/rust/files/1.78.0-musl-dynamic-linking.patch +++ /dev/null @@ -1,19 +0,0 @@ -From e42709c46647dab342b826d30324f3e6e5590e00 Mon Sep 17 00:00:00 2001 -From: Jory Pratt <anarchy@gentoo.org> -Date: Tue, 2 Aug 2022 18:32:53 -0500 -Subject: [PATCH] Enable dynamic linking by default for musl - -Signed-off-by: Jory Pratt <anarchy@gentoo.org> ---- a/compiler/rustc_target/src/spec/base/linux_musl.rs -+++ b/compiler/rustc_target/src/spec/base/linux_musl.rs -@@ -10,7 +10,7 @@ pub fn opts() -> TargetOptions { - base.link_self_contained = LinkSelfContainedDefault::InferredForMusl; - - // These targets statically link libc by default -- base.crt_static_default = true; -+ base.crt_static_default = false; - - base - } --- -2.35.1 diff --git a/dev-lang/rust/files/1.79.0-revert-8c40426.patch b/dev-lang/rust/files/1.79.0-revert-8c40426.patch deleted file mode 100644 index 583f4001c9cb..000000000000 --- a/dev-lang/rust/files/1.79.0-revert-8c40426.patch +++ /dev/null @@ -1,18 +0,0 @@ -This reverts commit 8c40426051a667673cdac9975f84cb6acd4e245f. - -https://bugs.gentoo.org/933382 - -diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs -index d4473e24039..58f351d17fa 100644 ---- a/src/bootstrap/src/core/build_steps/llvm.rs -+++ b/src/bootstrap/src/core/build_steps/llvm.rs -@@ -724,8 +724,7 @@ fn configure_cmake( - } - } - cfg.define("CMAKE_C_COMPILER", sanitize_cc(&cc)) -- .define("CMAKE_CXX_COMPILER", sanitize_cc(&cxx)) -- .define("CMAKE_ASM_COMPILER", sanitize_cc(&cc)); -+ .define("CMAKE_CXX_COMPILER", sanitize_cc(&cxx)); - } - - cfg.build_arg("-j").build_arg(builder.jobs().to_string()); diff --git a/dev-lang/rust/files/1.81.0-backport-bug937164.patch b/dev-lang/rust/files/1.81.0-backport-bug937164.patch deleted file mode 100644 index a6e887db34ab..000000000000 --- a/dev-lang/rust/files/1.81.0-backport-bug937164.patch +++ /dev/null @@ -1,15 +0,0 @@ -https://bugs.gentoo.org/937525 -https://bugs.gentoo.org/937164 - -Unnecessary on 19+ because 2222fddfc0a2ff02036542511597839856289094 adds -SmallVector and SmallVector is fixed by another patch. ---- a/src/llvm-project/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h -+++ b/src/llvm-project/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h -@@ -13,6 +13,7 @@ - #ifndef LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCTARGETDESC_H - #define LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCTARGETDESC_H - -+#include <cstdint> - #include <memory> - #include <string> - diff --git a/dev-lang/rust/files/1.81.0-backport-llvm-pr101761.patch b/dev-lang/rust/files/1.81.0-backport-llvm-pr101761.patch deleted file mode 100644 index fccb22d57ce4..000000000000 --- a/dev-lang/rust/files/1.81.0-backport-llvm-pr101761.patch +++ /dev/null @@ -1,30 +0,0 @@ -https://bugs.gentoo.org/937525 -https://bugs.gentoo.org/937164 -https://github.com/llvm/llvm-project/commit/7e44305041d96b064c197216b931ae3917a34ac1 -https://github.com/llvm/llvm-project/pull/101761 - -From 7e44305041d96b064c197216b931ae3917a34ac1 Mon Sep 17 00:00:00 2001 -From: Sam James <sam@gentoo.org> -Date: Fri, 2 Aug 2024 23:07:21 +0100 -Subject: [PATCH] [ADT] Add `<cstdint>` to SmallVector (#101761) - -SmallVector uses `uint32_t`, `uint64_t` without including `<cstdint>` -which fails to build w/ GCC 15 after a change in libstdc++ [0] - -[0] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=3a817a4a5a6d94da9127af3be9f84a74e3076ee2 ---- - src/llvm-project/llvm/include/llvm/ADT/SmallVector.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/llvm-project/llvm/include/llvm/ADT/SmallVector.h b/src/llvm-project/llvm/include/llvm/ADT/SmallVector.h -index 09676d792dfebd..17444147b102a9 100644 ---- a/src/llvm-project/llvm/include/llvm/ADT/SmallVector.h -+++ b/src/llvm-project/llvm/include/llvm/ADT/SmallVector.h -@@ -19,6 +19,7 @@ - #include <algorithm> - #include <cassert> - #include <cstddef> -+#include <cstdint> - #include <cstdlib> - #include <cstring> - #include <functional> diff --git a/dev-lang/rust/files/1.81.0-backport-llvm-pr101766.patch b/dev-lang/rust/files/1.81.0-backport-llvm-pr101766.patch deleted file mode 100644 index fdecdaf66a95..000000000000 --- a/dev-lang/rust/files/1.81.0-backport-llvm-pr101766.patch +++ /dev/null @@ -1,29 +0,0 @@ -https://bugs.gentoo.org/937525 -https://bugs.gentoo.org/937164 -https://github.com/llvm/llvm-project/pull/101766 - -From 5b69d0cf697f0d78406a5a7ed18eaa4f57a0580a Mon Sep 17 00:00:00 2001 -From: Sam James <sam@gentoo.org> -Date: Fri, 2 Aug 2024 23:38:55 +0100 -Subject: [PATCH] [AMDGPU] Include `<cstdint>` in AMDGPUMCTargetDesc - -createAMDGPUELFObjectWriter uses `uint8_t` without including `<cstdint>` -which fails to build w/ GCC 15 after a change in libstdc++ [0]. - -[0] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=3a817a4a5a6d94da9127af3be9f84a74e3076ee2 ---- - src/llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h b/src/llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h -index 3ef00f75735b0d..879dbe1b279b18 100644 ---- a/src/llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h -+++ b/src/llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h -@@ -15,6 +15,7 @@ - #ifndef LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUMCTARGETDESC_H - #define LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUMCTARGETDESC_H - -+#include <cstdint> - #include <memory> - - namespace llvm { diff --git a/dev-lang/rust/files/1.82.0-dwarf-llvm-assertion.patch b/dev-lang/rust/files/1.82.0-dwarf-llvm-assertion.patch deleted file mode 100644 index 8c99c9aacc90..000000000000 --- a/dev-lang/rust/files/1.82.0-dwarf-llvm-assertion.patch +++ /dev/null @@ -1,247 +0,0 @@ -https://bugs.gentoo.org/942013 -https://bugs.gentoo.org/942884 -https://github.com/rust-lang/rust/issues/131944 -https://github.com/rust-lang/rust/pull/132613 - -From 1dc106121b62562ead6e7d612fa136dc4b35cd5d Mon Sep 17 00:00:00 2001 -From: Kyle Huey <khuey@kylehuey.com> -Date: Mon, 4 Nov 2024 11:38:14 -0800 -Subject: [PATCH] Add discriminators to DILocations when multiple functions are - inlined into a single point. - -LLVM does not expect to ever see multiple dbg_declares for the same variable at the same -location with different values. proc-macros make it possible for arbitrary code, -including multiple calls that get inlined, to happen at any given location in the source -code. Add discriminators when that happens so these locations are different to LLVM. - -This may interfere with the AddDiscriminators pass in LLVM, which is added by the -unstable flag -Zdebug-info-for-profiling. - -Fixes #131944 ---- - .../src/debuginfo/create_scope_map.rs | 60 ++++++++++++++++++- - compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 4 ++ - .../rustc_llvm/llvm-wrapper/RustWrapper.cpp | 8 +++ - .../auxiliary/macro_def.rs | 11 ++++ - .../mir_inlined_twice_var_locs.rs | 53 ++++++++++++++++ - 5 files changed, 133 insertions(+), 3 deletions(-) - create mode 100644 tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs - create mode 100644 tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs - -diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs b/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs -index ac6c2fb1b83a6..0f1909486ec7e 100644 ---- a/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs -+++ b/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs -@@ -1,11 +1,15 @@ -+use std::collections::hash_map::Entry; -+ - use rustc_codegen_ssa::mir::debuginfo::{DebugScope, FunctionDebugContext}; - use rustc_codegen_ssa::traits::*; -+use rustc_data_structures::fx::FxHashMap; - use rustc_index::bit_set::BitSet; - use rustc_index::Idx; - use rustc_middle::mir::{Body, SourceScope}; - use rustc_middle::ty::layout::FnAbiOf; - use rustc_middle::ty::{self, Instance}; - use rustc_session::config::DebugInfo; -+use rustc_span::BytePos; - - use super::metadata::file_metadata; - use super::utils::DIB; -@@ -37,10 +41,20 @@ pub(crate) fn compute_mir_scopes<'ll, 'tcx>( - None - }; - let mut instantiated = BitSet::new_empty(mir.source_scopes.len()); -+ let mut discriminators = FxHashMap::default(); - // Instantiate all scopes. - for idx in 0..mir.source_scopes.len() { - let scope = SourceScope::new(idx); -- make_mir_scope(cx, instance, mir, &variables, debug_context, &mut instantiated, scope); -+ make_mir_scope( -+ cx, -+ instance, -+ mir, -+ &variables, -+ debug_context, -+ &mut instantiated, -+ &mut discriminators, -+ scope, -+ ); - } - assert!(instantiated.count() == mir.source_scopes.len()); - } -@@ -52,6 +66,7 @@ fn make_mir_scope<'ll, 'tcx>( - variables: &Option<BitSet<SourceScope>>, - debug_context: &mut FunctionDebugContext<'tcx, &'ll DIScope, &'ll DILocation>, - instantiated: &mut BitSet<SourceScope>, -+ discriminators: &mut FxHashMap<BytePos, u32>, - scope: SourceScope, - ) { - if instantiated.contains(scope) { -@@ -60,7 +75,16 @@ fn make_mir_scope<'ll, 'tcx>( - - let scope_data = &mir.source_scopes[scope]; - let parent_scope = if let Some(parent) = scope_data.parent_scope { -- make_mir_scope(cx, instance, mir, variables, debug_context, instantiated, parent); -+ make_mir_scope( -+ cx, -+ instance, -+ mir, -+ variables, -+ debug_context, -+ instantiated, -+ discriminators, -+ parent, -+ ); - debug_context.scopes[parent] - } else { - // The root is the function itself. -@@ -117,7 +141,37 @@ fn make_mir_scope<'ll, 'tcx>( - // FIXME(eddyb) this doesn't account for the macro-related - // `Span` fixups that `rustc_codegen_ssa::mir::debuginfo` does. - let callsite_scope = parent_scope.adjust_dbg_scope_for_span(cx, callsite_span); -- cx.dbg_loc(callsite_scope, parent_scope.inlined_at, callsite_span) -+ let loc = cx.dbg_loc(callsite_scope, parent_scope.inlined_at, callsite_span); -+ -+ // NB: In order to produce proper debug info for variables (particularly -+ // arguments) in multiply-inline functions, LLVM expects to see a single -+ // DILocalVariable with multiple different DILocations in the IR. While -+ // the source information for each DILocation would be identical, their -+ // inlinedAt attributes will be unique to the particular callsite. -+ // -+ // We generate DILocations here based on the callsite's location in the -+ // source code. A single location in the source code usually can't -+ // produce multiple distinct calls so this mostly works, until -+ // proc-macros get involved. A proc-macro can generate multiple calls -+ // at the same span, which breaks the assumption that we're going to -+ // produce a unique DILocation for every scope we process here. We -+ // have to explicitly add discriminators if we see inlines into the -+ // same source code location. -+ // -+ // Note further that we can't key this hashtable on the span itself, -+ // because these spans could have distinct SyntaxContexts. We have -+ // to key on exactly what we're giving to LLVM. -+ match discriminators.entry(callsite_span.lo()) { -+ Entry::Occupied(mut o) => { -+ *o.get_mut() += 1; -+ unsafe { llvm::LLVMRustDILocationCloneWithBaseDiscriminator(loc, *o.get()) } -+ .expect("Failed to encode discriminator in DILocation") -+ } -+ Entry::Vacant(v) => { -+ v.insert(0); -+ loc -+ } -+ } - }); - - debug_context.scopes[scope] = DebugScope { -diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs -index 3d2e270a3868e..75a5ec44c2285 100644 ---- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs -+++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs -@@ -2174,6 +2174,10 @@ unsafe extern "C" { - Scope: &'a DIScope, - InlinedAt: Option<&'a DILocation>, - ) -> &'a DILocation; -+ pub fn LLVMRustDILocationCloneWithBaseDiscriminator<'a>( -+ Location: &'a DILocation, -+ BD: c_uint, -+ ) -> Option<&'a DILocation>; - pub fn LLVMRustDIBuilderCreateOpDeref() -> u64; - pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> u64; - pub fn LLVMRustDIBuilderCreateOpLLVMFragment() -> u64; -diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp -index 9330c83b7f230..cd70c3f266920 100644 ---- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp -+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp -@@ -1305,6 +1305,14 @@ LLVMRustDIBuilderCreateDebugLocation(unsigned Line, unsigned Column, - return wrap(Loc); - } - -+extern "C" LLVMMetadataRef -+LLVMRustDILocationCloneWithBaseDiscriminator(LLVMMetadataRef Location, -+ unsigned BD) { -+ DILocation *Loc = unwrapDIPtr<DILocation>(Location); -+ auto NewLoc = Loc->cloneWithBaseDiscriminator(BD); -+ return wrap(NewLoc.has_value() ? NewLoc.value() : nullptr); -+} -+ - extern "C" uint64_t LLVMRustDIBuilderCreateOpDeref() { - return dwarf::DW_OP_deref; - } -diff --git a/tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs b/tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs -new file mode 100644 -index 0000000000000..159ecfd09743d ---- /dev/null -+++ b/tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs -@@ -0,0 +1,11 @@ -+//@ force-host -+//@ no-prefer-dynamic -+#![crate_type = "proc-macro"] -+ -+extern crate proc_macro; -+use proc_macro::*; -+ -+#[proc_macro] -+pub fn square_twice(_item: TokenStream) -> TokenStream { -+ "(square(env::vars().count() as i32), square(env::vars().count() as i32))".parse().unwrap() -+} -diff --git a/tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs b/tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs -new file mode 100644 -index 0000000000000..c3858044c0c9f ---- /dev/null -+++ b/tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs -@@ -0,0 +1,53 @@ -+//@ min-llvm-version: 19 -+//@ compile-flags: -Cdebuginfo=2 -Copt-level=0 -Zmir-enable-passes=+Inline -+// MSVC is different because of the individual allocas. -+//@ ignore-msvc -+ -+//@ aux-build:macro_def.rs -+ -+// Find the variable. -+// CHECK-DAG: ![[#var_dbg:]] = !DILocalVariable(name: "n",{{( arg: 1,)?}} scope: ![[#var_scope:]] -+ -+// Find both dbg_declares. These will proceed the variable metadata, of course, so we're looking -+// backwards. -+// CHECK-DAG: dbg_declare(ptr %n.dbg.spill{{[0-9]}}, ![[#var_dbg]], !DIExpression(), ![[#var_loc2:]]) -+// CHECK-DAG: dbg_declare(ptr %n.dbg.spill, ![[#var_dbg]], !DIExpression(), ![[#var_loc1:]]) -+ -+// Find the first location definition, looking forwards again. -+// CHECK: ![[#var_loc1]] = !DILocation -+// CHECK-SAME: scope: ![[#var_scope:]], inlinedAt: ![[#var_inlinedAt1:]] -+ -+// Find the first location's inlinedAt -+// NB: If we fail here it's *probably* because we failed to produce two -+// different locations and ended up reusing an earlier one. -+// CHECK: ![[#var_inlinedAt1]] = !DILocation -+// CHECK-SAME: scope: ![[var_inlinedAt1_scope:]] -+ -+// Find the second location definition, still looking forwards. -+// NB: If we failed to produce two different locations, the test will -+// definitely fail by this point (if it hasn't already) because we won't -+// be able to find the same line again. -+// CHECK: ![[#var_loc2]] = !DILocation -+// CHECK-SAME: scope: ![[#var_scope]], inlinedAt: ![[#var_inlinedAt2:]] -+ -+// Find the second location's inlinedAt. -+// CHECK: ![[#var_inlinedAt2]] = !DILocation -+// CHECK-SAME: scope: ![[#var_inlinedAt2_scope:]] -+ -+// Finally, check that a discriminator was emitted for the second scope. -+// FIXMEkhuey ideally we would check that *either* scope has a discriminator -+// but I don't know that it's possible to check that with FileCheck. -+// CHECK: ![[#var_inlinedAt2_scope]] = !DILexicalBlockFile -+// CHECK-SAME: discriminator: [[#]] -+extern crate macro_def; -+ -+use std::env; -+ -+fn square(n: i32) -> i32 { -+ n * n -+} -+ -+fn main() { -+ let (z1, z2) = macro_def::square_twice!(); -+ println!("{z1} == {z2}"); -+} diff --git a/dev-lang/rust/files/1.83.0-cross-compile-libz.patch b/dev-lang/rust/files/1.83.0-cross-compile-libz.patch deleted file mode 100644 index 12844fd7efc7..000000000000 --- a/dev-lang/rust/files/1.83.0-cross-compile-libz.patch +++ /dev/null @@ -1,21 +0,0 @@ -https://paste.sr.ht/~kchibisov/682321e0fd4a3ece4a4b7b71591896f5cd3cdb22 -https://github.com/gentoo/gentoo/pull/35246#discussion_r1484525497 - -diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs -index f606fa483ca..8a2e1c40e8b 100644 ---- a/compiler/rustc_llvm/build.rs -+++ b/compiler/rustc_llvm/build.rs -@@ -220,12 +220,7 @@ - let mut cmd = Command::new(&llvm_config); - cmd.arg(llvm_link_arg).arg("--libs"); - -- // Don't link system libs if cross-compiling unless targetting Windows. -- // On Windows system DLLs aren't linked directly, instead import libraries are used. -- // These import libraries are independent of the host. -- if !is_crossed || target.contains("windows") { -- cmd.arg("--system-libs"); -- } -+ cmd.arg("--system-libs"); - - // We need libkstat for getHostCPUName on SPARC builds. - // See also: https://github.com/llvm/llvm-project/issues/64186 diff --git a/dev-lang/rust/files/1.83.0-dwarf-llvm-assertion.patch b/dev-lang/rust/files/1.83.0-dwarf-llvm-assertion.patch deleted file mode 100644 index 64d00ac0aaaf..000000000000 --- a/dev-lang/rust/files/1.83.0-dwarf-llvm-assertion.patch +++ /dev/null @@ -1,242 +0,0 @@ -From 1dc106121b62562ead6e7d612fa136dc4b35cd5d Mon Sep 17 00:00:00 2001 -From: Kyle Huey <khuey@kylehuey.com> -Date: Mon, 4 Nov 2024 11:38:14 -0800 -Subject: [PATCH] Add discriminators to DILocations when multiple functions are - inlined into a single point. - -LLVM does not expect to ever see multiple dbg_declares for the same variable at the same -location with different values. proc-macros make it possible for arbitrary code, -including multiple calls that get inlined, to happen at any given location in the source -code. Add discriminators when that happens so |
