public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] compiler-clang: add build check for clang 10.0.1
@ 2020-08-26 20:14 Nick Desaulniers
  2020-08-26 21:01 ` Kees Cook
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Nick Desaulniers @ 2020-08-26 20:14 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Nick Desaulniers, Sedat Dilek, Nathan Chancellor, Miguel Ojeda,
	Kees Cook, Marco Elver, Paul E. McKenney, Peter Zijlstra (Intel),
	Randy Dunlap, Ingo Molnar, Sami Tolvanen, linux-kernel,
	clang-built-linux

During Plumbers 2020, we voted to just support the latest release of
Clang for now.  Add a compile time check for this.

Older clang's may work, but we will likely drop workarounds for older
versions.

Link: https://github.com/ClangBuiltLinux/linux/issues/9
Link: https://github.com/ClangBuiltLinux/linux/issues/941
Suggested-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
 include/linux/compiler-clang.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
index cee0c728d39a..7338d3ffd240 100644
--- a/include/linux/compiler-clang.h
+++ b/include/linux/compiler-clang.h
@@ -3,6 +3,14 @@
 #error "Please don't include <linux/compiler-clang.h> directly, include <linux/compiler.h> instead."
 #endif
 
+#define CLANG_VERSION (__clang_major__ * 10000	\
+		     + __clang_minor__ * 100	\
+		     + __clang_patchlevel__)
+
+#if CLANG_VERSION < 100001
+# error Sorry, your compiler is too old - please upgrade it.
+#endif
+
 /* Compiler specific definitions for Clang compiler */
 
 /* same as gcc, this was present in clang-2.6 so we can assume it works
-- 
2.28.0.297.g1956fa8f8d-goog


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-08-31 23:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-26 20:14 [PATCH] compiler-clang: add build check for clang 10.0.1 Nick Desaulniers
2020-08-26 21:01 ` Kees Cook
2020-08-27  7:16   ` Sedat Dilek
2020-08-26 21:17 ` Miguel Ojeda
2020-08-26 21:26   ` Nathan Chancellor
2020-08-27  7:19     ` Sedat Dilek
2020-08-26 21:42 ` Nathan Chancellor
2020-08-27 19:02   ` Marco Elver
2020-08-28 10:54     ` Andrey Konovalov
2020-08-31 23:32   ` Nick Desaulniers
2020-08-31 23:36     ` Nick Desaulniers
2020-08-27  7:22 ` Sedat Dilek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox