Skip to content

Commit 132305b

Browse files
committed
kbuild: stop filtering out $(GCC_PLUGINS_CFLAGS) from cc-option base
Commit d26e941 ("kbuild: no gcc-plugins during cc-option tests") was neeeded because scripts/Makefile.gcc-plugins was too early. This is unneeded by including scripts/Makefile.gcc-plugins last, and being careful to not add cc-option tests after it. Signed-off-by: Masahiro Yamada <[email protected]>
1 parent e0fe0bb commit 132305b

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,6 @@ KBUILD_CFLAGS_MODULE := -DMODULE
506506
KBUILD_LDFLAGS_MODULE :=
507507
export KBUILD_LDS_MODULE := $(srctree)/scripts/module-common.lds
508508
KBUILD_LDFLAGS :=
509-
GCC_PLUGINS_CFLAGS :=
510509
CLANG_FLAGS :=
511510

512511
export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC
@@ -955,6 +954,10 @@ include-$(CONFIG_GCC_PLUGINS) += scripts/Makefile.gcc-plugins
955954

956955
include $(addprefix $(srctree)/, $(include-y))
957956

957+
# scripts/Makefile.gcc-plugins is intentionally included last.
958+
# Do not add $(call cc-option,...) below this line. When you build the kernel
959+
# from the clean source tree, the GCC plugins do not exist at this point.
960+
958961
# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
959962
KBUILD_CPPFLAGS += $(KCPPFLAGS)
960963
KBUILD_AFLAGS += $(KAFLAGS)

scripts/Kbuild.include

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,25 +119,21 @@ as-instr = $(call try-run,\
119119
__cc-option = $(call try-run,\
120120
$(1) -Werror $(2) $(3) -c -x c /dev/null -o "$$TMP",$(3),$(4))
121121

122-
# Do not attempt to build with gcc plugins during cc-option tests.
123-
# (And this uses delayed resolution so the flags will be up to date.)
124-
CC_OPTION_CFLAGS = $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS))
125-
126122
# cc-option
127123
# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
128124

129125
cc-option = $(call __cc-option, $(CC),\
130-
$(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS),$(1),$(2))
126+
$(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS),$(1),$(2))
131127

132128
# cc-option-yn
133129
# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
134130
cc-option-yn = $(call try-run,\
135-
$(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
131+
$(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
136132

137133
# cc-disable-warning
138134
# Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
139135
cc-disable-warning = $(call try-run,\
140-
$(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
136+
$(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
141137

142138
# cc-ifversion
143139
# Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)

0 commit comments

Comments
 (0)