diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs index 024f6f89a4b7f..96b2960fb2d6f 100644 --- a/compiler/rustc_llvm/build.rs +++ b/compiler/rustc_llvm/build.rs @@ -327,26 +327,8 @@ fn main() { } } - let llvm_static_stdcpp = tracked_env_var_os("LLVM_STATIC_STDCPP"); let llvm_use_libcxx = tracked_env_var_os("LLVM_USE_LIBCXX"); - let stdcppname = if target.contains("openbsd") { - if target.contains("sparc64") { "estdc++" } else { "c++" } - } else if target.contains("darwin") - || target.contains("freebsd") - || target.contains("windows-gnullvm") - || target.contains("aix") - { - "c++" - } else if target.contains("netbsd") && llvm_static_stdcpp.is_some() { - // NetBSD uses a separate library when relocation is required - "stdc++_p" - } else if llvm_use_libcxx.is_some() { - "c++" - } else { - "stdc++" - }; - // RISC-V GCC erroneously requires libatomic for sub-word // atomic operations. Some BSD uses Clang as its system // compiler and provides no libatomic in its base system so @@ -355,24 +337,6 @@ fn main() { println!("cargo:rustc-link-lib=atomic"); } - // C++ runtime library - if !target.contains("msvc") { - if let Some(s) = llvm_static_stdcpp { - assert!(!cxxflags.contains("stdlib=libc++")); - let path = PathBuf::from(s); - println!("cargo:rustc-link-search=native={}", path.parent().unwrap().display()); - if target.contains("windows") { - println!("cargo:rustc-link-lib=static:-bundle={stdcppname}"); - } else { - println!("cargo:rustc-link-lib=static={stdcppname}"); - } - } else if cxxflags.contains("stdlib=libc++") { - println!("cargo:rustc-link-lib=c++"); - } else { - println!("cargo:rustc-link-lib={stdcppname}"); - } - } - // libc++abi and libunwind have to be specified explicitly on AIX. if target.contains("aix") { println!("cargo:rustc-link-lib=c++abi"); diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index 66692a2a2cbbc..e482564b35482 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -1201,23 +1201,6 @@ fn rustc_llvm_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelect cargo.env("LLVM_LINKER_FLAGS", llvm_linker_flags); } - // Building with a static libstdc++ is only supported on linux right now, - // not for MSVC or macOS - if builder.config.llvm_static_stdcpp - && !target.contains("freebsd") - && !target.is_msvc() - && !target.contains("apple") - && !target.contains("solaris") - { - let file = compiler_file( - builder, - &builder.cxx(target).unwrap(), - target, - CLang::Cxx, - "libstdc++.a", - ); - cargo.env("LLVM_STATIC_STDCPP", file); - } if builder.llvm_link_shared() { cargo.env("LLVM_LINK_SHARED", "1"); }