[PATCH] Makefile.kcov: apply needed compiler option unconditionally in CFLAGS_KCOV

Lukas Bulwahn posted 1 patch 7 months, 1 week ago
scripts/Makefile.kcov | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] Makefile.kcov: apply needed compiler option unconditionally in CFLAGS_KCOV
Posted by Lukas Bulwahn 7 months, 1 week ago
From: Lukas Bulwahn <lukas.bulwahn@redhat.com>

Commit 852faf805539 ("gcc-plugins: remove SANCOV gcc plugin") removes the
config CC_HAS_SANCOV_TRACE_PC, as all supported compilers include the
compiler option '-fsanitize-coverage=trace-pc' by now.

The commit however misses the important use of this config option in
Makefile.kcov to add '-fsanitize-coverage=trace-pc' to CFLAGS_KCOV.
Include the compiler option '-fsanitize-coverage=trace-pc' unconditionally
to CFLAGS_KCOV, as all compilers provide that option now.

Fixes: 852faf805539 ("gcc-plugins: remove SANCOV gcc plugin")
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@redhat.com>
---
 scripts/Makefile.kcov | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Makefile.kcov b/scripts/Makefile.kcov
index 67de7942b3e7..01616472f43e 100644
--- a/scripts/Makefile.kcov
+++ b/scripts/Makefile.kcov
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0-only
-kcov-flags-$(CONFIG_CC_HAS_SANCOV_TRACE_PC)	+= -fsanitize-coverage=trace-pc
+kcov-flags-y					+= -fsanitize-coverage=trace-pc
 kcov-flags-$(CONFIG_KCOV_ENABLE_COMPARISONS)	+= -fsanitize-coverage=trace-cmp
 
 export CFLAGS_KCOV := $(kcov-flags-y)
-- 
2.49.0
Re: [PATCH] Makefile.kcov: apply needed compiler option unconditionally in CFLAGS_KCOV
Posted by Nathan Chancellor 7 months, 1 week ago
On Wed, May 07, 2025 at 03:30:43PM +0200, Lukas Bulwahn wrote:
> From: Lukas Bulwahn <lukas.bulwahn@redhat.com>
> 
> Commit 852faf805539 ("gcc-plugins: remove SANCOV gcc plugin") removes the
> config CC_HAS_SANCOV_TRACE_PC, as all supported compilers include the
> compiler option '-fsanitize-coverage=trace-pc' by now.
> 
> The commit however misses the important use of this config option in
> Makefile.kcov to add '-fsanitize-coverage=trace-pc' to CFLAGS_KCOV.
> Include the compiler option '-fsanitize-coverage=trace-pc' unconditionally
> to CFLAGS_KCOV, as all compilers provide that option now.
> 
> Fixes: 852faf805539 ("gcc-plugins: remove SANCOV gcc plugin")
> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@redhat.com>

Good catch.

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

> ---
>  scripts/Makefile.kcov | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/Makefile.kcov b/scripts/Makefile.kcov
> index 67de7942b3e7..01616472f43e 100644
> --- a/scripts/Makefile.kcov
> +++ b/scripts/Makefile.kcov
> @@ -1,5 +1,5 @@
>  # SPDX-License-Identifier: GPL-2.0-only
> -kcov-flags-$(CONFIG_CC_HAS_SANCOV_TRACE_PC)	+= -fsanitize-coverage=trace-pc
> +kcov-flags-y					+= -fsanitize-coverage=trace-pc
>  kcov-flags-$(CONFIG_KCOV_ENABLE_COMPARISONS)	+= -fsanitize-coverage=trace-cmp
>  
>  export CFLAGS_KCOV := $(kcov-flags-y)
> -- 
> 2.49.0
>
Re: [PATCH] Makefile.kcov: apply needed compiler option unconditionally in CFLAGS_KCOV
Posted by Dmitry Vyukov 6 months, 4 weeks ago
On Thu, 8 May 2025 at 18:44, Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Wed, May 07, 2025 at 03:30:43PM +0200, Lukas Bulwahn wrote:
> > From: Lukas Bulwahn <lukas.bulwahn@redhat.com>
> >
> > Commit 852faf805539 ("gcc-plugins: remove SANCOV gcc plugin") removes the
> > config CC_HAS_SANCOV_TRACE_PC, as all supported compilers include the
> > compiler option '-fsanitize-coverage=trace-pc' by now.
> >
> > The commit however misses the important use of this config option in
> > Makefile.kcov to add '-fsanitize-coverage=trace-pc' to CFLAGS_KCOV.
> > Include the compiler option '-fsanitize-coverage=trace-pc' unconditionally
> > to CFLAGS_KCOV, as all compilers provide that option now.
> >
> > Fixes: 852faf805539 ("gcc-plugins: remove SANCOV gcc plugin")
> > Signed-off-by: Lukas Bulwahn <lukas.bulwahn@redhat.com>
>
> Good catch.
>
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>

Reviewed-by: Dmitry Vyukov <dvyukov@google.com>

Thanks for fixing this!

> > ---
> >  scripts/Makefile.kcov | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/scripts/Makefile.kcov b/scripts/Makefile.kcov
> > index 67de7942b3e7..01616472f43e 100644
> > --- a/scripts/Makefile.kcov
> > +++ b/scripts/Makefile.kcov
> > @@ -1,5 +1,5 @@
> >  # SPDX-License-Identifier: GPL-2.0-only
> > -kcov-flags-$(CONFIG_CC_HAS_SANCOV_TRACE_PC)  += -fsanitize-coverage=trace-pc
> > +kcov-flags-y                                 += -fsanitize-coverage=trace-pc
> >  kcov-flags-$(CONFIG_KCOV_ENABLE_COMPARISONS) += -fsanitize-coverage=trace-cmp
> >
> >  export CFLAGS_KCOV := $(kcov-flags-y)
> > --
> > 2.49.0
> >
Re: [PATCH] Makefile.kcov: apply needed compiler option unconditionally in CFLAGS_KCOV
Posted by Alexander Potapenko 6 months, 3 weeks ago
On Tue, May 20, 2025 at 4:57 PM 'Dmitry Vyukov' via kasan-dev
<kasan-dev@googlegroups.com> wrote:
>
> On Thu, 8 May 2025 at 18:44, Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > On Wed, May 07, 2025 at 03:30:43PM +0200, Lukas Bulwahn wrote:
> > > From: Lukas Bulwahn <lukas.bulwahn@redhat.com>
> > >
> > > Commit 852faf805539 ("gcc-plugins: remove SANCOV gcc plugin") removes the
> > > config CC_HAS_SANCOV_TRACE_PC, as all supported compilers include the
> > > compiler option '-fsanitize-coverage=trace-pc' by now.
> > >
> > > The commit however misses the important use of this config option in
> > > Makefile.kcov to add '-fsanitize-coverage=trace-pc' to CFLAGS_KCOV.
> > > Include the compiler option '-fsanitize-coverage=trace-pc' unconditionally
> > > to CFLAGS_KCOV, as all compilers provide that option now.
> > >
> > > Fixes: 852faf805539 ("gcc-plugins: remove SANCOV gcc plugin")
> > > Signed-off-by: Lukas Bulwahn <lukas.bulwahn@redhat.com>
> >
> > Good catch.
> >
> > Reviewed-by: Nathan Chancellor <nathan@kernel.org>
>
> Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
>
> Thanks for fixing this!

@akpm, could you please take this patch at your convenience?