Re: linux-next: build warning after merge of the akpm tree

From: Dmitry Vyukov
Date: Mon Dec 07 2020 - 07:09:06 EST


On Sat, Dec 5, 2020 at 6:19 AM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Fri, 4 Dec 2020 21:00:00 +1100 Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> wrote:
>
> > Hi all,
> >
> > After merging the akpm tree, today's linux-next build (powerpc
> > allyesconfig) produced warnings like this:
> >
> > kernel/kcov.c:296:14: warning: conflicting types for built-in function '__sanitizer_cov_trace_switch'; expected 'void(long unsigned int, void *)' [-Wbuiltin-declaration-mismatch]
> > 296 | void notrace __sanitizer_cov_trace_switch(u64 val, u64 *cases)
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Odd. clang wants that signature, according to
> https://clang.llvm.org/docs/SanitizerCoverage.html. But gcc seems to
> want a different signature. Beats me - best I can do is to cc various
> likely culprits ;)
>
> Which gcc version? Did you recently update gcc?
>
> > ld: warning: orphan section `.data..Lubsan_data177' from `arch/powerpc/oprofile/op_model_pa6t.o' being placed in section `.data..Lubsan_data177'
> >
> > (lots of these latter ones)
> >
> > I don't know what produced these, but it is in the akpm-current or
> > akpm trees.

I can reproduce this in x86_64 build as well but only if I enable
UBSAN as well. There were some recent UBSAN changes by Kees, so maybe
that's what affected the warning.
Though, the warning itself looks legit and unrelated to UBSAN. In
fact, if the compiler expects long and we accept u64, it may be broken
on 32-bit arches...

I have gcc version 10.2.0 (Debian 10.2.0-15)
On next-20201207
config is defconfig +
CONFIG_KCOV=y
CONFIG_KCOV_ENABLE_COMPARISONS=y
CONFIG_UBSAN=y

$ make -j8 kernel/kcov.o
CC kernel/kcov.o
kernel/kcov.c:296:14: warning: conflicting types for built-in function
‘__sanitizer_cov_trace_switch’; expected ‘void(long unsigned int,
void *)’ [-Wbuiltin-declaration-mismatch]
296 | void notrace __sanitizer_cov_trace_switch(u64 val, u64 *cases)