Skip to content

Commit a733c5b

Browse files
committed
Auto merge of rust-lang#128400 - petrochenkov:nowhole3, r=bjorn3
linker: Remove the "`--whole-archive` in test mode" backcompat hack Fixes rust-lang#116910.
2 parents 04ba50e + 3d2d7cf commit a733c5b

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
@@ -2646,16 +2646,7 @@ fn add_native_libs_from_crate(
26462646
NativeLibKind::Static { bundle, whole_archive } => {
26472647
if link_static {
26482648
let bundle = bundle.unwrap_or(true);
2649-
let whole_archive = whole_archive == Some(true)
2650-
// Backward compatibility case: this can be a rlib (so `+whole-archive`
2651-
// cannot be added explicitly if necessary, see the error in `fn link_rlib`)
2652-
// compiled as an executable due to `--test`. Use whole-archive implicitly,
2653-
// like before the introduction of native lib modifiers.
2654-
|| (whole_archive == None
2655-
&& bundle
2656-
&& cnum == LOCAL_CRATE
2657-
&& sess.is_test_crate());
2658-
2649+
let whole_archive = whole_archive == Some(true);
26592650
if bundle && cnum != LOCAL_CRATE {
26602651
if let Some(filename) = lib.filename {
26612652
// 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)