diff options
author | Emese Revfy <re.emese@gmail.com> | 2016-06-18 02:28:34 -0400 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2016-08-08 20:49:05 -0400 |
commit | d26e94149276f8c3d4911aa2c8395ba99b613c8d (patch) | |
tree | 95f0701f3db4443290b05a1239407b5062fba6dd | |
parent | 574673c231a5fad1560249cc3a598907acb36cf9 (diff) |
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 <labbott@redhat.com>
Signed-off-by: Emese Revfy <re.emese@gmail.com>
[kees: renamed variable, clarified commit message]
Signed-off-by: Kees Cook <keescook@chromium.org>
-rw-r--r-- | scripts/Kbuild.include | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 15b196fc2f49..179219845dfc 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
@@ -108,16 +108,20 @@ as-option = $(call try-run,\ | |||
108 | as-instr = $(call try-run,\ | 108 | as-instr = $(call try-run,\ |
109 | printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3)) | 109 | printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3)) |
110 | 110 | ||
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 | |||
111 | # cc-option | 115 | # cc-option |
112 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) | 116 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) |
113 | 117 | ||
114 | cc-option = $(call try-run,\ | 118 | 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)) |
116 | 120 | ||
117 | # cc-option-yn | 121 | # cc-option-yn |
118 | # Usage: flag := $(call cc-option-yn,-march=winchip-c6) | 122 | # Usage: flag := $(call cc-option-yn,-march=winchip-c6) |
119 | cc-option-yn = $(call try-run,\ | 123 | 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) |
121 | 125 | ||
122 | # cc-option-align | 126 | # cc-option-align |
123 | # Prefix align with either -falign or -malign | 127 | # Prefix align with either -falign or -malign |
@@ -127,7 +131,7 @@ cc-option-align = $(subst -functions=0,,\ | |||
127 | # cc-disable-warning | 131 | # cc-disable-warning |
128 | # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable) | 132 | # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable) |
129 | cc-disable-warning = $(call try-run,\ | 133 | 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))) |
131 | 135 | ||
132 | # cc-name | 136 | # cc-name |
133 | # Expands to either gcc or clang | 137 | # Expands to either gcc or clang |