Skip to content

Commit

Permalink
Rollup merge of rust-lang#110917 - Be-ing:whole_archive_with_staticli…
Browse files Browse the repository at this point in the history
…b_fix, r=petrochenkov

only error combining +whole-archive and +bundle for rlibs

Fixes rust-lang#110912

Checking `flavor == RlibFlavor::Normal` was accidentally lost in 601fc8b
rust-lang#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.

cc `@petrochenkov`
  • Loading branch information
matthiaskrgr authored Apr 28, 2023
2 parents 9ab5dd5 + 6a89e94 commit 0a9d44d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,10 @@ fn link_rlib<'a>(
let NativeLibKind::Static { bundle: None | Some(true), whole_archive } = lib.kind else {
continue;
};
if whole_archive == Some(true) && !codegen_results.crate_info.feature_packed_bundled_libs {
if whole_archive == Some(true)
&& flavor == RlibFlavor::Normal
&& !codegen_results.crate_info.feature_packed_bundled_libs
{
sess.emit_err(errors::IncompatibleLinkingModifiers);
}
if flavor == RlibFlavor::Normal && let Some(filename) = lib.filename {
Expand Down

0 comments on commit 0a9d44d

Please sign in to comment.