Skip to content

Commit feeeea9

Browse files
Rollup merge of #153503 - bjorn3:cg_gcc_thin_lto_fallback, r=antoyo
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. r? @antoyo
2 parents 783c9d3 + 15e839e commit feeeea9

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

compiler/rustc_session/src/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,5 +539,5 @@ pub(crate) struct UnexpectedBuiltinCfg {
539539
}
540540

541541
#[derive(Diagnostic)]
542-
#[diag("ThinLTO is not supported by the codegen backend")]
542+
#[diag("ThinLTO is not supported by the codegen backend, using fat LTO instead")]
543543
pub(crate) struct ThinLtoNotSupportedByBackend;

compiler/rustc_session/src/session.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,9 +620,9 @@ impl Session {
620620
config::LtoCli::Thin => {
621621
// The user explicitly asked for ThinLTO
622622
if !self.thin_lto_supported {
623-
// Backend doesn't support ThinLTO, disable LTO.
623+
// Backend doesn't support ThinLTO, fallback to fat LTO.
624624
self.dcx().emit_warn(errors::ThinLtoNotSupportedByBackend);
625-
return config::Lto::No;
625+
return config::Lto::Fat;
626626
}
627627
return config::Lto::Thin;
628628
}

0 commit comments

Comments
 (0)