Introduce dedicated -Zdylib-lto
flag for enabling LTO on dylib
s
This commit is contained in:
parent
cba16819a1
commit
c5c86806c8
11 changed files with 66 additions and 13 deletions
|
@ -82,10 +82,24 @@ fn prepare_lto(
|
|||
);
|
||||
return Err(e);
|
||||
} else if *crate_type == CrateType::Dylib {
|
||||
diag_handler.warn("LTO with dylibs may not be as effective");
|
||||
if !cgcx.opts.unstable_opts.dylib_lto {
|
||||
return Err(diag_handler
|
||||
.fatal("lto cannot be used for `dylib` crate type without `-Zdylib-lto`"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if cgcx.opts.cg.prefer_dynamic && !cgcx.opts.unstable_opts.dylib_lto {
|
||||
diag_handler
|
||||
.struct_err("cannot prefer dynamic linking when performing LTO")
|
||||
.note(
|
||||
"only 'staticlib', 'bin', and 'cdylib' outputs are \
|
||||
supported with LTO",
|
||||
)
|
||||
.emit();
|
||||
return Err(FatalError);
|
||||
}
|
||||
|
||||
for &(cnum, ref path) in cgcx.each_linked_rlib_for_lto.iter() {
|
||||
let exported_symbols =
|
||||
cgcx.exported_symbols.as_ref().expect("needs exported symbols for LTO");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue