Skip to content

Commit d0b7e71

Browse files
committed
Add LTONotSupported
1 parent d9aa635 commit d0b7e71

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

compiler/rustc_codegen_gcc/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 {

compiler/rustc_codegen_gcc/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");

compiler/rustc_error_messages/locales/en-US/codegen_gcc.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ codegen_gcc_linkage_const_or_mut_type =
66
77
codegen_gcc_unwinding_inline_asm =
88
GCC backend does not support unwinding from inline asm
9+
10+
codegen_gcc_lto_not_supported =
11+
LTO is not supported. You may get a linker error.

0 commit comments

Comments
 (0)