When building with C=2, sparse warns about missing definitions:
CHECK arch/x86/kernel/cpu/capflags.c
arch/x86/kernel/cpu/capflags.c:5:12: warning: symbol 'x86_cap_flags' was not declared. Should it be static?
arch/x86/kernel/cpu/capflags.c:261:12: warning: symbol 'x86_bug_flags' was not declared. Should it be static?
Make the script that generates the C file create the needed #include.
Signed-off-by: Valdis Kletnieks <[email protected]>
diff --git a/arch/x86/kernel/cpu/mkcapflags.sh b/arch/x86/kernel/cpu/mkcapflags.sh
index aed45b8895d5..f26caa6b6f2d 100644
--- a/arch/x86/kernel/cpu/mkcapflags.sh
+++ b/arch/x86/kernel/cpu/mkcapflags.sh
@@ -56,6 +56,10 @@ trap 'rm "$OUT"' EXIT
echo "#include <asm/cpufeatures.h>"
echo "#endif"
echo ""
+ echo "#ifndef _ASM_X86_CPUFEATURE_H"
+ echo "#include <asm/cpufeature.h>"
+ echo "#endif"
+ echo ""
dump_array "x86_cap_flags" "NCAPINTS*32" "X86_FEATURE_" ""
echo ""
Hi "Valdis,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on tip/auto-latest]
[also build test ERROR on tip/x86/core v5.4 next-20191207]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Valdis-Kl-tnieks/x86-build-provide-missing-include-file-for-capflags-c/20191207-215013
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 462ca02d04c308fedabcce250dc10f59e5cb1a80
config: i386-defconfig (attached as .config)
compiler: gcc-7 (Debian 7.5.0-1) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <[email protected]>
All errors (new ones prefixed by >>):
In file included from arch/x86/boot/mkcpustr.c:18:0:
>> ./arch/x86/boot/../kernel/cpu/capflags.c:6:10: fatal error: asm/cpufeature.h: No such file or directory
#include <asm/cpufeature.h>
^~~~~~~~~~~~~~~~~~
compilation terminated.
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/[email protected] Intel Corporation