auto merge of #18592 : alexcrichton/rust/dylib-harder, r=pcwalton
If a dylib is being produced, the compiler will now first check to see if it can be created entirely statically before falling back to dynamic dependencies. This behavior can be overridden with `-C prefer-dynamic`. Due to the alteration in behavior, this is a breaking change. Any previous users relying on dylibs implicitly maximizing dynamic dependencies should start passing `-C prefer-dynamic` to compilations. Closes #18499 [breaking-change]
This commit is contained in:
commit
eca8f11315
20 changed files with 108 additions and 44 deletions
|
|
@ -123,6 +123,16 @@ fn calculate_type(sess: &session::Session,
|
|||
return Vec::new();
|
||||
}
|
||||
|
||||
// Generating a dylib without `-C prefer-dynamic` means that we're going
|
||||
// to try to eagerly statically link all dependencies. This is normally
|
||||
// done for end-product dylibs, not intermediate products.
|
||||
config::CrateTypeDylib if !sess.opts.cg.prefer_dynamic => {
|
||||
match attempt_static(sess) {
|
||||
Some(v) => return v,
|
||||
None => {}
|
||||
}
|
||||
}
|
||||
|
||||
// Everything else falls through below
|
||||
config::CrateTypeExecutable | config::CrateTypeDylib => {},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue