Re: [GIT PULL] MM updates for 6.14-rc1
From: Uros Bizjak
Date: Sun Jan 26 2025 - 12:22:12 EST
On Sun, Jan 26, 2025 at 10:57 AM Uros Bizjak <ubizjak@xxxxxxxxx> wrote:
>
> On Sat, Jan 25, 2025 at 11:09 PM Linus Torvalds
> <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > On Fri, 24 Jan 2025 at 16:22, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> > >
> > > Linus, please merge the MM updates for the 6.14 development cycle,
> >
> > This does not build at all for me.
> >
> > I get
> >
> > ./arch/x86/include/asm/current.h:49:9: error: call to undeclared
> > function '__typeof_unqual__'; ISO C99 and later do not support
> > implicit function declarations [-Wimplicit-function-declaration]
> >
> > when running the Rust 'bindgen', and what seems to be going on is that
> > my version of *gcc* does support __typeof_unqual__, so I end up with
> >
> > CONFIG_CC_HAS_TYPEOF_UNQUAL=y
> >
> > in my kernel config, but I think that 'bindgen' that generates the
> > Rust bindings is based on LLVM, and clearly does not understand
>
> __typeof_unqual__ is available in Clang 19.1.0 in all C modes as an
> extension [1] and as reported in [2], bindgen 0,70.1 seems to parse
> __typeof_unqual__ okay.
>
> [1] https://releases.llvm.org/19.1.0/tools/clang/docs/ReleaseNotes.html
> [2] https://lore.kernel.org/lkml/9fa81826-8fa6-47e4-a0a2-4916e5d042a7@stanley.mountain/
>
> Maybe configure could detect bindgen version and disable
> CC_HAS_TYPEOF_UNQUAL [3] if it is too old?
bindgen ChangeLog does not mention __typeof_unqual__, so I assume that
the support depends on RUSTC_LLVM_VERSION.
Does the attached incremental patch work for you?
Uros.
diff --git a/init/Kconfig b/init/Kconfig
index a1507b8714e4..d342371dd15d 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -898,7 +898,9 @@ config CC_HAS_INT128
def_bool !$(cc-option,$(m64-flag) -D__SIZEOF_INT128__=0) && 64BIT
config CC_HAS_TYPEOF_UNQUAL
- def_bool $(success,echo 'int foo (int a) { __typeof_unqual__(a) b = a; return b; }' | $(CC) -x c - -S -o /dev/null)
+ def_bool y
+ depends on $(success,echo 'int foo (int a) { __typeof_unqual__(a) b = a; return b; }' | $(CC) -x c - -S -o /dev/null)
+ depends on !RUST || RUSTC_LLVM_VERSION >= 190000
config CC_IMPLICIT_FALLTHROUGH
string