From a29805d822c4bffe47b464e1f62fca11c6c2b481 Mon Sep 17 00:00:00 2001
From: Richard Weinberger <richard@nod.at>
Date: Fri, 9 Aug 2024 11:54:29 +0200
Subject: [PATCH] compiler: Ensure __builtin_*_overflow() support

Both gcc and clang support this for a long time.
Make sure the feature is present.

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 include/linux/compiler_types.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index 1a3060117f..8b6ce9c11c 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -70,6 +70,13 @@ extern void __chk_io_ptr(const volatile void __iomem *);
 #error "Unknown compiler"
 #endif
 
+/*
+ * At least gcc 5.1 or clang 8 are needed.
+ */
+#ifndef COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW
+#error Unsupported compiler
+#endif
+
 /*
  * Some architectures need to provide custom definitions of macros provided
  * by linux/compiler-*.h, and can do so using asm/compiler.h. We include that
-- 
2.39.5