Skip to content

Commit 33f1d8b

Browse files
committed
Auto merge of #128400 - petrochenkov:nowhole3, r=<try>
linker: Remove the "`--whole-archive` in test mode" backcompat hack Fixes #116910.
2 parents 1ddedba + 3d2d7cf commit 33f1d8b

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -2568,16 +2568,7 @@ fn add_native_libs_from_crate(
25682568
NativeLibKind::Static { bundle, whole_archive } => {
25692569
if link_static {
25702570
let bundle = bundle.unwrap_or(true);
2571-
let whole_archive = whole_archive == Some(true)
2572-
// Backward compatibility case: this can be a rlib (so `+whole-archive`
2573-
// cannot be added explicitly if necessary, see the error in `fn link_rlib`)
2574-
// compiled as an executable due to `--test`. Use whole-archive implicitly,
2575-
// like before the introduction of native lib modifiers.
2576-
|| (whole_archive == None
2577-
&& bundle
2578-
&& cnum == LOCAL_CRATE
2579-
&& sess.is_test_crate());
2580-
2571+
let whole_archive = whole_archive == Some(true);
25812572
if bundle && cnum != LOCAL_CRATE {
25822573
if let Some(filename) = lib.filename {
25832574
// If rlib contains native libs as archives, they are unpacked to tmpdir.

src/doc/rustc/src/command-line-arguments.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ This modifier translates to `--whole-archive` for `ld`-like linkers,
9696
to `/WHOLEARCHIVE` for `link.exe`, and to `-force_load` for `ld64`.
9797
The modifier does nothing for linkers that don't support it.
9898

99-
The default for this modifier is `-whole-archive`. \
100-
NOTE: The default may currently be different in some cases for backward compatibility,
101-
but it is not guaranteed. If you need whole archive semantics use `+whole-archive` explicitly.
99+
The default for this modifier is `-whole-archive`.
102100

103101
### Linking modifiers: `bundle`
104102

0 commit comments

Comments
 (0)