Skip to content

Commit d26e941

Browse files
ephox-gcc-pluginskees
authored andcommitted
kbuild: no gcc-plugins during cc-option tests
The gcc-plugins arguments should not be included when performing cc-option tests. Steps to reproduce: 1) make mrproper 2) make defconfig 3) enable GCC_PLUGINS, GCC_PLUGIN_CYC_COMPLEXITY 4) enable FUNCTION_TRACER (it will select other options as well) 5) make && make modules Build errors: MODPOST 18 modules ERROR: "__fentry__" [net/netfilter/xt_nat.ko] undefined! ERROR: "__fentry__" [net/netfilter/xt_mark.ko] undefined! ERROR: "__fentry__" [net/netfilter/xt_addrtype.ko] undefined! ERROR: "__fentry__" [net/netfilter/xt_LOG.ko] undefined! ERROR: "__fentry__" [net/netfilter/nf_nat_sip.ko] undefined! ERROR: "__fentry__" [net/netfilter/nf_nat_irc.ko] undefined! ERROR: "__fentry__" [net/netfilter/nf_nat_ftp.ko] undefined! ERROR: "__fentry__" [net/netfilter/nf_nat.ko] undefined! Reported-by: Laura Abbott <[email protected]> Signed-off-by: Emese Revfy <[email protected]> [kees: renamed variable, clarified commit message] Signed-off-by: Kees Cook <[email protected]>
1 parent 574673c commit d26e941

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

scripts/Kbuild.include

+7-3
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,20 @@ as-option = $(call try-run,\
108108
as-instr = $(call try-run,\
109109
printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))
110110

111+
# Do not attempt to build with gcc plugins during cc-option tests.
112+
# (And this uses delayed resolution so the flags will be up to date.)
113+
CC_OPTION_CFLAGS = $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS))
114+
111115
# cc-option
112116
# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
113117

114118
cc-option = $(call try-run,\
115-
$(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
119+
$(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
116120

117121
# cc-option-yn
118122
# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
119123
cc-option-yn = $(call try-run,\
120-
$(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
124+
$(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
121125

122126
# cc-option-align
123127
# Prefix align with either -falign or -malign
@@ -127,7 +131,7 @@ cc-option-align = $(subst -functions=0,,\
127131
# cc-disable-warning
128132
# Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
129133
cc-disable-warning = $(call try-run,\
130-
$(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
134+
$(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
131135

132136
# cc-name
133137
# Expands to either gcc or clang

0 commit comments

Comments
 (0)