Description
This is more or less a part of #81490.
If you try to combine +whole-archive
with (possibly implicit) +bundle
you will encounter this error: "linking modifiers +bundle
and +whole-archive
are not compatible with each other when generating rlibs".
The whole-archive
modifier is significantly limited due to this issue and cannot be used in foo-sys
rlibs bundling their native libfoo.a
dependencies, which is one of the main use cases.
We also have to enable the +whole-archive
modifier implicitly in one ad hoc case (https://github.com/rust-lang/rust/blob/master/compiler/rustc_codegen_ssa/src/back/link.rs#L2209-L2213) for backward compatibility, because it cannot be enabled manually.
cfg
for bundled static libraries was implemented just enough to make the case of musl libc bundled into libc crate to work, but it doesn't work in general case.
(Note that musl libc no longer uses bundling, see #72274.)
Also see #88085 and #88161 for some discussion related to this issue.