Failing to build mainline kernel for arm
From: Brahmajit Das
Date: Tue Jun 17 2025 - 17:23:33 EST
Hello developers,
I was trying to build the mainline kernel (top commit
4663747812d1a272312d1b95cbd128f0cdb329f2) and came across a build
failure with allyesconfig.
$ make ARCH=arm CROSS_COMPILE=arm-none-eabi-
...
CC kernel/fork.o
In file included from kernel/fork.c:93:
./include/linux/kcov.h:113:6: error: mismatch in argument 1 type of built-in function ‘__sanitizer_cov_trace_cmp4’; expected ‘long unsigned int’ [-Werror=builtin-declaration-mismatch]
113 | void __sanitizer_cov_trace_cmp4(u32 arg1, u32 arg2);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/kcov.h:117:6: error: mismatch in argument 1 type of built-in function ‘__sanitizer_cov_trace_const_cmp4’; expected ‘long unsigned int’ [-Werror=builtin-declaration-misma
tch]
117 | void __sanitizer_cov_trace_const_cmp4(u32 arg1, u32 arg2);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [scripts/Makefile.build:287: kernel/fork.o] Error 1
make[2]: *** [scripts/Makefile.build:554: kernel] Error 2
make[1]: *** [/home/bdas/linux/Makefile:2003: .] Error 2
make: *** [Makefile:248: __sub-make] Error 2
I bisected it to commit e0ddec73fd4822d2ffe914d5ce3e2718f985276a
"kcov: add prototypes for helper functions"
While reverting the commit does help, but that would not be the correct
approach I guess.
Part of the commit modifies include/linux/kcov.h
#ifdef CONFIG_64BIT
+typedef unsigned long kcov_u64;
+#else
+typedef unsigned long long kcov_u64;
+#endif
+
+void __sanitizer_cov_trace_pc(void);
+void __sanitizer_cov_trace_cmp1(u8 arg1, u8 arg2);
+void __sanitizer_cov_trace_cmp2(u16 arg1, u16 arg2);
+void __sanitizer_cov_trace_cmp4(u32 arg1, u32 arg2);
+void __sanitizer_cov_trace_cmp8(kcov_u64 arg1, kcov_u64 arg2);
+void __sanitizer_cov_trace_const_cmp1(u8 arg1, u8 arg2);
+void __sanitizer_cov_trace_const_cmp2(u16 arg1, u16 arg2);
+void __sanitizer_cov_trace_const_cmp4(u32 arg1, u32 arg2);
+void __sanitizer_cov_trace_const_cmp8(kcov_u64 arg1, kcov_u64 arg2);
+void __sanitizer_cov_trace_switch(kcov_u64 val, void *cases);
Maybe we can do something similar to kcov_u64, like kcov_u32? But I'm
not sure.
--
Regards,
listout