-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linking modifier whole-archive
and link time cfg
are not supported on bundled static libraries
#99429
Comments
We need to make bundled libraries behave more like regular static libraries The simplest way, which is also most compatible with traditional tooling is to literally move them out of rlibs to separate
It solves all the issues above:
The problem is that we'll have to teach cargo to track these new extra files. If the separate file solution doesn't work out we'll need to figure out how to bundle object files into rlibs in some smarter way, with preserving their old structure, and then how to repack them on the fly if they need to be represented as a static library. |
rustc-docs: Be less specific about the representation of `+bundle` For rust-lang#99429. r? `@bjorn3`
change rlib format to distinguish native dependencies Another one method to solve problem mentioned in rust-lang#99429. Changed .rlib format, it contains all bundled native libraries as archieves. At link time rlib is unpacked and native dependencies linked separately. New behavior hidden under separate_native_rlib_dependencies flag.
change rlib format to distinguish native dependencies Another one method to solve problem mentioned in rust-lang#99429. Changed .rlib format, it contains all bundled native libraries as archieves. At link time rlib is unpacked and native dependencies linked separately. New behavior hidden under separate_native_rlib_dependencies flag.
change rlib format to distinguish native dependencies Another one method to solve problem mentioned in rust-lang#99429. Changed .rlib format, it contains all bundled native libraries as archieves. At link time rlib is unpacked and native dependencies linked separately. New behavior hidden under separate_native_rlib_dependencies flag.
change rlib format to distinguish native dependencies Another one method to solve problem mentioned in rust-lang#99429. Changed .rlib format, it contains all bundled native libraries as archieves. At link time rlib is unpacked and native dependencies linked separately. New behavior hidden under separate_native_rlib_dependencies flag.
Support for this was implemented in #105601 under a feature gate |
The tracking issue - #108081. |
rustc-docs: Be less specific about the representation of `+bundle` For rust-lang/rust#99429. r? `@bjorn3`
rustc-docs: Be less specific about the representation of `+bundle` For rust-lang/rust#99429. r? `@bjorn3`
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 infoo-sys
rlibs bundling their nativelibfoo.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.
The text was updated successfully, but these errors were encountered: