summaryrefslogtreecommitdiff
path: root/dev-lang/rust/files
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2025-07-17 21:45:32 -0400
committerGravatar Chris Xiong <chirs241097@gmail.com> 2025-07-17 21:49:12 -0400
commit4bdc9a8c85755595e25103228e0d259c4ce393c7 (patch)
treee20f95361a33e1fa7275cd26c8fa74e2d41a2bc1 /dev-lang/rust/files
parent83c6647f1d3f24974b4ceacc48a376be62ec3079 (diff)
downloadppo-4bdc9a8c85755595e25103228e0d259c4ce393c7.tar.xz
1.88.0?
Diffstat (limited to 'dev-lang/rust/files')
-rw-r--r--dev-lang/rust/files/1.67.0-doc-wasm.patch34
-rw-r--r--dev-lang/rust/files/1.85.0-cross-compile-libz.patch26
-rw-r--r--dev-lang/rust/files/1.85.0-musl-dynamic-linking.patch271
-rw-r--r--dev-lang/rust/files/rust-no-alloc-shim-func.patch611
4 files changed, 611 insertions, 331 deletions
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 06011de..0000000
--- 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.85.0-cross-compile-libz.patch b/dev-lang/rust/files/1.85.0-cross-compile-libz.patch
deleted file mode 100644
index 7bd45c4..0000000
--- a/dev-lang/rust/files/1.85.0-cross-compile-libz.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 768f7e50a6d9a3db4e4eef45dcb4c56e9b580389 Mon Sep 17 00:00:00 2001
-From: Matt Jolly <kangie@gentoo.org>
-Date: Sun, 9 Feb 2025 21:12:43 +1000
-Subject: [PATCH] Update libz cross-compile patch for 9999 (1.86.0)
-
-See-also: https://paste.sr.ht/~kchibisov/682321e0fd4a3ece4a4b7b71591896f5cd3cdb22
-See-also: https://github.com/gentoo/gentoo/pull/35246#discussion_r1484525497
---- a/compiler/rustc_llvm/build.rs
-+++ b/compiler/rustc_llvm/build.rs
-@@ -219,13 +219,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");
--
-- // Don't link system libs if cross-compiling unless targeting 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
---
-2.48.0
diff --git a/dev-lang/rust/files/1.85.0-musl-dynamic-linking.patch b/dev-lang/rust/files/1.85.0-musl-dynamic-linking.patch
deleted file mode 100644
index a6ab967..0000000
--- a/dev-lang/rust/files/1.85.0-musl-dynamic-linking.patch
+++ /dev/null
@@ -1,271 +0,0 @@
-From be965af5421e55c0032a989b220bc0da005d2272 Mon Sep 17 00:00:00 2001
-From: Michal Rostecki <vadorovsky@protonmail.com>
-Date: Tue, 25 Feb 2025 16:24:21 +0100
-Subject: [PATCH] Enable dynamic linking by default for musl
-
----
- .../src/spec/targets/aarch64_unknown_linux_musl.rs | 3 ---
- .../src/spec/targets/arm_unknown_linux_musleabi.rs | 3 +--
- .../src/spec/targets/arm_unknown_linux_musleabihf.rs | 3 +--
- .../src/spec/targets/armv5te_unknown_linux_musleabi.rs | 3 +--
- .../src/spec/targets/armv7_unknown_linux_musleabi.rs | 3 +--
- .../src/spec/targets/armv7_unknown_linux_musleabihf.rs | 3 +--
- .../rustc_target/src/spec/targets/i586_unknown_linux_musl.rs | 2 --
- .../rustc_target/src/spec/targets/i686_unknown_linux_musl.rs | 2 --
- .../src/spec/targets/mips64_unknown_linux_muslabi64.rs | 3 +--
- .../src/spec/targets/mips64el_unknown_linux_muslabi64.rs | 2 --
- .../src/spec/targets/powerpc64_unknown_linux_musl.rs | 2 --
- .../src/spec/targets/powerpc64le_unknown_linux_musl.rs | 2 --
- .../src/spec/targets/powerpc_unknown_linux_musl.rs | 2 --
- .../src/spec/targets/powerpc_unknown_linux_muslspe.rs | 2 --
- .../src/spec/targets/riscv32gc_unknown_linux_musl.rs | 3 +--
- .../rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs | 2 --
- .../src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs | 3 +--
- .../rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs | 2 --
- 18 files changed, 8 insertions(+), 37 deletions(-)
-
-diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
-index 4fefdfa5c5e..bb65048a56d 100644
---- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
-+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
-@@ -12,9 +12,6 @@ pub(crate) fn target() -> Target {
- | SanitizerSet::MEMORY
- | SanitizerSet::THREAD;
-
-- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
-- base.crt_static_default = true;
--
- Target {
- llvm_target: "aarch64-unknown-linux-musl".into(),
- metadata: crate::spec::TargetMetadata {
-diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs
-index 26241dd0bd4..cab79e2bf7d 100644
---- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs
-+++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs
-@@ -20,8 +20,7 @@ pub(crate) fn target() -> Target {
- features: "+strict-align,+v6".into(),
- max_atomic_width: Some(64),
- mcount: "\u{1}mcount".into(),
-- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
-- crt_static_default: true,
-+ crt_static_default: false,
- ..base::linux_musl::opts()
- },
- }
-diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs
-index 4bbde7667b9..c5f6c180a95 100644
---- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs
-+++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs
-@@ -20,8 +20,7 @@ pub(crate) fn target() -> Target {
- features: "+strict-align,+v6,+vfp2,-d32".into(),
- max_atomic_width: Some(64),
- mcount: "\u{1}mcount".into(),
-- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
-- crt_static_default: true,
-+ crt_static_default: false,
- ..base::linux_musl::opts()
- },
- }
-diff --git a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs
-index 62619546891..680dafe6943 100644
---- a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs
-+++ b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs
-@@ -20,8 +20,7 @@ pub(crate) fn target() -> Target {
- max_atomic_width: Some(32),
- mcount: "\u{1}mcount".into(),
- has_thumb_interworking: true,
-- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
-- crt_static_default: true,
-+ crt_static_default: false,
- ..base::linux_musl::opts()
- },
- }
-diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs
-index 0436e0d8df4..e862b28ca92 100644
---- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs
-+++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs
-@@ -24,8 +24,7 @@ pub(crate) fn target() -> Target {
- features: "+v7,+thumb2,+soft-float,-neon".into(),
- max_atomic_width: Some(64),
- mcount: "\u{1}mcount".into(),
-- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
-- crt_static_default: true,
-+ crt_static_default: false,
- ..base::linux_musl::opts()
- },
- }
-diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs
-index 22e49f2f1b0..acb7c99cdaf 100644
---- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs
-+++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs
-@@ -23,8 +23,7 @@ pub(crate) fn target() -> Target {
- features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
- max_atomic_width: Some(64),
- mcount: "\u{1}mcount".into(),
-- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
-- crt_static_default: true,
-+ crt_static_default: false,
- ..base::linux_musl::opts()
- },
- }
-diff --git a/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs
-index 8ad93496f3a..623422a89ea 100644
---- a/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs
-+++ b/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs
-@@ -4,7 +4,5 @@ pub(crate) fn target() -> Target {
- let mut base = super::i686_unknown_linux_musl::target();
- base.cpu = "pentium".into();
- base.llvm_target = "i586-unknown-linux-musl".into();
-- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
-- base.crt_static_default = true;
- base
- }
-diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs
-index 6ba87c732b7..b805b80b85b 100644
---- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs
-+++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs
-@@ -6,8 +6,6 @@ pub(crate) fn target() -> Target {
- base.max_atomic_width = Some(64);
- base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32", "-Wl,-melf_i386"]);
- base.stack_probes = StackProbeType::Inline;
-- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
-- base.crt_static_default = true;
-
- // The unwinder used by i686-unknown-linux-musl, the LLVM libunwind
- // implementation, apparently relies on frame pointers existing... somehow.
-diff --git a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs
-index 32f5c79d653..9a25fe773fb 100644
---- a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs
-+++ b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs
-@@ -22,8 +22,7 @@ pub(crate) fn target() -> Target {
- abi: "abi64".into(),
- endian: Endian::Big,
- mcount: "_mcount".into(),
-- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
-- crt_static_default: true,
-+ crt_static_default: false,
- ..base
- },
- }
-diff --git a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs
-index 5e7c37fd46c..4f50e8b7033 100644
---- a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs
-+++ b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs
-@@ -5,8 +5,6 @@ pub(crate) fn target() -> Target {
- base.cpu = "mips64r2".into();
- base.features = "+mips64r2".into();
- base.max_atomic_width = Some(64);
-- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
-- base.crt_static_default = true;
- Target {
- // LLVM doesn't recognize "muslabi64" yet.
- llvm_target: "mips64el-unknown-linux-musl".into(),
-diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs
-index a54b17c87a7..a964f417799 100644
---- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs
-+++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs
-@@ -7,8 +7,6 @@ pub(crate) fn target() -> Target {
- base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
- base.max_atomic_width = Some(64);
- base.stack_probes = StackProbeType::Inline;
-- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
-- base.crt_static_default = true;
-
- Target {
- llvm_target: "powerpc64-unknown-linux-musl".into(),
-diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs
-index f763c37f535..d0335506f16 100644
---- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs
-+++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs
-@@ -6,8 +6,6 @@ pub(crate) fn target() -> Target {
- base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
- base.max_atomic_width = Some(64);
- base.stack_probes = StackProbeType::Inline;
-- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
-- base.crt_static_default = true;
-
- Target {
- llvm_target: "powerpc64le-unknown-linux-musl".into(),
-diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs
-index 0cd0ea96ad3..5372a83e29a 100644
---- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs
-+++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs
-@@ -6,8 +6,6 @@ pub(crate) fn target() -> Target {
- base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
- base.max_atomic_width = Some(32);
- base.stack_probes = StackProbeType::Inline;
-- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
-- base.crt_static_default = true;
-
- Target {
- llvm_target: "powerpc-unknown-linux-musl".into(),
-diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs
-index b86c3c2e8e0..2305db81c5e 100644
---- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs
-+++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs
-@@ -6,8 +6,6 @@ pub(crate) fn target() -> Target {
- base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-mspe"]);
- base.max_atomic_width = Some(32);
- base.stack_probes = StackProbeType::Inline;
-- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
-- base.crt_static_default = true;
-
- Target {
- llvm_target: "powerpc-unknown-linux-muslspe".into(),
-diff --git a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs
-index a07429bb0c5..cf2d7669a8a 100644
---- a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs
-+++ b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs
-@@ -23,8 +23,7 @@ pub(crate) fn target() -> Target {
- llvm_abiname: "ilp32d".into(),
- max_atomic_width: Some(32),
- supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
-- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
-- crt_static_default: true,
-+ crt_static_default: false,
- ..base::linux_musl::opts()
- },
- }
-diff --git a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs
-index fbe8c48eca7..7a78004927b 100644
---- a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs
-+++ b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs
-@@ -12,8 +12,6 @@ pub(crate) fn target() -> Target {
- base.stack_probes = StackProbeType::Inline;
- base.supported_sanitizers =
- SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::MEMORY | SanitizerSet::THREAD;
-- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
-- base.crt_static_default = true;
-
- Target {
- llvm_target: "s390x-unknown-linux-musl".into(),
-diff --git a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs
-index 1149b6d16eb..e1e060c211d 100644
---- a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs
-+++ b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs
-@@ -27,8 +27,7 @@ pub(crate) fn target() -> Target {
- features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".into(),
- max_atomic_width: Some(64),
- mcount: "\u{1}mcount".into(),
-- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
-- crt_static_default: true,
-+ crt_static_default: false,
- ..base::linux_musl::opts()
- },
- }
-diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
-index 8dcdc5be8a9..8be0f335db9 100644
---- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
-+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
-@@ -14,8 +14,6 @@ pub(crate) fn target() -> Target {
- | SanitizerSet::MEMORY
- | SanitizerSet::THREAD;
- base.supports_xray = true;
-- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
-- base.crt_static_default = true;
-
- Target {
- llvm_target: "x86_64-unknown-linux-musl".into(),
---
-2.45.3
-
diff --git a/dev-lang/rust/files/rust-no-alloc-shim-func.patch b/dev-lang/rust/files/rust-no-alloc-shim-func.patch
new file mode 100644
index 0000000..ecdadb2
--- /dev/null
+++ b/dev-lang/rust/files/rust-no-alloc-shim-func.patch
@@ -0,0 +1,611 @@
+From 6906b44e1c667705ce04626901a75d51f4910de3 Mon Sep 17 00:00:00 2001
+From: Daniel Paoliello <danpao@microsoft.com>
+Date: Thu, 15 May 2025 16:38:46 -0700
+Subject: [PATCH] Change __rust_no_alloc_shim_is_unstable to be a function
+
+---
+ compiler/rustc_ast/src/expand/allocator.rs | 2 +-
+ .../rustc_codegen_cranelift/src/allocator.rs | 40 +++++++---
+ compiler/rustc_codegen_gcc/src/allocator.rs | 78 ++++++++++---------
+ compiler/rustc_codegen_llvm/src/allocator.rs | 74 ++++++++++--------
+ .../src/back/symbol_export.rs | 14 +---
+ compiler/rustc_symbol_mangling/src/v0.rs | 4 -
+ library/alloc/src/alloc.rs | 7 +-
+ src/tools/miri/src/shims/extern_static.rs | 4 -
+ src/tools/miri/src/shims/foreign_items.rs | 4 +
+ tests/codegen/alloc-optimisation.rs | 3 +-
+ tests/codegen/unwind-landingpad-inline.rs | 6 +-
+ tests/codegen/vec-iter-collect-len.rs | 6 +-
+ tests/codegen/vec-optimizes-away.rs | 3 +-
+ tests/run-make/no-alloc-shim/foo.rs | 6 +-
+ tests/run-make/no-alloc-shim/rmake.rs | 22 ++++--
+ tests/run-make/symbols-all-mangled/rmake.rs | 8 --
+ tests/ui/sanitizer/dataflow-abilist.txt | 1 +
+ 18 files changed, 155 insertions(+), 131 deletions(-)
+
+diff --git a/compiler/rustc_ast/src/expand/allocator.rs b/compiler/rustc_ast/src/expand/allocator.rs
+index dd8d5ae624a3c..7dee2ed17b4be 100644
+--- a/compiler/rustc_ast/src/expand/allocator.rs
++++ b/compiler/rustc_ast/src/expand/allocator.rs
+@@ -22,7 +22,7 @@ pub fn alloc_error_handler_name(alloc_error_handler_kind: AllocatorKind) -> &'st
+ }
+ }
+
+-pub const NO_ALLOC_SHIM_IS_UNSTABLE: &str = "__rust_no_alloc_shim_is_unstable";
++pub const NO_ALLOC_SHIM_IS_UNSTABLE: &str = "__rust_no_alloc_shim_is_unstable_v2";
+
+ pub enum AllocatorTy {
+ Layout,
+diff --git a/compiler/rustc_codegen_cranelift/src/allocator.rs b/compiler/rustc_codegen_cranelift/src/allocator.rs
+index 9cff8a84db3d9..ffb932a3c38e6 100644
+--- a/compiler/rustc_codegen_cranelift/src/allocator.rs
++++ b/compiler/rustc_codegen_cranelift/src/allocator.rs
+@@ -1,6 +1,7 @@
+ //! Allocator shim
+ // Adapted from rustc
+
++use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext};
+ use rustc_ast::expand::allocator::{
+ ALLOCATOR_METHODS, AllocatorKind, AllocatorTy, NO_ALLOC_SHIM_IS_UNSTABLE,
+ alloc_error_handler_name, default_fn_name, global_fn_name,
+@@ -97,16 +98,31 @@ fn codegen_inner(
+ data.define(Box::new([val]));
+ module.define_data(data_id, &data).unwrap();
+
+- let data_id = module
+- .declare_data(
+- &mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE),
+- Linkage::Export,
+- false,
+- false,
+- )
+- .unwrap();
+- let mut data = DataDescription::new();
+- data.set_align(1);
+- data.define(Box::new([0]));
+- module.define_data(data_id, &data).unwrap();
++ {
++ let sig = Signature {
++ call_conv: module.target_config().default_call_conv,
++ params: vec![],
++ returns: vec![],
++ };
++ let func_id = module
++ .declare_function(
++ &mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE),
++ Linkage::Export,
++ &sig,
++ )
++ .unwrap();
++
++ let mut ctx = Context::new();
++ ctx.func.signature = sig;
++ let mut func_ctx = FunctionBuilderContext::new();
++ let mut bcx = FunctionBuilder::new(&mut ctx.func, &mut func_ctx);
++
++ let block = bcx.create_block();
++ bcx.switch_to_block(block);
++ bcx.ins().return_(&[]);
++ bcx.seal_all_blocks();
++ bcx.finalize();
++
++ module.define_function(func_id, &mut ctx).unwrap();
++ }
+ }
+diff --git a/compiler/rustc_codegen_gcc/src/allocator.rs b/compiler/rustc_codegen_gcc/src/allocator.rs
+index f4ebd42ee2dc0..cf8aa500c778f 100644
+--- a/compiler/rustc_codegen_gcc/src/allocator.rs
++++ b/compiler/rustc_codegen_gcc/src/allocator.rs
+@@ -57,7 +57,7 @@ pub(crate) unsafe fn codegen(
+ let from_name = mangle_internal_symbol(tcx, &global_fn_name(method.name));
+ let to_name = mangle_internal_symbol(tcx, &default_fn_name(method.name));
+
+- create_wrapper_function(tcx, context, &from_name, &to_name, &types, output);
++ create_wrapper_function(tcx, context, &from_name, Some(&to_name), &types, output);
+ }
+ }
+
+@@ -66,7 +66,7 @@ pub(crate) unsafe fn codegen(
+ tcx,
+ context,
+ &mangle_internal_symbol(tcx, "__rust_alloc_error_handler"),
+- &mangle_internal_symbol(tcx, alloc_error_handler_name(alloc_error_handler_kind)),
++ Some(&mangle_internal_symbol(tcx, alloc_error_handler_name(alloc_error_handler_kind))),
+ &[usize, usize],
+ None,
+ );
+@@ -81,21 +81,21 @@ pub(crate) unsafe fn codegen(
+ let value = context.new_rvalue_from_int(i8, value as i32);
+ global.global_set_initializer_rvalue(value);
+
+- let name = mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE);
+- let global = context.new_global(None, GlobalKind::Exported, i8, name);
+- #[cfg(feature = "master")]
+- global.add_attribute(VarAttribute::Visibility(symbol_visibility_to_gcc(
+- tcx.sess.default_visibility(),
+- )));
+- let value = context.new_rvalue_from_int(i8, 0);
+- global.global_set_initializer_rvalue(value);
++ create_wrapper_function(
++ tcx,
++ context,
++ &mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE),
++ None,
++ &[],
++ None,
++ );
+ }
+
+ fn create_wrapper_function(
+ tcx: TyCtxt<'_>,
+ context: &Context<'_>,
+ from_name: &str,
+- to_name: &str,
++ to_name: Option<&str>,
+ types: &[Type<'_>],
+ output: Option<Type<'_>>,
+ ) {
+@@ -124,34 +124,40 @@ fn create_wrapper_function(
+ // TODO(antoyo): emit unwind tables.
+ }
+
+- let args: Vec<_> = types
+- .iter()
+- .enumerate()
+- .map(|(index, typ)| context.new_parameter(None, *typ, format!("param{}", index)))
+- .collect();
+- let callee = context.new_function(
+- None,
+- FunctionType::Extern,
+- output.unwrap_or(void),
+- &args,
+- to_name,
+- false,
+- );
+- #[cfg(feature = "master")]
+- callee.add_attribute(FnAttribute::Visibility(gccjit::Visibility::Hidden));
+-
+ let block = func.new_block("entry");
+
+- let args = args
+- .iter()
+- .enumerate()
+- .map(|(i, _)| func.get_param(i as i32).to_rvalue())
+- .collect::<Vec<_>>();
+- let ret = context.new_call(None, callee, &args);
+- //llvm::LLVMSetTailCall(ret, True);
+- if output.is_some() {
+- block.end_with_return(None, ret);
++ if let Some(to_name) = to_name {
++ let args: Vec<_> = types
++ .iter()
++ .enumerate()
++ .map(|(index, typ)| context.new_parameter(None, *typ, format!("param{}", index)))
++ .collect();
++ let callee = context.new_function(
++ None,
++ FunctionType::Extern,
++ output.unwrap_or(void),
++ &args,
++ to_name,
++ false,
++ );
++ #[cfg(feature = "master")]
++ callee.add_attribute(FnAttribute::Visibility(gccjit::Visibility::Hidden));
++
++ let args = args
++ .iter()
++ .enumerate()
++ .map(|(i, _)| func.get_param(i as i32).to_rvalue())
++ .collect::<Vec<_>>();
++ let ret = context.new_call(None, callee, &args);
++ //llvm::LLVMSetTailCall(ret, True);
++ if output.is_some() {
++ block.end_with_return(None, ret);
++ } else {
++ block.add_eval(None, ret);
++ block.end_with_void_return(None);
++ }
+ } else {
++ assert!(output.is_none());
+ block.end_with_void_return(None);
+ }
+
+diff --git a/compiler/rustc_codegen_llvm/src/allocator.rs b/compiler/rustc_codegen_llvm/src/allocator.rs
+index 4a78e69497994..9dca63cfc8d4f 100644
+--- a/compiler/rustc_codegen_llvm/src/allocator.rs
++++ b/compiler/rustc_codegen_llvm/src/allocator.rs
+@@ -57,7 +57,7 @@ pub(crate) unsafe fn codegen(
+ let from_name = mangle_internal_symbol(tcx, &global_fn_name(method.name));
+ let to_name = mangle_internal_symbol(tcx, &default_fn_name(method.name));
+
+- create_wrapper_function(tcx, &cx, &from_name, &to_name, &args, output, false);
++ create_wrapper_function(tcx, &cx, &from_name, Some(&to_name), &args, output, false);
+ }
+ }
+
+@@ -66,7 +66,7 @@ pub(crate) unsafe fn codegen(
+ tcx,
+ &cx,
+ &mangle_internal_symbol(tcx, "__rust_alloc_error_handler"),
+- &mangle_internal_symbol(tcx, alloc_error_handler_name(alloc_error_handler_kind)),
++ Some(&mangle_internal_symbol(tcx, alloc_error_handler_name(alloc_error_handler_kind))),
+ &[usize, usize], // size, align
+ None,
+ true,
+@@ -81,11 +81,16 @@ pub(crate) unsafe fn codegen(
+ let llval = llvm::LLVMConstInt(i8, val as u64, False);
+ llvm::set_initializer(ll_g, llval);
+
+- let name = mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE);
+- let ll_g = cx.declare_global(&name, i8);
+- llvm::set_visibility(ll_g, llvm::Visibility::from_generic(tcx.sess.default_visibility()));
+- let llval = llvm::LLVMConstInt(i8, 0, False);
+- llvm::set_initializer(ll_g, llval);
++ // __rust_no_alloc_shim_is_unstable_v2
++ create_wrapper_function(
++ tcx,
++ &cx,
++ &mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE),
++ None,
++ &[],
++ None,
++ false,
++ );
+ }
+
+ if tcx.sess.opts.debuginfo != DebugInfo::None {
+@@ -99,7 +104,7 @@ fn create_wrapper_function(
+ tcx: TyCtxt<'_>,
+ cx: &SimpleCx<'_>,
+ from_name: &str,
+- to_name: &str,
++ to_name: Option<&str>,
+ args: &[&Type],
+ output: Option<&Type>,
+ no_return: bool,
+@@ -128,33 +133,38 @@ fn create_wrapper_function(
+ attributes::apply_to_llfn(llfn, llvm::AttributePlace::Function, &[uwtable]);
+ }
+
+- let callee = declare_simple_fn(
+- &cx,
+- to_name,
+- llvm::CallConv::CCallConv,
+- llvm::UnnamedAddr::Global,
+- llvm::Visibility::Hidden,
+- ty,
+- );
+- if let Some(no_return) = no_return {
+- // -> ! DIFlagNoReturn
+- attributes::apply_to_llfn(callee, llvm::AttributePlace::Function, &[no_return]);
+- }
+- llvm::set_visibility(callee, llvm::Visibility::Hidden);
+-
+ let llbb = unsafe { llvm::LLVMAppendBasicBlockInContext(cx.llcx, llfn, c"entry".as_ptr()) };
+-
+ let mut bx = SBuilder::build(&cx, llbb);
+- let args = args
+- .iter()
+- .enumerate()
+- .map(|(i, _)| llvm::get_param(llfn, i as c_uint))
+- .collect::<Vec<_>>();
+- let ret = bx.call(ty, callee, &args, None);
+- llvm::LLVMSetTailCall(ret, True);
+- if output.is_some() {
+- bx.ret(ret);
++
++ if let Some(to_name) = to_name {
++ let callee = declare_simple_fn(
++ &cx,
++ to_name,
++ llvm::CallConv::CCallConv,
++ llvm::UnnamedAddr::Global,
++ llvm::Visibility::Hidden,
++ ty,
++ );
++ if let Some(no_return) = no_return {
++ // -> ! DIFlagNoReturn
++ attributes::apply_to_llfn(callee, llvm::AttributePlace::Function, &[no_return]);
++ }
++ llvm::set_visibility(callee, llvm::Visibility::Hidden);
++
++ let args = args
++ .iter()
++ .enumerate()
++ .map(|(i, _)| llvm::get_param(llfn, i as c_uint))
++ .collect::<Vec<_>>();
++ let ret = bx.call(ty, callee, &args, None);
++ llvm::LLVMSetTailCall(ret, True);
++ if output.is_some() {
++ bx.ret(ret);
++ } else {
++ bx.ret_void()
++ }
+ } else {
++ assert!(output.is_none());
+ bx.ret_void()
+ }
+ }
+diff --git a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs
+index 92b9b6e132e74..d0b6c7470fb9a 100644
+--- a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs
++++ b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs
+@@ -219,6 +219,7 @@ fn exported_symbols_provider_local<'tcx>(
+ .chain([
+ mangle_internal_symbol(tcx, "__rust_alloc_error_handler"),
+ mangle_internal_symbol(tcx, OomStrategy::SYMBOL),
++ mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE),
+ ])
+ {
+ let exported_symbol = ExportedSymbol::NoDefId(SymbolName::new(tcx, &symbol_name));
+@@ -232,19 +233,6 @@ fn exported_symbols_provider_local<'tcx>(
+ },
+ ));
+ }
+-
+- let exported_symbol = ExportedSymbol::NoDefId(SymbolName::new(
+- tcx,
+- &mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE),
+- ));
+- symbols.push((
+- exported_symbol,
+- SymbolExportInfo {
+- level: SymbolExportLevel::Rust,
+- kind: SymbolExportKind::Data,
+- used: false,
+- },
+- ))
+ }
+
+ if tcx.sess.instrument_coverage() || tcx.sess.opts.cg.profile_generate.enabled() {
+diff --git a/compiler/rustc_symbol_mangling/src/v0.rs b/compiler/rustc_symbol_mangling/src/v0.rs
+index 49a5e20d7cf8b..1db8ad72b321c 100644
+--- a/compiler/rustc_symbol_mangling/src/v0.rs
++++ b/compiler/rustc_symbol_mangling/src/v0.rs
+@@ -85,10 +85,6 @@ pub fn mangle_internal_symbol<'tcx>(tcx: TyCtxt<'tcx>, item_name: &str) -> Strin
+ if item_name == "rust_eh_personality" {
+ // rust_eh_personality must not be renamed as LLVM hard-codes the name
+ return "rust_eh_personality".to_owned();
+- } else if item_name == "__rust_no_alloc_shim_is_unstable" {
+- // Temporary back compat hack to give people the chance to migrate to
+- // include #[rustc_std_internal_symbol].
+- return "__rust_no_alloc_shim_is_unstable".to_owned();
+ }
+
+ let prefix = "_R";
+diff --git a/library/alloc/src/alloc.rs b/library/alloc/src/alloc.rs
+index e1cc4ba25c4ea..b4176e9c1f4d0 100644
+--- a/library/alloc/src/alloc.rs
++++ b/library/alloc/src/alloc.rs
+@@ -31,8 +31,9 @@ unsafe extern "Rust" {
+ #[rustc_std_internal_symbol]
+ fn __rust_alloc_zeroed(size: usize, align: usize) -> *mut u8;
+
++ #[rustc_nounwind]
+ #[rustc_std_internal_symbol]
+- static __rust_no_alloc_shim_is_unstable: u8;
++ fn __rust_no_alloc_shim_is_unstable_v2();
+ }
+
+ /// The global memory allocator.
+@@ -88,7 +89,7 @@ pub unsafe fn alloc(layout: Layout) -> *mut u8 {
+ unsafe {
+ // Make sure we don't accidentally allow omitting the allocator shim in
+ // stable code until it is actually stabilized.
+- core::ptr::read_volatile(&__rust_no_alloc_shim_is_unstable);
++ __rust_no_alloc_shim_is_unstable_v2();
+
+ __rust_alloc(layout.size(), layout.align())
+ }
+@@ -171,7 +172,7 @@ pub unsafe fn alloc_zeroed(layout: Layout) -> *mut u8 {
+ unsafe {
+ // Make sure we don't accidentally allow omitting the allocator shim in
+ // stable code until it is actually stabilized.
+- core::ptr::read_volatile(&__rust_no_alloc_shim_is_unstable);
++ __rust_no_alloc_shim_is_unstable_v2();
+
+ __rust_alloc_zeroed(layout.size(), layout.align())
+ }
+diff --git a/src/tools/miri/src/shims/extern_static.rs b/src/tools/miri/src/shims/extern_static.rs
+index 2feed5a835228..a2ea3dbd88b11 100644
+--- a/src/tools/miri/src/shims/extern_static.rs
++++ b/src/tools/miri/src/shims/extern_static.rs
+@@ -45,10 +45,6 @@ impl<'tcx> MiriMachine<'tcx> {
+
+ /// Sets up the "extern statics" for this machine.
+ pub fn init_extern_statics(ecx: &mut MiriInterpCx<'tcx>) -> InterpResult<'tcx> {
+- // "__rust_no_alloc_shim_is_unstable"
+- let val = ImmTy::from_int(0, ecx.machine.layouts.u8); // always 0, value does not matter
+- Self::alloc_extern_static(ecx, "__rust_no_alloc_shim_is_unstable", val)?;
+-
+ // "__rust_alloc_error_handler_should_panic"
+ let val = ecx.tcx.sess.opts.unstable_opts.oom.should_panic();
+ let val = ImmTy::from_int(val, ecx.machine.layouts.u8);
+diff --git a/src/tools/miri/src/shims/foreign_items.rs b/src/tools/miri/src/shims/foreign_items.rs
+index 39b930fdeb92d..416cb1ab55e6a 100644
+--- a/src/tools/miri/src/shims/foreign_items.rs
++++ b/src/tools/miri/src/shims/foreign_items.rs
+@@ -611,6 +611,10 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
+ this.write_pointer(new_ptr, dest)
+ });
+ }
++ name if name == this.mangle_internal_symbol("__rust_no_alloc_shim_is_unstable_v2") => {
++ // This is a no-op shim that only exists to prevent making the allocator shims instantly stable.
++ let [] = this.check_shim(abi, CanonAbi::Rust, link_name, args)?;
++ }
+
+ // C memory handling functions
+ "memcmp" => {
+diff --git a/tests/codegen/alloc-optimisation.rs b/tests/codegen/alloc-optimisation.rs
+index 19f14647c1d7d..3735860d510fb 100644
+--- a/tests/codegen/alloc-optimisation.rs
++++ b/tests/codegen/alloc-optimisation.rs
+@@ -5,7 +5,8 @@
+ pub fn alloc_test(data: u32) {
+ // CHECK-LABEL: @alloc_test
+ // CHECK-NEXT: start:
+- // CHECK-NEXT: {{.*}} load volatile i8, ptr @{{.*}}__rust_no_alloc_shim_is_unstable, align 1
++ // CHECK-NEXT: ; call __rustc::__rust_no_alloc_shim_is_unstable_v2
++ // CHECK-NEXT: tail call void @_R{{.+}}__rust_no_alloc_shim_is_unstable_v2()
+ // CHECK-NEXT: ret void
+ let x = Box::new(data);
+ drop(x);
+diff --git a/tests/codegen/unwind-landingpad-inline.rs b/tests/codegen/unwind-landingpad-inline.rs
+index 920774b340240..1cf606279e623 100644
+--- a/tests/codegen/unwind-landingpad-inline.rs
++++ b/tests/codegen/unwind-landingpad-inline.rs
+@@ -10,8 +10,10 @@
+ // See https://github.com/rust-lang/rust/issues/46515
+ // CHECK-LABEL: @check_no_escape_in_landingpad
+ // CHECK: start:
+-// CHECK-NEXT: __rust_no_alloc_shim_is_unstable
+-// CHECK-NEXT: __rust_no_alloc_shim_is_unstable
++// CHECK-NEXT: ; call __rustc::__rust_no_alloc_shim_is_unstable_v2
++// CHECK-NEXT: tail call void @[[NO_ALLOC_SHIM:_R.+__rust_no_alloc_shim_is_unstable_v2]]()
++// CHECK-NEXT: ; call __rustc::__rust_no_alloc_shim_is_unstable_v2
++// CHECK-NEXT: tail call void @[[NO_ALLOC_SHIM]]()
+ // CHECK-NEXT: ret void
+ #[no_mangle]
+ pub fn check_no_escape_in_landingpad(f: fn()) {
+diff --git a/tests/codegen/vec-iter-collect-len.rs b/tests/codegen/vec-iter-collect-len.rs
+index a88573522d4d8..807548ef883f5 100644
+--- a/tests/codegen/vec-iter-collect-len.rs
++++ b/tests/codegen/vec-iter-collect-len.rs
+@@ -4,7 +4,9 @@
+ #[no_mangle]
+ pub fn get_len() -> usize {
+ // CHECK-LABEL: @get_len
+- // CHECK-NOT: call
+- // CHECK-NOT: invoke
++ // CHECK-NEXT: start:
++ // CHECK-NEXT: ; call __rustc::__rust_no_alloc_shim_is_unstable_v2
++ // CHECK-NEXT: tail call void @_R{{.+}}__rust_no_alloc_shim_is_unstable_v2()
++ // CHECK-NEXT: ret i{{[0-9]+}} 3
+ [1, 2, 3].iter().collect::<Vec<_>>().len()
+ }
+diff --git a/tests/codegen/vec-optimizes-away.rs b/tests/codegen/vec-optimizes-away.rs
+index f6ed2898bdaaa..93b55454b108c 100644
+--- a/tests/codegen/vec-optimizes-away.rs
++++ b/tests/codegen/vec-optimizes-away.rs
+@@ -5,7 +5,8 @@
+ pub fn sum_me() -> i32 {
+ // CHECK-LABEL: @sum_me
+ // CHECK-NEXT: {{^.*:$}}
+- // CHECK-NEXT: {{.*}} load volatile i8, ptr @{{.*}}__rust_no_alloc_shim_is_unstable, align 1
++ // CHECK-NEXT: ; call __rustc::__rust_no_alloc_shim_is_unstable_v2
++ // CHECK-NEXT: tail call void @_R{{.+}}__rust_no_alloc_shim_is_unstable_v2()
+ // CHECK-NEXT: ret i32 6
+ vec![1, 2, 3].iter().sum::<i32>()
+ }
+diff --git a/tests/run-make/no-alloc-shim/foo.rs b/tests/run-make/no-alloc-shim/foo.rs
+index 42606961f8bb2..b5d0d394d2b9f 100644
+--- a/tests/run-make/no-alloc-shim/foo.rs
++++ b/tests/run-make/no-alloc-shim/foo.rs
+@@ -1,4 +1,4 @@
+-#![feature(default_alloc_error_handler)]
++#![feature(rustc_attrs)]
+ #![no_std]
+ #![no_main]
+
+@@ -31,8 +31,8 @@ unsafe impl GlobalAlloc for Alloc {
+ }
+
+ #[cfg(not(check_feature_gate))]
+-#[no_mangle]
+-static __rust_no_alloc_shim_is_unstable: u8 = 0;
++#[rustc_std_internal_symbol]
++fn __rust_no_alloc_shim_is_unstable_v2() {}
+
+ #[no_mangle]
+ extern "C" fn main(_argc: core::ffi::c_int, _argv: *const *const i8) -> i32 {
+diff --git a/tests/run-make/no-alloc-shim/rmake.rs b/tests/run-make/no-alloc-shim/rmake.rs
+index d61ef5de8c56c..47cabfc208c77 100644
+--- a/tests/run-make/no-alloc-shim/rmake.rs
++++ b/tests/run-make/no-alloc-shim/rmake.rs
+@@ -7,12 +7,6 @@
+ //@ ignore-cross-compile
+ // Reason: the compiled binary is executed
+
+-//@ ignore-msvc
+-//FIXME(Oneirical): Getting this to work on MSVC requires passing libcmt.lib to CC,
+-// which is not trivial to do.
+-// Tracking issue: https://github.com/rust-lang/rust/issues/128602
+-// Discussion: https://github.com/rust-lang/rust/pull/128407#discussion_r1702439172
+-
+ use run_make_support::{cc, has_extension, has_prefix, run, rustc, shallow_find_files};
+
+ fn main() {
+@@ -30,15 +24,28 @@ fn main() {
+ has_prefix(path, "libcompiler_builtins") && has_extension(path, "rlib")
+ });
+
++ #[allow(unused_mut)]
++ let mut platform_args = Vec::<String>::new();
++ #[cfg(target_env = "msvc")]
++ {
++ platform_args.push("-MD".to_string());
++
++ // `/link` tells MSVC that the remaining arguments are linker options.
++ platform_args.push("/link".to_string());
++ platform_args.push("vcruntime.lib".to_string());
++ platform_args.push("msvcrt.lib".to_string());
++ }
++
+ cc().input("foo.o")
+ .out_exe("foo")
++ .args(&platform_args)
+ .args(&alloc_libs)
+ .args(&core_libs)
+ .args(&compiler_builtins_libs)
+ .run();
+ run("foo");
+
+- // Check that linking without __rust_no_alloc_shim_is_unstable defined fails
++ // Check that linking without __rust_no_alloc_shim_is_unstable_v2 defined fails
+ rustc()
+ .input("foo.rs")
+ .crate_type("bin")
+@@ -48,6 +55,7 @@ fn main() {
+ .run();
+ cc().input("foo.o")
+ .out_exe("foo")
++ .args(&platform_args)
+ .args(&alloc_libs)
+ .args(&core_libs)
+ .args(&compiler_builtins_libs)
+diff --git a/tests/run-make/symbols-all-mangled/rmake.rs b/tests/run-make/symbols-all-mangled/rmake.rs
+index 79ddd06bb94be..2cf579758002a 100644
+--- a/tests/run-make/symbols-all-mangled/rmake.rs
++++ b/tests/run-make/symbols-all-mangled/rmake.rs
+@@ -35,10 +35,6 @@ fn symbols_check_archive(path: &str) {
+ continue; // All compiler-builtins symbols must remain unmangled
+ }
+
+- if name == "__rust_no_alloc_shim_is_unstable" {
+- continue; // FIXME remove exception once we mangle this symbol
+- }
+-
+ if name.contains("rust_eh_personality") {
+ continue; // Unfortunately LLVM doesn't allow us to mangle this symbol
+ }
+@@ -75,10 +71,6 @@ fn symbols_check(path: &str) {
+ continue;
+ }
+
+- if name == "__rust_no_alloc_shim_is_unstable" {
+- continue; // FIXME remove exception once we mangle this symbol
+- }
+-
+ if name.contains("rust_eh_personality") {
+ continue; // Unfortunately LLVM doesn't allow us to mangle this symbol
+ }
+diff --git a/tests/ui/sanitizer/dataflow-abilist.txt b/tests/ui/sanitizer/dataflow-abilist.txt
+index fe04838f5493e..3d32397a175d4 100644
+--- a/tests/ui/sanitizer/dataflow-abilist.txt
++++ b/tests/ui/sanitizer/dataflow-abilist.txt
+@@ -503,3 +503,4 @@ fun:__rust_realloc=uninstrumented
+ fun:_ZN4core*=uninstrumented
+ fun:_ZN3std*=uninstrumented
+ fun:rust_eh_personality=uninstrumented
++fun:_R*__rustc*=uninstrumented