about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc
diff options
context:
space:
mode:
authorEllis Hoag <ellis.sparky.hoag@gmail.com>2022-08-26 20:50:37 -0700
committerEllis Hoag <ellis.sparky.hoag@gmail.com>2022-09-24 10:24:48 -0700
commitd0b7e7191850258979be7518b9ddce7c7cb555f0 (patch)
tree3d7ca975a522f36cb98a02a696be9db7705a53ae /compiler/rustc_codegen_gcc
parentd9aa635969b1fa3a00899ecc58a5c7076fd16f9d (diff)
downloadrust-d0b7e7191850258979be7518b9ddce7c7cb555f0.tar.gz
rust-d0b7e7191850258979be7518b9ddce7c7cb555f0.zip
Add LTONotSupported
Diffstat (limited to 'compiler/rustc_codegen_gcc')
-rw-r--r--compiler/rustc_codegen_gcc/src/errors.rs4
-rw-r--r--compiler/rustc_codegen_gcc/src/lib.rs3
2 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_gcc/src/errors.rs b/compiler/rustc_codegen_gcc/src/errors.rs
index e0c7dca8e32..1b2953952ef 100644
--- a/compiler/rustc_codegen_gcc/src/errors.rs
+++ b/compiler/rustc_codegen_gcc/src/errors.rs
@@ -15,6 +15,10 @@ pub(crate) struct LinkageConstOrMutType {
 }
 
 #[derive(SessionDiagnostic)]
+#[diag(codegen_gcc::lto_not_supported)]
+pub(crate) struct LTONotSupported {}
+
+#[derive(SessionDiagnostic)]
 #[diag(codegen_gcc::unwinding_inline_asm)]
 pub(crate) struct UnwindingInlineAsm {
     #[primary_span]
diff --git a/compiler/rustc_codegen_gcc/src/lib.rs b/compiler/rustc_codegen_gcc/src/lib.rs
index fc10112e55e..03f41d197b8 100644
--- a/compiler/rustc_codegen_gcc/src/lib.rs
+++ b/compiler/rustc_codegen_gcc/src/lib.rs
@@ -61,6 +61,7 @@ mod type_of;
 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");