Skip to content

Commit 315da87

Browse files
committed
kbuild: fix duplicated flags in DEBUG_CFLAGS
Sedat Dilek noticed duplicated flags in DEBUG_CFLAGS when building deb-pkg with CONFIG_DEBUG_INFO. For example, 'make CC=clang bindeb-pkg' reproduces the issue. Kbuild recurses to the top Makefile for some targets such as package builds. With commit 121c5d0 ("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 all the time. Fixes: 121c5d0 ("kbuild: Only add -fno-var-tracking-assignments for old GCC versions") Reported-by: Sedat Dilek <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]> Tested-by: Sedat Dilek <[email protected]> Reviewed-by: Mark Wielaard <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]>
1 parent 074075a commit 315da87

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,10 +811,12 @@ KBUILD_CFLAGS += -ftrivial-auto-var-init=zero
811811
KBUILD_CFLAGS += -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
812812
endif
813813

814+
DEBUG_CFLAGS :=
815+
814816
# Workaround for GCC versions < 5.0
815817
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61801
816818
ifdef CONFIG_CC_IS_GCC
817-
DEBUG_CFLAGS := $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-tracking-assignments))
819+
DEBUG_CFLAGS += $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-tracking-assignments))
818820
endif
819821

820822
ifdef CONFIG_DEBUG_INFO

0 commit comments

Comments
 (0)