Stabilize the bundle
native library modifier by petrochenkov · Pull Request #95818 · rust-lang/rust (original) (raw)
Stabilization Report
This PR stabilizes native library modifier bundle
, a part of RFC 2951: "Linking modifiers for native libraries" (tracking issue #83507).
The RFC was implemented about 1 year ago in #83507.
Before that it was implemented as a separate linbrary kind static-nobundle
in early 2017 in #38426.static-nobundle
kind was deprecated about 1 year ago and this PR removes it.
bundle
modifier
Examples: #[link(name = "mylib", kind = "static", modifiers = "-bundle")]
, -l static:-bundle=mylib
.
This modifier is only compatible with the static
linking kind.
Using any other kind will result in a compiler error.
When building a rlib or staticlib +bundle
means that all object files from the native static
library will be added to the rlib or staticlib archive, and then used from it during linking of
the final binary.
When building a rlib -bundle
means that the native static library is registered as a dependency
of that rlib "by name", and object files from it are included only during linking of the final
binary, the file search by that name is also performed during final linking.
When building a staticlib -bundle
means that the native static library is simply not included
into the archive and some higher level build system will need to add it later during linking of
the final binary.
This modifier has no effect when building other targets like executables or dynamic libraries.
The default for this modifier is +bundle
.
Test cases
src\test\run-make\native-link-modifier-*
src\test\ui\native-library-link-flags\*