diff options
| author | bors <bors@rust-lang.org> | 2022-04-04 02:23:15 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-04-04 02:23:15 +0000 |
| commit | ac4b3450ede3e5f694f78b991496fd30846c5932 (patch) | |
| tree | d0c1ff3d015df83c861fde5ebf85218c57d6061f /compiler/rustc_codegen_ssa/src/back | |
| parent | 596deceaac224b9bb4f7e65e2e37d4e2e242d6ad (diff) | |
| parent | a169d337e473aaa23a7703bba850259df7063464 (diff) | |
| download | rust-ac4b3450ede3e5f694f78b991496fd30846c5932.tar.gz rust-ac4b3450ede3e5f694f78b991496fd30846c5932.zip | |
Auto merge of #95606 - petrochenkov:linkregr, r=wesleywiser
linker: Implicitly link native libs as whole-archive in some more cases Partially revert changes from https://github.com/rust-lang/rust/pull/93901 to address regressions like https://github.com/rust-lang/rust/issues/95561. Fixes https://github.com/rust-lang/rust/issues/95561 r? `@wesleywiser`
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/back')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/link.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 84a1043a6a0..a727da05704 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -2080,9 +2080,14 @@ fn add_local_native_libraries( NativeLibKind::Framework { as_needed } => { cmd.link_framework(name, as_needed.unwrap_or(true)) } - NativeLibKind::Static { whole_archive, .. } => { + NativeLibKind::Static { whole_archive, bundle, .. } => { if whole_archive == Some(true) || (whole_archive == None && default_to_whole_archive(sess, crate_type, cmd)) + // Backward compatibility case: this can be a rlib (so `+whole-archive` cannot + // be added explicitly if necessary, see the error in `fn link_rlib`) compiled + // as an executable due to `--test`. Use whole-archive implicitly, like before + // the introduction of native lib modifiers. + || (bundle != Some(false) && sess.opts.test) { cmd.link_whole_staticlib( name, |
