-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Support dylib LTO #765
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
Comments
Why hasn't this happened yet? LTO is necessary for programs that attempt to dynamically load modules/algorithms, when you want to implement such a module in Rust. The fact that this, #![crate_type = "dylib"]
#![feature(no_std)]
// ...use stmts, C struct&enum declarations...
#[no_mangle]
pub unsafe extern "system" fn alg_run(p: *mut c_rect, dt: f64, stage: c_stage) -> c_int {
(if let Some(r) = p.as_mut() {
r.outputs[0] = 0.;
r.outputs[1] = 1.;
r.outputs[2] = 2.;
r.outputs[3] = 3.;
OK
} else {
NullPtr
}) as c_int
} compiles to a 724K dylib after optimization is revolting. I agree that static linking is better. But on platforms where it exists, for programs that use it, dynamic linking is sometimes absolutely necessary. Please stop neglecting it. |
Please try to recognize that the Rust project has a lot going on, in many different directions. There are tons of things which would be nice to have, but there are only so many hours in the day. |
Just for the record, you can simulate this by compiling to a staticlib and then converting it to a dylib. For example, on OS X:
|
We have the |
Tuesday Nov 11, 2014 at 00:52 GMT
For earlier discussion, see rust-lang/rust#18863
This issue was labelled with: in the Rust repository
Dylibs are currently bloated with useless library code, see #18541. This can be worked around in a platform specific manner using linker scripts, but the correct solution would be to build them with LTO.
The text was updated successfully, but these errors were encountered: