stabilize combining +bundle and +whole-archive link modifiers by Be-ing · Pull Request #113301 · rust-lang/rust (original) (raw)

Sorry for letting this sit for a while. @petrochenkov I have rebased it and addressed review comments.

Brief summary

Currently, combining +bundle and +whole-archive works only with #![feature(packed_bundled_libs)]. This crate feature is independent of the -Zpacked-bundled-libs command line option.

This commit stabilizes the #![feature(packed_bundled_libs)] crate feature and implicitly enables it only when the +bundle and +whole-archive link modifiers are combined. This allows rlib crates to use the +whole-archive link modifier with native libraries and have all symbols included in the linked library to be included in downstream staticlib crates that use the rlib as a dependency. Other cases requiring the packed_bundled_libs behavior still require the -Zpacked-bundled-libs command line option, which can be stabilized independently in the future.

Per discussion on #108081 there is no risk of regression stabilizing the crate feature in this way because the combination of +bundle,+whole-archive link modifiers was previously not allowed.

Documentation

I don't think anything needs to be updated for this? From users' perspective it's merely allowing a combination of existing link modifiers that previously failed with an error.

Tests

tests/run-make/rlib-format-packed-bundled-libs-3/rust_dep.rs

Real world example of Rust code requiring this feature: KDAB/cxx-qt#598

Unresolved questions

The -Zpacked-bundled-libs command line option is still unstable.