1
Fork 0

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
This commit is contained in:
bors 2024-08-22 15:53:02 +00:00
commit 5ad98b4026
7 changed files with 74 additions and 4 deletions

View file

@ -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() });