Skip to content

Commit 6a89e94

Browse files
committed
only error with +whole-archive,+bundle for rlibs
Fixes #110912 Checking `flavor == RlibFlavor::Normal` was accidentally lost in 601fc8b #105601 That caused combining +whole-archive and +bundle link modifiers on non-rlib crates to fail with a confusing error message saying that combination is unstable for rlibs. In particular, this caused the build to fail when +whole-archive was used on staticlib crates, even though +whole-archive effectively does nothing on non-bin crates because the final linker invocation is left to an external build system.
1 parent 901fdb3 commit 6a89e94

File tree

1 file changed

+4
-1
lines changed
  • compiler/rustc_codegen_ssa/src/back

1 file changed

+4
-1
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,10 @@ fn link_rlib<'a>(
349349
let NativeLibKind::Static { bundle: None | Some(true), whole_archive } = lib.kind else {
350350
continue;
351351
};
352-
if whole_archive == Some(true) && !codegen_results.crate_info.feature_packed_bundled_libs {
352+
if whole_archive == Some(true)
353+
&& flavor == RlibFlavor::Normal
354+
&& !codegen_results.crate_info.feature_packed_bundled_libs
355+
{
353356
sess.emit_err(errors::IncompatibleLinkingModifiers);
354357
}
355358
if flavor == RlibFlavor::Normal && let Some(filename) = lib.filename {

0 commit comments

Comments
 (0)