about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-08-22 15:53:02 +0000
committerbors <bors@rust-lang.org>2024-08-22 15:53:02 +0000
commit5ad98b4026d5172f27615b105658bc8bfd677be8 (patch)
treea548f35ae8a313a69ec0b1e3914a0dfc99b65edf /compiler/rustc_codegen_ssa/src
parent0f6e1ae67854c3c44726e8376144c16b465fe7c6 (diff)
parent40af2143f19c3f8fcd32513b0761198b64465242 (diff)
downloadrust-5ad98b4026d5172f27615b105658bc8bfd677be8.tar.gz
rust-5ad98b4026d5172f27615b105658bc8bfd677be8.zip
Auto merge of #129257 - ChrisDenton:rename-null-descriptor, r=jieyouxu
Allow rust staticlib to work with MSVC's /WHOLEARCHIVE

This fixes #129020 by renaming the `__NULL_IMPORT_DESCRIPTOR` to prevent conflicts.

try-job: dist-i686-msvc
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
-rw-r--r--compiler/rustc_codegen_ssa/src/back/archive.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/archive.rs b/compiler/rustc_codegen_ssa/src/back/archive.rs
index 38a440a707a..c8c1bd3e8f9 100644
--- a/compiler/rustc_codegen_ssa/src/back/archive.rs
+++ b/compiler/rustc_codegen_ssa/src/back/archive.rs
@@ -108,7 +108,11 @@ pub trait ArchiveBuilderBuilder {
                 &exports,
                 machine,
                 !sess.target.is_like_msvc,
-                /*comdat=*/ false,
+                // Enable compatibility with MSVC's `/WHOLEARCHIVE` flag.
+                // Without this flag a duplicate symbol error would be emitted
+                // when linking a rust staticlib using `/WHOLEARCHIVE`.
+                // See #129020
+                true,
             ) {
                 sess.dcx()
                     .emit_fatal(ErrorCreatingImportLibrary { lib_name, error: error.to_string() });