From 5a807b577553034678a8fcd674d05ec5a58b27b3 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Mon, 15 Dec 2025 19:48:34 +0800 Subject: [PATCH] Make sane choices for C++ runtime on macOS Reverts 400dec059e9d71b06e6cfa5cfe399b4c57eb8119 --- compiler/rustc_llvm/build.rs | 2 -- src/bootstrap/lib.rs | 7 ++----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs index a4c7747381e..7fefead7903 100644 --- a/compiler/rustc_llvm/build.rs +++ b/compiler/rustc_llvm/build.rs @@ -284,8 +284,6 @@ fn main() { if target.contains("sparc64") { "estdc++" } else { "c++" } } else if target.contains("freebsd") { "c++" - } else if target.contains("darwin") { - "c++" } else if target.contains("netbsd") && llvm_static_stdcpp.is_some() { // NetBSD uses a separate library when relocation is required "stdc++_pic" diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 347236c655a..91e2c99916e 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -848,11 +848,8 @@ fn cflags(&self, target: TargetSelection, which: GitRepo) -> Vec { .filter(|s| !s.starts_with("-O") && !s.starts_with("/O")) .collect::>(); - // If we're compiling on macOS then we add a few unconditional flags - // indicating that we want libc++ (more filled out than libstdc++) and - // we want to compile for 10.7. This way we can ensure that - // LLVM/etc are all properly compiled. - if target.contains("apple-darwin") { + // Clangs use libc++, ensure that archaic ones pick it as well. + if target.contains("apple-darwin") && cc.ends_with("clang") { base.push("-stdlib=libc++".into()); }