Skip to content

Commit 33b58eb

Browse files
committed
Add LTONotSupported
1 parent 7fc07ca commit 33b58eb

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/errors.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ pub(crate) struct LinkageConstOrMutType {
1414
pub span: Span
1515
}
1616

17+
#[derive(SessionDiagnostic)]
18+
#[diag(codegen_gcc::lto_not_supported)]
19+
pub(crate) struct LTONotSupported {}
20+
1721
#[derive(SessionDiagnostic)]
1822
#[diag(codegen_gcc::unwinding_inline_asm)]
1923
pub(crate) struct UnwindingInlineAsm {

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ mod type_of;
6161
use std::any::Any;
6262
use std::sync::{Arc, Mutex};
6363

64+
use crate::errors::LTONotSupported;
6465
use gccjit::{Context, OptimizationLevel, CType};
6566
use rustc_ast::expand::allocator::AllocatorKind;
6667
use rustc_codegen_ssa::{CodegenResults, CompiledModule, ModuleCodegen};
@@ -99,7 +100,7 @@ pub struct GccCodegenBackend {
99100
impl CodegenBackend for GccCodegenBackend {
100101
fn init(&self, sess: &Session) {
101102
if sess.lto() != Lto::No {
102-
sess.warn("LTO is not supported. You may get a linker error.");
103+
sess.emit_warning(LTONotSupported {});
103104
}
104105

105106
let temp_dir = TempDir::new().expect("cannot create temporary directory");

0 commit comments

Comments
 (0)