From c35a1d40286ea806fb2225e3a6db852ba8dd71e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= Date: Fri, 25 Feb 2022 17:41:00 +0100 Subject: [PATCH] Fix MinGW target detection in raw-dylib LLVM target doesn't have to be the same as Rust target so relying on it is wrong. --- compiler/rustc_codegen_llvm/src/back/archive.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_codegen_llvm/src/back/archive.rs b/compiler/rustc_codegen_llvm/src/back/archive.rs index 1a2cec2a0d9..f814cc93043 100644 --- a/compiler/rustc_codegen_llvm/src/back/archive.rs +++ b/compiler/rustc_codegen_llvm/src/back/archive.rs @@ -151,7 +151,9 @@ impl<'a> ArchiveBuilder<'a> for LlvmArchiveBuilder<'a> { output_path.with_extension("lib") }; - let mingw_gnu_toolchain = self.config.sess.target.llvm_target.ends_with("pc-windows-gnu"); + let target = &self.config.sess.target; + let mingw_gnu_toolchain = + target.vendor == "pc" && target.os == "windows" && target.env == "gnu"; let import_name_and_ordinal_vector: Vec<(String, Option)> = dll_imports .iter()