* Re: [PATCH] kbuild: fix duplicated flags in DEBUG_CFLAGS
2021-02-03 7:52 [PATCH] kbuild: fix duplicated flags in DEBUG_CFLAGS Masahiro Yamada
@ 2021-02-03 8:19 ` Sedat Dilek
2021-02-03 8:31 ` Sedat Dilek
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Sedat Dilek @ 2021-02-03 8:19 UTC (permalink / raw)
To: Masahiro Yamada
Cc: linux-kbuild, Nick Desaulniers, Andi Kleen, Ian Rogers,
Mark Wielaard, Michal Marek, Nathan Chancellor,
Clang-Built-Linux ML, linux-kernel
On Wed, Feb 3, 2021 at 8:53 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> Sedat Dilek noticed duplicated debug flags passed when building C
> files with CONFIG_DEBUG_INFO.
>
> I do not know much about his build environment, but yes, Kbuild
> recurses to the top Makefile with some build targets. For example,
> 'make CC=clang bindeb-pkg' reproduces the issue.
>
> With commit 121c5d08d53c ("kbuild: Only add -fno-var-tracking-assignments
> for old GCC versions") applied, DEBUG_CFLAGS is now reset only when
> CONFIG_CC_IS_GCC=y.
>
> Fix it to reset DEBUG_CFLAGS also when using Clang.
>
Great, Masahiro!
I wanted to request an "undrunken" switch for GNU/make :-).
- Sedat -
> Fixes: 121c5d08d53c ("kbuild: Only add -fno-var-tracking-assignments for old GCC versions")
> Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>
> Makefile | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 3d3f67b98ca2..769a38ee81b9 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -811,10 +811,12 @@ KBUILD_CFLAGS += -ftrivial-auto-var-init=zero
> KBUILD_CFLAGS += -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
> endif
>
> +DEBUG_CFLAGS :=
> +
> # Workaround for GCC versions < 5.0
> # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61801
> ifdef CONFIG_CC_IS_GCC
> -DEBUG_CFLAGS := $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-tracking-assignments))
> +DEBUG_CFLAGS += $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-tracking-assignments))
> endif
>
> ifdef CONFIG_DEBUG_INFO
> --
> 2.27.0
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] kbuild: fix duplicated flags in DEBUG_CFLAGS
2021-02-03 7:52 [PATCH] kbuild: fix duplicated flags in DEBUG_CFLAGS Masahiro Yamada
2021-02-03 8:19 ` Sedat Dilek
@ 2021-02-03 8:31 ` Sedat Dilek
2021-02-03 8:38 ` Masahiro Yamada
2021-02-03 10:31 ` Mark Wielaard
2021-02-03 17:38 ` Nathan Chancellor
3 siblings, 1 reply; 7+ messages in thread
From: Sedat Dilek @ 2021-02-03 8:31 UTC (permalink / raw)
To: Masahiro Yamada
Cc: linux-kbuild, Nick Desaulniers, Andi Kleen, Ian Rogers,
Mark Wielaard, Michal Marek, Nathan Chancellor,
Clang-Built-Linux ML, linux-kernel
On Wed, Feb 3, 2021 at 8:53 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> Sedat Dilek noticed duplicated debug flags passed when building C
> files with CONFIG_DEBUG_INFO.
>
> I do not know much about his build environment, but yes, Kbuild
> recurses to the top Makefile with some build targets. For example,
> 'make CC=clang bindeb-pkg' reproduces the issue.
>
> With commit 121c5d08d53c ("kbuild: Only add -fno-var-tracking-assignments
> for old GCC versions") applied, DEBUG_CFLAGS is now reset only when
> CONFIG_CC_IS_GCC=y.
>
> Fix it to reset DEBUG_CFLAGS also when using Clang.
>
> Fixes: 121c5d08d53c ("kbuild: Only add -fno-var-tracking-assignments for old GCC versions")
> Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
That fixes the issue for me:
Without patch:
... -Wno-unused-const-variable -g -gdwarf-5 -gz=zlib -g -gdwarf-5
-gz=zlib -pg -mfentry ...
With this patch:
... -Wno-unused-const-variable -g -gdwarf-5 -gz=zlib -pg -mfentry ...
The relevant Kconfigs:
$ grep DEBUG_INFO .config | grep ^CONFIG
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_INFO_COMPRESSED=y
CONFIG_DEBUG_INFO_DWARF5=y
Latest make-line:
$ /usr/bin/perf_5.10 stat make V=1 -j4 LLVM=1 LLVM_IAS=1
PAHOLE=/opt/pahole/bin/pahole LOCALVERSION=-4-amd64-clang12-
cfi-pgo KBUILD_VERBOSE=1 KBUILD_BUILD_HOST=iniza
KBUILD_BUILD_USER=sedat.dilek@gmail.com
KBUILD_BUILD_TIMESTAMP=2021-02-03 bindeb-pkg
KDEB_PKGVERSION=5.11.0~rc6-4~bull
seye+dileks1
Feel free to add my...
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Thanks again Masahiro.
- Sedat -
> ---
>
> Makefile | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 3d3f67b98ca2..769a38ee81b9 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -811,10 +811,12 @@ KBUILD_CFLAGS += -ftrivial-auto-var-init=zero
> KBUILD_CFLAGS += -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
> endif
>
> +DEBUG_CFLAGS :=
> +
> # Workaround for GCC versions < 5.0
> # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61801
> ifdef CONFIG_CC_IS_GCC
> -DEBUG_CFLAGS := $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-tracking-assignments))
> +DEBUG_CFLAGS += $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-tracking-assignments))
> endif
>
> ifdef CONFIG_DEBUG_INFO
> --
> 2.27.0
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] kbuild: fix duplicated flags in DEBUG_CFLAGS
2021-02-03 8:31 ` Sedat Dilek
@ 2021-02-03 8:38 ` Masahiro Yamada
2021-02-03 8:55 ` Sedat Dilek
0 siblings, 1 reply; 7+ messages in thread
From: Masahiro Yamada @ 2021-02-03 8:38 UTC (permalink / raw)
To: Sedat Dilek
Cc: Linux Kbuild mailing list, Nick Desaulniers, Andi Kleen,
Ian Rogers, Mark Wielaard, Michal Marek, Nathan Chancellor,
Clang-Built-Linux ML, Linux Kernel Mailing List
On Wed, Feb 3, 2021 at 5:32 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
>
> On Wed, Feb 3, 2021 at 8:53 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > Sedat Dilek noticed duplicated debug flags passed when building C
> > files with CONFIG_DEBUG_INFO.
> >
> > I do not know much about his build environment, but yes, Kbuild
> > recurses to the top Makefile with some build targets. For example,
> > 'make CC=clang bindeb-pkg' reproduces the issue.
> >
> > With commit 121c5d08d53c ("kbuild: Only add -fno-var-tracking-assignments
> > for old GCC versions") applied, DEBUG_CFLAGS is now reset only when
> > CONFIG_CC_IS_GCC=y.
> >
> > Fix it to reset DEBUG_CFLAGS also when using Clang.
> >
> > Fixes: 121c5d08d53c ("kbuild: Only add -fno-var-tracking-assignments for old GCC versions")
> > Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
>
> That fixes the issue for me:
>
> Without patch:
>
> ... -Wno-unused-const-variable -g -gdwarf-5 -gz=zlib -g -gdwarf-5
> -gz=zlib -pg -mfentry ...
>
> With this patch:
> ... -Wno-unused-const-variable -g -gdwarf-5 -gz=zlib -pg -mfentry ...
>
> The relevant Kconfigs:
>
> $ grep DEBUG_INFO .config | grep ^CONFIG
> CONFIG_DEBUG_INFO=y
> CONFIG_DEBUG_INFO_COMPRESSED=y
> CONFIG_DEBUG_INFO_DWARF5=y
>
> Latest make-line:
>
> $ /usr/bin/perf_5.10 stat make V=1 -j4 LLVM=1 LLVM_IAS=1
> PAHOLE=/opt/pahole/bin/pahole LOCALVERSION=-4-amd64-clang12-
> cfi-pgo KBUILD_VERBOSE=1 KBUILD_BUILD_HOST=iniza
> KBUILD_BUILD_USER=sedat.dilek@gmail.com
> KBUILD_BUILD_TIMESTAMP=2021-02-03 bindeb-pkg
Ah, OK.
You use bindeb-pkg for building the kernel.
That's why this happens only for you,
but Nick did not observe this issue.
> KDEB_PKGVERSION=5.11.0~rc6-4~bull
> seye+dileks1
>
> Feel free to add my...
>
> Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
>
> Thanks again Masahiro.
>
> - Sedat -
>
> > ---
> >
> > Makefile | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 3d3f67b98ca2..769a38ee81b9 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -811,10 +811,12 @@ KBUILD_CFLAGS += -ftrivial-auto-var-init=zero
> > KBUILD_CFLAGS += -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
> > endif
> >
> > +DEBUG_CFLAGS :=
> > +
> > # Workaround for GCC versions < 5.0
> > # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61801
> > ifdef CONFIG_CC_IS_GCC
> > -DEBUG_CFLAGS := $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-tracking-assignments))
> > +DEBUG_CFLAGS += $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-tracking-assignments))
> > endif
> >
> > ifdef CONFIG_DEBUG_INFO
> > --
> > 2.27.0
> >
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] kbuild: fix duplicated flags in DEBUG_CFLAGS
2021-02-03 8:38 ` Masahiro Yamada
@ 2021-02-03 8:55 ` Sedat Dilek
0 siblings, 0 replies; 7+ messages in thread
From: Sedat Dilek @ 2021-02-03 8:55 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Linux Kbuild mailing list, Nick Desaulniers, Andi Kleen,
Ian Rogers, Mark Wielaard, Michal Marek, Nathan Chancellor,
Clang-Built-Linux ML, Linux Kernel Mailing List
On Wed, Feb 3, 2021 at 9:39 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Wed, Feb 3, 2021 at 5:32 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
> >
> > On Wed, Feb 3, 2021 at 8:53 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > >
> > > Sedat Dilek noticed duplicated debug flags passed when building C
> > > files with CONFIG_DEBUG_INFO.
> > >
> > > I do not know much about his build environment, but yes, Kbuild
> > > recurses to the top Makefile with some build targets. For example,
> > > 'make CC=clang bindeb-pkg' reproduces the issue.
> > >
> > > With commit 121c5d08d53c ("kbuild: Only add -fno-var-tracking-assignments
> > > for old GCC versions") applied, DEBUG_CFLAGS is now reset only when
> > > CONFIG_CC_IS_GCC=y.
> > >
> > > Fix it to reset DEBUG_CFLAGS also when using Clang.
> > >
> > > Fixes: 121c5d08d53c ("kbuild: Only add -fno-var-tracking-assignments for old GCC versions")
> > > Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> >
> > That fixes the issue for me:
> >
> > Without patch:
> >
> > ... -Wno-unused-const-variable -g -gdwarf-5 -gz=zlib -g -gdwarf-5
> > -gz=zlib -pg -mfentry ...
> >
> > With this patch:
> > ... -Wno-unused-const-variable -g -gdwarf-5 -gz=zlib -pg -mfentry ...
> >
> > The relevant Kconfigs:
> >
> > $ grep DEBUG_INFO .config | grep ^CONFIG
> > CONFIG_DEBUG_INFO=y
> > CONFIG_DEBUG_INFO_COMPRESSED=y
> > CONFIG_DEBUG_INFO_DWARF5=y
> >
> > Latest make-line:
> >
> > $ /usr/bin/perf_5.10 stat make V=1 -j4 LLVM=1 LLVM_IAS=1
> > PAHOLE=/opt/pahole/bin/pahole LOCALVERSION=-4-amd64-clang12-
> > cfi-pgo KBUILD_VERBOSE=1 KBUILD_BUILD_HOST=iniza
> > KBUILD_BUILD_USER=sedat.dilek@gmail.com
> > KBUILD_BUILD_TIMESTAMP=2021-02-03 bindeb-pkg
>
>
> Ah, OK.
> You use bindeb-pkg for building the kernel.
>
> That's why this happens only for you,
> but Nick did not observe this issue.
>
I guess so.
- sed@ -
>
> > KDEB_PKGVERSION=5.11.0~rc6-4~bull
> > seye+dileks1
> >
> > Feel free to add my...
> >
> > Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
> >
> > Thanks again Masahiro.
> >
> > - Sedat -
> >
> > > ---
> > >
> > > Makefile | 4 +++-
> > > 1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/Makefile b/Makefile
> > > index 3d3f67b98ca2..769a38ee81b9 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -811,10 +811,12 @@ KBUILD_CFLAGS += -ftrivial-auto-var-init=zero
> > > KBUILD_CFLAGS += -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
> > > endif
> > >
> > > +DEBUG_CFLAGS :=
> > > +
> > > # Workaround for GCC versions < 5.0
> > > # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61801
> > > ifdef CONFIG_CC_IS_GCC
> > > -DEBUG_CFLAGS := $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-tracking-assignments))
> > > +DEBUG_CFLAGS += $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-tracking-assignments))
> > > endif
> > >
> > > ifdef CONFIG_DEBUG_INFO
> > > --
> > > 2.27.0
> > >
>
>
>
> --
> Best Regards
> Masahiro Yamada
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] kbuild: fix duplicated flags in DEBUG_CFLAGS
2021-02-03 7:52 [PATCH] kbuild: fix duplicated flags in DEBUG_CFLAGS Masahiro Yamada
2021-02-03 8:19 ` Sedat Dilek
2021-02-03 8:31 ` Sedat Dilek
@ 2021-02-03 10:31 ` Mark Wielaard
2021-02-03 17:38 ` Nathan Chancellor
3 siblings, 0 replies; 7+ messages in thread
From: Mark Wielaard @ 2021-02-03 10:31 UTC (permalink / raw)
To: Masahiro Yamada, linux-kbuild
Cc: Sedat Dilek, Nick Desaulniers, Andi Kleen, Ian Rogers,
Michal Marek, Nathan Chancellor, clang-built-linux, linux-kernel
Hi Masahiro,
On Wed, 2021-02-03 at 16:52 +0900, Masahiro Yamada wrote:
> With commit 121c5d08d53c ("kbuild: Only add -fno-var-tracking-
> assignments
> for old GCC versions") applied, DEBUG_CFLAGS is now reset only when
> CONFIG_CC_IS_GCC=y.
>
> Fix it to reset DEBUG_CFLAGS also when using Clang.
>
> [...]
> +DEBUG_CFLAGS :=
> +
> # Workaround for GCC versions < 5.0
> # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61801
> ifdef CONFIG_CC_IS_GCC
> -DEBUG_CFLAGS := $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-tracking-assignments))
> +DEBUG_CFLAGS += $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-tracking-assignments))
> endif
Yes, this makes sense given that the original code, before commit
121c5d08d53c did always set DEBUG_CFLAGS without checking for
CONFIG_CC_IS_GCC. So it behaved like the above code does.
Reviewed-by: Mark Wielaard <mark@klomp.org>
Thanks,
Mark
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] kbuild: fix duplicated flags in DEBUG_CFLAGS
2021-02-03 7:52 [PATCH] kbuild: fix duplicated flags in DEBUG_CFLAGS Masahiro Yamada
` (2 preceding siblings ...)
2021-02-03 10:31 ` Mark Wielaard
@ 2021-02-03 17:38 ` Nathan Chancellor
3 siblings, 0 replies; 7+ messages in thread
From: Nathan Chancellor @ 2021-02-03 17:38 UTC (permalink / raw)
To: Masahiro Yamada
Cc: linux-kbuild, Sedat Dilek, Nick Desaulniers, Andi Kleen,
Ian Rogers, Mark Wielaard, Michal Marek, Nathan Chancellor,
clang-built-linux, linux-kernel
On Wed, Feb 03, 2021 at 04:52:39PM +0900, Masahiro Yamada wrote:
> Sedat Dilek noticed duplicated debug flags passed when building C
> files with CONFIG_DEBUG_INFO.
>
> I do not know much about his build environment, but yes, Kbuild
> recurses to the top Makefile with some build targets. For example,
> 'make CC=clang bindeb-pkg' reproduces the issue.
>
> With commit 121c5d08d53c ("kbuild: Only add -fno-var-tracking-assignments
> for old GCC versions") applied, DEBUG_CFLAGS is now reset only when
> CONFIG_CC_IS_GCC=y.
>
> Fix it to reset DEBUG_CFLAGS also when using Clang.
>
> Fixes: 121c5d08d53c ("kbuild: Only add -fno-var-tracking-assignments for old GCC versions")
> Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> ---
>
> Makefile | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 3d3f67b98ca2..769a38ee81b9 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -811,10 +811,12 @@ KBUILD_CFLAGS += -ftrivial-auto-var-init=zero
> KBUILD_CFLAGS += -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
> endif
>
> +DEBUG_CFLAGS :=
> +
> # Workaround for GCC versions < 5.0
> # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61801
> ifdef CONFIG_CC_IS_GCC
> -DEBUG_CFLAGS := $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-tracking-assignments))
> +DEBUG_CFLAGS += $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-tracking-assignments))
> endif
>
> ifdef CONFIG_DEBUG_INFO
> --
> 2.27.0
>
^ permalink raw reply [flat|nested] 7+ messages in thread