[5/5] compiler-gcc: document minimum version for `__no_sanitize_coverage__`

Message ID 20221021115956.9947-5-ojeda@kernel.org
State New
Headers
Series [1/5] compiler-gcc: be consistent with underscores use for `no_sanitize` |

Commit Message

Miguel Ojeda Oct. 21, 2022, 11:59 a.m. UTC
  The attribute was added in GCC 12.1.

This will simplify future cleanups, and is closer to what we do
in `compiler_attributes.h`.

Link: https://godbolt.org/z/MGbT76j6G
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
 include/linux/compiler-gcc.h | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Marco Elver Oct. 21, 2022, 2:55 p.m. UTC | #1
On Fri, 21 Oct 2022 at 05:00, Miguel Ojeda <ojeda@kernel.org> wrote:
>
> The attribute was added in GCC 12.1.
>
> This will simplify future cleanups, and is closer to what we do
> in `compiler_attributes.h`.
>
> Link: https://godbolt.org/z/MGbT76j6G
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

Acked-by: Marco Elver <elver@google.com>

> ---
>  include/linux/compiler-gcc.h | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
> index 7f2c2bb73815..7af9e34ec261 100644
> --- a/include/linux/compiler-gcc.h
> +++ b/include/linux/compiler-gcc.h
> @@ -92,6 +92,9 @@
>
>  #define __no_sanitize_undefined __attribute__((__no_sanitize_undefined__))
>
> +/*
> + * Only supported since gcc >= 12
> + */
>  #if defined(CONFIG_KCOV) && __has_attribute(__no_sanitize_coverage__)
>  #define __no_sanitize_coverage __attribute__((__no_sanitize_coverage__))
>  #else
> --
> 2.38.1
>
  
Kees Cook Oct. 21, 2022, 4:11 p.m. UTC | #2
On Fri, Oct 21, 2022 at 01:59:56PM +0200, Miguel Ojeda wrote:
> The attribute was added in GCC 12.1.
> 
> This will simplify future cleanups, and is closer to what we do
> in `compiler_attributes.h`.
> 
> Link: https://godbolt.org/z/MGbT76j6G
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

Reviewed-by: Kees Cook <keescook@chromium.org>
  
Nathan Chancellor Oct. 21, 2022, 9:20 p.m. UTC | #3
On Fri, Oct 21, 2022 at 01:59:56PM +0200, Miguel Ojeda wrote:
> The attribute was added in GCC 12.1.
> 
> This will simplify future cleanups, and is closer to what we do
> in `compiler_attributes.h`.
> 
> Link: https://godbolt.org/z/MGbT76j6G
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
>  include/linux/compiler-gcc.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
> index 7f2c2bb73815..7af9e34ec261 100644
> --- a/include/linux/compiler-gcc.h
> +++ b/include/linux/compiler-gcc.h
> @@ -92,6 +92,9 @@
>  
>  #define __no_sanitize_undefined __attribute__((__no_sanitize_undefined__))
>  
> +/*
> + * Only supported since gcc >= 12
> + */
>  #if defined(CONFIG_KCOV) && __has_attribute(__no_sanitize_coverage__)
>  #define __no_sanitize_coverage __attribute__((__no_sanitize_coverage__))
>  #else
> -- 
> 2.38.1
> 
>
  

Patch

diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 7f2c2bb73815..7af9e34ec261 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -92,6 +92,9 @@ 
 
 #define __no_sanitize_undefined __attribute__((__no_sanitize_undefined__))
 
+/*
+ * Only supported since gcc >= 12
+ */
 #if defined(CONFIG_KCOV) && __has_attribute(__no_sanitize_coverage__)
 #define __no_sanitize_coverage __attribute__((__no_sanitize_coverage__))
 #else