mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Fallback to fat LTO for -Clto=thin in cg_gcc
Fallback to no LTO doesn't work in practice as Cargo asks rustc to produce LTO-only rlibs with -Clinker-plugin-lto without providing any indication if they will be used for thin or fat LTO, so we can't disable -Clinker-plugin-lto for ThinLTO when using cg_gcc.
This commit is contained in:
@@ -539,5 +539,5 @@ pub(crate) struct UnexpectedBuiltinCfg {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag("ThinLTO is not supported by the codegen backend")]
|
||||
#[diag("ThinLTO is not supported by the codegen backend, using fat LTO instead")]
|
||||
pub(crate) struct ThinLtoNotSupportedByBackend;
|
||||
|
||||
@@ -620,9 +620,9 @@ pub fn lto(&self) -> config::Lto {
|
||||
config::LtoCli::Thin => {
|
||||
// The user explicitly asked for ThinLTO
|
||||
if !self.thin_lto_supported {
|
||||
// Backend doesn't support ThinLTO, disable LTO.
|
||||
// Backend doesn't support ThinLTO, fallback to fat LTO.
|
||||
self.dcx().emit_warn(errors::ThinLtoNotSupportedByBackend);
|
||||
return config::Lto::No;
|
||||
return config::Lto::Fat;
|
||||
}
|
||||
return config::Lto::Thin;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user