Skip to contentSkip to conversation

set clang minimum version to 10.0.1

PATCH Superseded Nick Desaulniers 6 participants 21 messages Sep 1, 2020 – Sep 2, 2020

Subsystems (8)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Nick Desaulniers

author reviewer
#0 lore raw

v2 cover set clang minimum version to 10.0.1

Adds a compile time #error to compiler-clang.h setting the effective minimum supported version to clang 10.0.1. A separate patch has already been picked up into the Documentation/ tree also confirming the version.

Next are a series of reverts. One for 32b arm is a partial revert.

Then Marco suggested fixes to KASAN docs.

Finally, improve the warning for GCC too as per Kees.

Patches after 001 are new for v2.

Marco Elver (1):
kasan: Remove mentions of unsupported Clang versions

Nick Desaulniers (6):
compiler-clang: add build check for clang 10.0.1
Revert "kbuild: disable clang's default use of -fmerge-all-constants" Revert "arm64: bti: Require clang >= 10.0.1 for in-kernel BTI support" Revert "arm64: vdso: Fix compilation with clang older than 8" Partial revert "ARM: 8905/1: Emit __gnu_mcount_nc when using Clang

    10.0.0 or newer"

compiler-gcc: improve version warning

 Documentation/dev-tools/kasan.rst | 4 ++--
 Makefile                          | 9 ---------
 arch/arm/Kconfig                  | 2 +-
 arch/arm64/Kconfig                | 2 --
 arch/arm64/kernel/vdso/Makefile   | 7 -------
 include/linux/compiler-clang.h    | 8 ++++++++
 include/linux/compiler-gcc.h      | 2 +-
 lib/Kconfig.kasan                 | 9 ++++-----
 8 files changed, 16 insertions(+), 27 deletions(-)
Signature · 1 line
2.28.0.402.g5ffc5be6b7-goog
author reviewer
#1 lore raw

PATCH v2 1/7 compiler-clang: add build check for clang 10.0.1

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

We plan to remove workarounds for older versions now, which will break in subtle and not so subtle ways.

---
Changes V1 -> V2:
* use a more informational error, as per Kees.
* collect tags.

 include/linux/compiler-clang.h | 8 ++++++++
 1 file changed, 8 insertions(+)
include/linux/compiler-clang.h +8 -0
index cee0c728d39a..230604e7f057 100644
@@ -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 version of Clang is too old - please use 10.0.1 or newer.
+#endif
+
 /* Compiler specific definitions for Clang compiler */
 
 /* same as gcc, this was present in clang-2.6 so we can assume it works
Signature · 1 line
2.28.0.402.g5ffc5be6b7-goog
Reviewed-by Tested-by on v2 1/7
#2 lore raw

Re: [PATCH v2 1/7] compiler-clang: add build check for clang 10.0.1

Quoted 7 lines · Nick Desaulniers

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

We plan to remove workarounds for older versions now, which will break in subtle and not so subtle ways.

Quoted 11 lines

- Sedat -

Quoted 30 lines

---
Changes V1 -> V2:
* use a more informational error, as per Kees.
* collect tags.

 include/linux/compiler-clang.h | 8 ++++++++
 1 file changed, 8 insertions(+)
include/linux/compiler-clang.h +8 -1
index cee0c728d39a..230604e7f057 100644
@@ -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 version of Clang is too old - please use 10.0.1 or newer.
+#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.402.g5ffc5be6b7-goog

author reviewer
#3 lore raw

PATCH v2 2/7 Revert "kbuild: disable clang's default use of -fmerge-all-constants"

In reply to Nick Desaulniers

This reverts commit 87e0d4f0f37fb0c8c4aeeac46fff5e957738df79.

This was fixed in clang-6; the minimum supported version of clang in the kernel is clang-10 (10.0.1).

---
 Makefile | 9 ---------
 1 file changed, 9 deletions(-)
Makefile +0 -9
index 37739ee53f27..144ac6a073ff 100644
@@ -932,15 +932,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
 # disable invalid "can't wrap" optimizations for signed / pointers
 KBUILD_CFLAGS	+= $(call cc-option,-fno-strict-overflow)
 
-# clang sets -fmerge-all-constants by default as optimization, but this
-# is non-conforming behavior for C and in fact breaks the kernel, so we
-# need to disable it here generally.
-KBUILD_CFLAGS	+= $(call cc-option,-fno-merge-all-constants)
-
-# for gcc -fno-merge-all-constants disables everything, but it is fine
-# to have actual conforming behavior enabled.
-KBUILD_CFLAGS	+= $(call cc-option,-fmerge-constants)
-
 # Make sure -fstack-check isn't enabled (like gentoo apparently did)
 KBUILD_CFLAGS  += $(call cc-option,-fno-stack-check,)
 
Signature · 1 line
2.28.0.402.g5ffc5be6b7-goog
Reviewed-by on v2 2/7
#4 lore raw

Re: [PATCH v2 2/7] Revert "kbuild: disable clang's default use of -fmerge-all-constants"

Quoted 9 lines · Nick Desaulniers

This reverts commit 87e0d4f0f37fb0c8c4aeeac46fff5e957738df79.

This was fixed in clang-6; the minimum supported version of clang in the kernel is clang-10 (10.0.1).

Quoted 27 lines
---
 Makefile | 9 ---------
 1 file changed, 9 deletions(-)
Makefile +0 -9
index 37739ee53f27..144ac6a073ff 100644
@@ -932,15 +932,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
 # disable invalid "can't wrap" optimizations for signed / pointers
 KBUILD_CFLAGS	+= $(call cc-option,-fno-strict-overflow)
 
-# clang sets -fmerge-all-constants by default as optimization, but this
-# is non-conforming behavior for C and in fact breaks the kernel, so we
-# need to disable it here generally.
-KBUILD_CFLAGS	+= $(call cc-option,-fno-merge-all-constants)
-
-# for gcc -fno-merge-all-constants disables everything, but it is fine
-# to have actual conforming behavior enabled.
-KBUILD_CFLAGS	+= $(call cc-option,-fmerge-constants)
-
 # Make sure -fstack-check isn't enabled (like gentoo apparently did)
 KBUILD_CFLAGS  += $(call cc-option,-fno-stack-check,)
 
Signature · 1 line
2.28.0.402.g5ffc5be6b7-goog
Reviewed-by
#5 lore raw

Re: [PATCH v2 2/7] Revert "kbuild: disable clang's default use of -fmerge-all-constants"

Quoted 6 lines · Nathan Chancellor
Quoted 5 lines · Nick Desaulniers

This reverts commit 87e0d4f0f37fb0c8c4aeeac46fff5e957738df79.

This was fixed in clang-6; the minimum supported version of clang in the kernel is clang-10 (10.0.1).

Quoted 6 lines
Quoted 4 lines

How about expanding "This was fixed in clang-6" to be -fno-merge-all-constants has been the default since clang-6?

(Both gcc|clang -fmerge-all-constants can cause an assertion failure for the example on https://bugs.llvm.org/show_bug.cgi?id=18538 )

Quoted 32 lines
Quoted 27 lines
---
 Makefile | 9 ---------
 1 file changed, 9 deletions(-)
Makefile +0 -10
index 37739ee53f27..144ac6a073ff 100644
@@ -932,15 +932,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
 # disable invalid "can't wrap" optimizations for signed / pointers
 KBUILD_CFLAGS	+= $(call cc-option,-fno-strict-overflow)
 
-# clang sets -fmerge-all-constants by default as optimization, but this
-# is non-conforming behavior for C and in fact breaks the kernel, so we
-# need to disable it here generally.
-KBUILD_CFLAGS	+= $(call cc-option,-fno-merge-all-constants)
-
-# for gcc -fno-merge-all-constants disables everything, but it is fine
-# to have actual conforming behavior enabled.
-KBUILD_CFLAGS	+= $(call cc-option,-fmerge-constants)
-
 # Make sure -fstack-check isn't enabled (like gentoo apparently did)
 KBUILD_CFLAGS  += $(call cc-option,-fno-stack-check,)
 
--

2.28.0.402.g5ffc5be6b7-goog

Signature · 3 lines
You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20200901045516.GA1561318%40ubuntu-n2-xlarge-x86.
Reviewed-by Tested-by on v2 2/7
#6 lore raw

Re: [PATCH v2 2/7] Revert "kbuild: disable clang's default use of -fmerge-all-constants"

In reply to Nick Desaulniers
Quoted 10 lines · Nick Desaulniers

This reverts commit 87e0d4f0f37fb0c8c4aeeac46fff5e957738df79.

This was fixed in clang-6; the minimum supported version of clang in the kernel is clang-10 (10.0.1).

- Sedat -

Quoted 27 lines
---
 Makefile | 9 ---------
 1 file changed, 9 deletions(-)
Makefile +0 -10
index 37739ee53f27..144ac6a073ff 100644
@@ -932,15 +932,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
 # disable invalid "can't wrap" optimizations for signed / pointers
 KBUILD_CFLAGS  += $(call cc-option,-fno-strict-overflow)
 
-# clang sets -fmerge-all-constants by default as optimization, but this
-# is non-conforming behavior for C and in fact breaks the kernel, so we
-# need to disable it here generally.
-KBUILD_CFLAGS  += $(call cc-option,-fno-merge-all-constants)
-
-# for gcc -fno-merge-all-constants disables everything, but it is fine
-# to have actual conforming behavior enabled.
-KBUILD_CFLAGS  += $(call cc-option,-fmerge-constants)
-
 # Make sure -fstack-check isn't enabled (like gentoo apparently did)
 KBUILD_CFLAGS  += $(call cc-option,-fno-stack-check,)
 
--

2.28.0.402.g5ffc5be6b7-goog

author reviewer
#7 lore raw

PATCH v2 3/7 Revert "arm64: bti: Require clang >= 10.0.1 for in-kernel BTI support"

In reply to Nick Desaulniers

This reverts commit b9249cba25a5dce5de87e5404503a5e11832c2dd.

The minimum supported version of clang is now 10.0.1.

---
 arch/arm64/Kconfig | 2 --
 1 file changed, 2 deletions(-)
arch/arm64/Kconfig +0 -2
index 6d232837cbee..2a70b85b1a61 100644
@@ -1630,8 +1630,6 @@ config ARM64_BTI_KERNEL
 	depends on CC_HAS_BRANCH_PROT_PAC_RET_BTI
 	# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94697
 	depends on !CC_IS_GCC || GCC_VERSION >= 100100
-	# https://reviews.llvm.org/rGb8ae3fdfa579dbf366b1bb1cbfdbf8c51db7fa55
-	depends on !CC_IS_CLANG || CLANG_VERSION >= 100001
 	depends on !(CC_IS_CLANG && GCOV_KERNEL)
 	depends on (!FUNCTION_GRAPH_TRACER || DYNAMIC_FTRACE_WITH_REGS)
 	help
Signature · 1 line
2.28.0.402.g5ffc5be6b7-goog
Reviewed-by on v2 3/7
#8 lore raw

Re: [PATCH v2 3/7] Revert "arm64: bti: Require clang >= 10.0.1 for in-kernel BTI support"

Quoted 6 lines · Nick Desaulniers

This reverts commit b9249cba25a5dce5de87e5404503a5e11832c2dd.

The minimum supported version of clang is now 10.0.1.

Quoted 20 lines
---
 arch/arm64/Kconfig | 2 --
 1 file changed, 2 deletions(-)
arch/arm64/Kconfig +0 -2
index 6d232837cbee..2a70b85b1a61 100644
@@ -1630,8 +1630,6 @@ config ARM64_BTI_KERNEL
 	depends on CC_HAS_BRANCH_PROT_PAC_RET_BTI
 	# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94697
 	depends on !CC_IS_GCC || GCC_VERSION >= 100100
-	# https://reviews.llvm.org/rGb8ae3fdfa579dbf366b1bb1cbfdbf8c51db7fa55
-	depends on !CC_IS_CLANG || CLANG_VERSION >= 100001
 	depends on !(CC_IS_CLANG && GCOV_KERNEL)
 	depends on (!FUNCTION_GRAPH_TRACER || DYNAMIC_FTRACE_WITH_REGS)
 	help
Signature · 1 line
2.28.0.402.g5ffc5be6b7-goog
author reviewer
#9 lore raw

PATCH v2 4/7 Revert "arm64: vdso: Fix compilation with clang older than 8"

In reply to Nick Desaulniers

This reverts commit 3acf4be235280f14d838581a750532219d67facc.

The minimum supported version of clang is clang 10.0.1.

---
 arch/arm64/kernel/vdso/Makefile | 7 -------
 1 file changed, 7 deletions(-)
arch/arm64/kernel/vdso/Makefile +0 -7
index 45d5cfe46429..04021a93171c 100644
@@ -43,13 +43,6 @@ ifneq ($(c-gettimeofday-y),)
   CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y)
 endif
 
-# Clang versions less than 8 do not support -mcmodel=tiny
-ifeq ($(CONFIG_CC_IS_CLANG), y)
-  ifeq ($(shell test $(CONFIG_CLANG_VERSION) -lt 80000; echo $$?),0)
-    CFLAGS_REMOVE_vgettimeofday.o += -mcmodel=tiny
-  endif
-endif
-
 # Disable gcov profiling for VDSO code
 GCOV_PROFILE := n
 
Signature · 1 line
2.28.0.402.g5ffc5be6b7-goog
Reviewed-by on v2 4/7
#10 lore raw

Re: [PATCH v2 4/7] Revert "arm64: vdso: Fix compilation with clang older than 8"

Quoted 6 lines · Nick Desaulniers

This reverts commit 3acf4be235280f14d838581a750532219d67facc.

The minimum supported version of clang is clang 10.0.1.

Quoted 25 lines
---
 arch/arm64/kernel/vdso/Makefile | 7 -------
 1 file changed, 7 deletions(-)
arch/arm64/kernel/vdso/Makefile +0 -7
index 45d5cfe46429..04021a93171c 100644
@@ -43,13 +43,6 @@ ifneq ($(c-gettimeofday-y),)
   CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y)
 endif
 
-# Clang versions less than 8 do not support -mcmodel=tiny
-ifeq ($(CONFIG_CC_IS_CLANG), y)
-  ifeq ($(shell test $(CONFIG_CLANG_VERSION) -lt 80000; echo $$?),0)
-    CFLAGS_REMOVE_vgettimeofday.o += -mcmodel=tiny
-  endif
-endif
-
 # Disable gcov profiling for VDSO code
 GCOV_PROFILE := n
 
Signature · 1 line
2.28.0.402.g5ffc5be6b7-goog
author reviewer
#11 lore raw

PATCH v2 5/7 Partial revert "ARM: 8905/1: Emit __gnu_mcount_nc when using Clang 10.0.0 or newer"

In reply to Nick Desaulniers

This partially reverts commit b0fe66cf095016e0b238374c10ae366e1f087d11.

The minimum supported version of clang is now clang 10.0.1. We still want to pass -meabi=gnu.

---
 arch/arm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/Kconfig +1 -1
index 82c197a248dd..09a7669eea1d 100644
@@ -83,7 +83,7 @@ config ARM
 	select HAVE_FAST_GUP if ARM_LPAE
 	select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
 	select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG
-	select HAVE_FUNCTION_TRACER if !XIP_KERNEL && (CC_IS_GCC || CLANG_VERSION >= 100000)
+	select HAVE_FUNCTION_TRACER if !XIP_KERNEL
 	select HAVE_GCC_PLUGINS
 	select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
 	select HAVE_IDE if PCI || ISA || PCMCIA
Signature · 1 line
2.28.0.402.g5ffc5be6b7-goog
Reviewed-by on v2 5/7
#12 lore raw

Re: [PATCH v2 5/7] Partial revert "ARM: 8905/1: Emit __gnu_mcount_nc when using Clang 10.0.0 or newer"

Nit: Partially in commit message?

Quoted 4 lines · Nick Desaulniers

This partially reverts commit b0fe66cf095016e0b238374c10ae366e1f087d11.

The minimum supported version of clang is now clang 10.0.1. We still want to pass -meabi=gnu.

Thank you for calling this out.

Quoted 2 lines
Quoted 20 lines
---
 arch/arm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/Kconfig +1 -1
index 82c197a248dd..09a7669eea1d 100644
@@ -83,7 +83,7 @@ config ARM
 	select HAVE_FAST_GUP if ARM_LPAE
 	select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
 	select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG
-	select HAVE_FUNCTION_TRACER if !XIP_KERNEL && (CC_IS_GCC || CLANG_VERSION >= 100000)
+	select HAVE_FUNCTION_TRACER if !XIP_KERNEL
 	select HAVE_GCC_PLUGINS
 	select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
 	select HAVE_IDE if PCI || ISA || PCMCIA
Signature · 1 line
2.28.0.402.g5ffc5be6b7-goog
author reviewer
#13 lore raw

PATCH v2 6/7 kasan: Remove mentions of unsupported Clang versions

In reply to Nick Desaulniers

From: Marco Elver <[email protected]>

Since the kernel now requires at least Clang 10.0.1, remove any mention of old Clang versions and simplify the documentation.

---
 Documentation/dev-tools/kasan.rst | 4 ++--
 lib/Kconfig.kasan                 | 9 ++++-----
 2 files changed, 6 insertions(+), 7 deletions(-)
Documentation/dev-tools/kasan.rst +2 -2
index 38fd5681fade..4abc84b1798c 100644
@@ -13,10 +13,10 @@ KASAN uses compile-time instrumentation to insert validity checks before every
 memory access, and therefore requires a compiler version that supports that.
 
 Generic KASAN is supported in both GCC and Clang. With GCC it requires version
-8.3.0 or later. With Clang it requires version 7.0.0 or later, but detection of
+8.3.0 or later. Any supported Clang version is compatible, but detection of
 out-of-bounds accesses for global variables is only supported since Clang 11.
 
-Tag-based KASAN is only supported in Clang and requires version 7.0.0 or later.
+Tag-based KASAN is only supported in Clang.
 
 Currently generic KASAN is supported for the x86_64, arm64, xtensa, s390 and
 riscv architectures, and tag-based KASAN is supported only for arm64.
lib/Kconfig.kasan +4 -5
index 047b53dbfd58..033a5bc67ac4 100644
@@ -54,9 +54,9 @@ config KASAN_GENERIC
 	  Enables generic KASAN mode.
 
 	  This mode is supported in both GCC and Clang. With GCC it requires
-	  version 8.3.0 or later. With Clang it requires version 7.0.0 or
-	  later, but detection of out-of-bounds accesses for global variables
-	  is supported only since Clang 11.
+	  version 8.3.0 or later. Any supported Clang version is compatible,
+	  but detection of out-of-bounds accesses for global variables is
+	  supported only since Clang 11.
 
 	  This mode consumes about 1/8th of available memory at kernel start
 	  and introduces an overhead of ~x1.5 for the rest of the allocations.
@@ -78,8 +78,7 @@ config KASAN_SW_TAGS
 	  Enables software tag-based KASAN mode.
 
 	  This mode requires Top Byte Ignore support by the CPU and therefore
-	  is only supported for arm64. This mode requires Clang version 7.0.0
-	  or later.
+	  is only supported for arm64. This mode requires Clang.
 
 	  This mode consumes about 1/16th of available memory at kernel start
 	  and introduces an overhead of ~20% for the rest of the allocations.
Signature · 1 line
2.28.0.402.g5ffc5be6b7-goog
Reviewed-by on v2 6/7
#14 lore raw

Re: [PATCH v2 6/7] kasan: Remove mentions of unsupported Clang versions

Quoted 8 lines · Nick Desaulniers

From: Marco Elver <[email protected]>

Since the kernel now requires at least Clang 10.0.1, remove any mention of old Clang versions and simplify the documentation.

Quoted 52 lines
---
 Documentation/dev-tools/kasan.rst | 4 ++--
 lib/Kconfig.kasan                 | 9 ++++-----
 2 files changed, 6 insertions(+), 7 deletions(-)
Documentation/dev-tools/kasan.rst +2 -2
index 38fd5681fade..4abc84b1798c 100644
@@ -13,10 +13,10 @@ KASAN uses compile-time instrumentation to insert validity checks before every
 memory access, and therefore requires a compiler version that supports that.
 
 Generic KASAN is supported in both GCC and Clang. With GCC it requires version
-8.3.0 or later. With Clang it requires version 7.0.0 or later, but detection of
+8.3.0 or later. Any supported Clang version is compatible, but detection of
 out-of-bounds accesses for global variables is only supported since Clang 11.
 
-Tag-based KASAN is only supported in Clang and requires version 7.0.0 or later.
+Tag-based KASAN is only supported in Clang.
 
 Currently generic KASAN is supported for the x86_64, arm64, xtensa, s390 and
 riscv architectures, and tag-based KASAN is supported only for arm64.
lib/Kconfig.kasan +4 -5
index 047b53dbfd58..033a5bc67ac4 100644
@@ -54,9 +54,9 @@ config KASAN_GENERIC
 	  Enables generic KASAN mode.
 
 	  This mode is supported in both GCC and Clang. With GCC it requires
-	  version 8.3.0 or later. With Clang it requires version 7.0.0 or
-	  later, but detection of out-of-bounds accesses for global variables
-	  is supported only since Clang 11.
+	  version 8.3.0 or later. Any supported Clang version is compatible,
+	  but detection of out-of-bounds accesses for global variables is
+	  supported only since Clang 11.
 
 	  This mode consumes about 1/8th of available memory at kernel start
 	  and introduces an overhead of ~x1.5 for the rest of the allocations.
@@ -78,8 +78,7 @@ config KASAN_SW_TAGS
 	  Enables software tag-based KASAN mode.
 
 	  This mode requires Top Byte Ignore support by the CPU and therefore
-	  is only supported for arm64. This mode requires Clang version 7.0.0
-	  or later.
+	  is only supported for arm64. This mode requires Clang.
 
 	  This mode consumes about 1/16th of available memory at kernel start
 	  and introduces an overhead of ~20% for the rest of the allocations.
Signature · 1 line
2.28.0.402.g5ffc5be6b7-goog
author reviewer
#15 lore raw

PATCH v2 7/7 compiler-gcc: improve version error

In reply to Nick Desaulniers

As Kees suggests, do so provides developers with two useful pieces of information:
- The kernel build was attempting to use GCC.
(Maybe they accidentally poked the wrong configs in a CI.)
- They need 4.9 or better.
("Upgrade to what version?" doesn't need to be dug out of documentation,
headers, etc.)

---
 include/linux/compiler-gcc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/compiler-gcc.h +1 -1
index 7a3769040d7d..d1e3c6896b71 100644
@@ -12,7 +12,7 @@
 
 /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145 */
 #if GCC_VERSION < 40900
-# error Sorry, your compiler is too old - please upgrade it.
+# error Sorry, your version of GCC is too old - please use 4.9 or newer.
 #endif
 
 /* Optimization barrier */
Signature · 1 line
2.28.0.402.g5ffc5be6b7-goog
Reviewed-by on v2 7/7
#16 lore raw

Re: [PATCH v2 7/7] compiler-gcc: improve version error

Quoted 10 lines · Nick Desaulniers

As Kees suggests, do so provides developers with two useful pieces of information:
- The kernel build was attempting to use GCC.
(Maybe they accidentally poked the wrong configs in a CI.)
- They need 4.9 or better.
("Upgrade to what version?" doesn't need to be dug out of documentation,
headers, etc.)

It would be nice if there was some easy way to link the documentation here so that patches like commit 0bddd227f3dc ("Documentation: update for gcc 4.9 requirement") did not need to happen or be remembered.

Quoted 20 lines
---
 include/linux/compiler-gcc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/compiler-gcc.h +1 -1
index 7a3769040d7d..d1e3c6896b71 100644
@@ -12,7 +12,7 @@
 
 /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145 */
 #if GCC_VERSION < 40900
-# error Sorry, your compiler is too old - please upgrade it.
+# error Sorry, your version of GCC is too old - please use 4.9 or newer.
 #endif
 
 /* Optimization barrier */
Signature · 1 line
2.28.0.402.g5ffc5be6b7-goog
#18 lore raw
In reply to Nick Desaulniers
Quoted 16 lines · Nick Desaulniers

Adds a compile time #error to compiler-clang.h setting the effective minimum supported version to clang 10.0.1. A separate patch has already been picked up into the Documentation/ tree also confirming the version.

Next are a series of reverts. One for 32b arm is a partial revert.

Then Marco suggested fixes to KASAN docs.

Finally, improve the warning for GCC too as per Kees.

Patches after 001 are new for v2.

Marco Elver (1):
kasan: Remove mentions of unsupported Clang versions

Quoted 9 lines

Nick Desaulniers (6):
compiler-clang: add build check for clang 10.0.1
Revert "kbuild: disable clang's default use of -fmerge-all-constants" Revert "arm64: bti: Require clang >= 10.0.1 for in-kernel BTI support" Revert "arm64: vdso: Fix compilation with clang older than 8" Partial revert "ARM: 8905/1: Emit __gnu_mcount_nc when using Clang

    10.0.0 or newer"

compiler-gcc: improve version warning

I have tested theses 7 patches together with v2 of "Documentation: add minimum clang/llvm version".

- Sedat -

Quoted 13 lines
 Documentation/dev-tools/kasan.rst | 4 ++--
 Makefile                          | 9 ---------
 arch/arm/Kconfig                  | 2 +-
 arch/arm64/Kconfig                | 2 --
 arch/arm64/kernel/vdso/Makefile   | 7 -------
 include/linux/compiler-clang.h    | 8 ++++++++
 include/linux/compiler-gcc.h      | 2 +-
 lib/Kconfig.kasan                 | 9 ++++-----
 8 files changed, 16 insertions(+), 27 deletions(-)

--
2.28.0.402.g5ffc5be6b7-goog

Reviewed-by on the v2 series
#19 lore raw
In reply to Nick Desaulniers
Quoted 11 lines · Nick Desaulniers

Adds a compile time #error to compiler-clang.h setting the effective minimum supported version to clang 10.0.1. A separate patch has already been picked up into the Documentation/ tree also confirming the version.

Next are a series of reverts. One for 32b arm is a partial revert.

Then Marco suggested fixes to KASAN docs.

Finally, improve the warning for GCC too as per Kees. [...]

 8 files changed, 16 insertions(+), 27 deletions(-)

A nice simplification!

(I do note that for Ubuntu 20.04, they're going to need to do an LLVM 10.0.0 -> 10.0.1 bump to do kernel builds for their latest LTS...)

Signature · 1 line
Kees Cook
author reviewer
#20 lore raw
Quoted 16 lines · Kees Cook
Quoted 11 lines · Nick Desaulniers

Adds a compile time #error to compiler-clang.h setting the effective minimum supported version to clang 10.0.1. A separate patch has already been picked up into the Documentation/ tree also confirming the version.

Next are a series of reverts. One for 32b arm is a partial revert.

Then Marco suggested fixes to KASAN docs.

Finally, improve the warning for GCC too as per Kees. [...]

 8 files changed, 16 insertions(+), 27 deletions(-)

A nice simplification!

Quoted 7 lines

(I do note that for Ubuntu 20.04, they're going to need to do an LLVM 10.0.0 -> 10.0.1 bump to do kernel builds for their latest LTS...)

--
Kees Cook

I'll collect relevant tags and fixup feedback and send akpm a v3, maybe this afternoon. Thanks everyone for the reviews+feedback.

--
Thanks,
~Nick Desaulniers