All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kbuild: fix duplicated flags in DEBUG_CFLAGS
@ 2021-02-03  7:52 Masahiro Yamada
  2021-02-03  8:19 ` Sedat Dilek
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Masahiro Yamada @ 2021-02-03  7:52 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Sedat Dilek, Nick Desaulniers, Masahiro Yamada, Andi Kleen,
	Ian Rogers, Mark Wielaard, Michal Marek, Nathan Chancellor,
	clang-built-linux, linux-kernel

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>
---

 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 related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-02-03 17:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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  8:55     ` Sedat Dilek
2021-02-03 10:31 ` Mark Wielaard
2021-02-03 17:38 ` Nathan Chancellor

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.