Add LTONotSupported

This commit is contained in:
Ellis Hoag 2022-08-26 20:50:37 -07:00
parent 7fc07caf67
commit 33b58ebf22
2 changed files with 6 additions and 1 deletions

View File

@ -14,6 +14,10 @@ pub(crate) struct LinkageConstOrMutType {
pub span: Span
}
#[derive(SessionDiagnostic)]
#[diag(codegen_gcc::lto_not_supported)]
pub(crate) struct LTONotSupported {}
#[derive(SessionDiagnostic)]
#[diag(codegen_gcc::unwinding_inline_asm)]
pub(crate) struct UnwindingInlineAsm {

View File

@ -61,6 +61,7 @@
use std::any::Any;
use std::sync::{Arc, Mutex};
use crate::errors::LTONotSupported;
use gccjit::{Context, OptimizationLevel, CType};
use rustc_ast::expand::allocator::AllocatorKind;
use rustc_codegen_ssa::{CodegenResults, CompiledModule, ModuleCodegen};
@ -99,7 +100,7 @@ pub struct GccCodegenBackend {
impl CodegenBackend for GccCodegenBackend {
fn init(&self, sess: &Session) {
if sess.lto() != Lto::No {
sess.warn("LTO is not supported. You may get a linker error.");
sess.emit_warning(LTONotSupported {});
}
let temp_dir = TempDir::new().expect("cannot create temporary directory");