Subject: [Bug 220407] New: arch/powerpc/boot/types.h:43:13: error: 'bool' cannot be defined via 'typedef' when building with GCC 15

From: [email-masked]
Date: Mon, 04 Aug 2025 14:09:56 +0000

https://bugzilla.kernel.org/show_bug.cgi?id=220407

            Bug ID: 220407
           Summary: arch/powerpc/boot/types.h:43:13: error: 'bool' cannot
                    be defined via 'typedef' when building with GCC 15
           Product: Platform Specific/Hardware
           Version: 2.5
          Hardware: PPC-32
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: PPC-32
          Assignee: [email-masked]
          Reporter: [email-masked]
        Regression: No

Created attachment 308441
  --> https://bugzilla.kernel.org/attachment.cgi?id=308441&action=edit
Gentoo default kernel config

I have been slowly bringing up a Gentoo PPC system in QEMU to host binary
packages for an iBook G3.

The kernel fails to compile with GCC 15 due to C23 issues:

  DESCEND objtool
  CALL    scripts/checksyscalls.sh
  INSTALL libsubcmd_headers
  COPY    arch/powerpc/boot/inflate.c
  COPY    arch/powerpc/boot/inffast.c
  COPY    arch/powerpc/boot/inftrees.c
  BOOTCC  arch/powerpc/boot/cuboot.o
  COPY    arch/powerpc/boot/fdt.c
  BOOTCC  arch/powerpc/boot/devtree.o
  COPY    arch/powerpc/boot/fdt_ro.c
  COPY    arch/powerpc/boot/fdt_rw.c
  COPY    arch/powerpc/boot/fdt_strerror.c
  COPY    arch/powerpc/boot/fdt_sw.c
  COPY    arch/powerpc/boot/fdt_wip.c
  BOOTCC  arch/powerpc/boot/libfdt-wrapper.o
  BOOTCC  arch/powerpc/boot/main.o
  BOOTCC  arch/powerpc/boot/ns16550.o
  BOOTCC  arch/powerpc/boot/ofconsole.o
  BOOTCC  arch/powerpc/boot/oflib.o
  BOOTCC  arch/powerpc/boot/serial.o
  BOOTCC  arch/powerpc/boot/simple_alloc.o
  BOOTCC  arch/powerpc/boot/stdio.o
  BOOTCC  arch/powerpc/boot/stdlib.o
In file included from arch/powerpc/boot/ops.h:13,
                 from arch/powerpc/boot/cuboot.c:12:
arch/powerpc/boot/types.h:43:13: error: 'bool' cannot be defined via 'typedef'
   43 | typedef int bool;
      |             ^~~~
arch/powerpc/boot/types.h:43:13: note: 'bool' is a keyword with '-std=c23'
onwards
arch/powerpc/boot/types.h:43:1: warning: useless type name in empty declaration
   43 | typedef int bool;
      | ^~~~~~~
In file included from arch/powerpc/boot/devtree.c:12:
arch/powerpc/boot/types.h:43:13: error: 'bool' cannot be defined via 'typedef'
   43 | typedef int bool;
      |             ^~~~
In file included from arch/powerpc/boot/serial.c:14:
arch/powerpc/boot/types.h:43:13: error: 'bool' cannot be defined via 'typedef'
   43 | typedef int bool;
      |             ^~~~
arch/powerpc/boot/types.h:43:13: note: 'bool' is a keyword with '-std=c23'
onwards
In file included from arch/powerpc/boot/ns16550.c:13:
arch/powerpc/boot/types.h:43:13: error: 'bool' cannot be defined via 'typedef'
   43 | typedef int bool;
      |             ^~~~
arch/powerpc/boot/types.h:43:13: note: 'bool' is a keyword with '-std=c23'
onwards
arch/powerpc/boot/types.h:43:13: note: 'bool' is a keyword with '-std=c23'
onwards
arch/powerpc/boot/types.h:43:1: warning: useless type name in empty declaration
   43 | typedef int bool;
      | ^~~~~~~
arch/powerpc/boot/types.h:43:1: warning: useless type name in empty declaration
   43 | typedef int bool;
      | ^~~~~~~
arch/powerpc/boot/types.h:43:1: warning: useless type name in empty declaration
   43 | typedef int bool;
      | ^~~~~~~
In file included from arch/powerpc/boot/ops.h:13,
                 from arch/powerpc/boot/main.c:13:
arch/powerpc/boot/types.h:43:13: error: 'bool' cannot be defined via 'typedef'
   43 | typedef int bool;
      |             ^~~~
In file included from ./arch/powerpc/boot/libfdt_env.h:5,
                 from ./arch/powerpc/boot/libfdt.h:9,
                 from arch/powerpc/boot/libfdt-wrapper.c:13:
./arch/powerpc/boot/types.h:43:13: error: 'bool' cannot be defined via
'typedef'
   43 | typedef int bool;
      |             ^~~~
arch/powerpc/boot/types.h:43:13: note: 'bool' is a keyword with '-std=c23'
onwards
./arch/powerpc/boot/types.h:43:13: note: 'bool' is a keyword with '-std=c23'
onwards
./arch/powerpc/boot/types.h:43:1: warning: useless type name in empty
declaration
   43 | typedef int bool;
      | ^~~~~~~
arch/powerpc/boot/types.h:43:1: warning: useless type name in empty declaration
   43 | typedef int bool;
      | ^~~~~~~
In file included from arch/powerpc/boot/oflib.c:6:
arch/powerpc/boot/types.h:43:13: error: 'bool' cannot be defined via 'typedef'
   43 | typedef int bool;
      |             ^~~~
In file included from arch/powerpc/boot/ofconsole.c:8:
arch/powerpc/boot/types.h:43:13: error: 'bool' cannot be defined via 'typedef'
   43 | typedef int bool;
      |             ^~~~
arch/powerpc/boot/types.h:43:13: note: 'bool' is a keyword with '-std=c23'
onwards
arch/powerpc/boot/types.h:43:13: note: 'bool' is a keyword with '-std=c23'
onwards
arch/powerpc/boot/types.h:43:1: warning: useless type name in empty declaration
   43 | typedef int bool;
      | ^~~~~~~
arch/powerpc/boot/types.h:43:1: warning: useless type name in empty declaration
   43 | typedef int bool;
      | ^~~~~~~
make[2]: *** [arch/powerpc/boot/Makefile:234: arch/powerpc/boot/cuboot.o] Error
1
make[2]: *** Waiting for unfinished jobs....
In file included from arch/powerpc/boot/simple_alloc.c:11:
arch/powerpc/boot/types.h:43:13: error: 'bool' cannot be defined via 'typedef'
   43 | typedef int bool;
      |             ^~~~
arch/powerpc/boot/types.h:43:13: note: 'bool' is a keyword with '-std=c23'
onwards
arch/powerpc/boot/types.h:43:1: warning: useless type name in empty declaration
   43 | typedef int bool;
      | ^~~~~~~
In file included from arch/powerpc/boot/ops.h:13,
                 from arch/powerpc/boot/stdio.c:9:
arch/powerpc/boot/types.h:43:13: error: 'bool' cannot be defined via 'typedef'
   43 | typedef int bool;
      |             ^~~~
arch/powerpc/boot/types.h:43:13: note: 'bool' is a keyword with '-std=c23'
onwards
arch/powerpc/boot/types.h:43:1: warning: useless type name in empty declaration
   43 | typedef int bool;
      | ^~~~~~~
make[2]: *** [arch/powerpc/boot/Makefile:234: arch/powerpc/boot/ns16550.o]
Error 1
make[2]: *** [arch/powerpc/boot/Makefile:234: arch/powerpc/boot/serial.o] Error
1
make[2]: *** [arch/powerpc/boot/Makefile:234: arch/powerpc/boot/devtree.o]
Error 1
make[2]: *** [arch/powerpc/boot/Makefile:234: arch/powerpc/boot/ofconsole.o]
Error 1
make[2]: *** [arch/powerpc/boot/Makefile:234: arch/powerpc/boot/main.o] Error 1
make[2]: *** [arch/powerpc/boot/Makefile:234: arch/powerpc/boot/simple_alloc.o]
Error 1
make[2]: *** [arch/powerpc/boot/Makefile:234: arch/powerpc/boot/oflib.o] Error
1
make[2]: *** [arch/powerpc/boot/Makefile:234:
arch/powerpc/boot/libfdt-wrapper.o] Error 1
make[2]: *** [arch/powerpc/boot/Makefile:234: arch/powerpc/boot/stdio.o] Error
1
make[1]: *** [arch/powerpc/Makefile:236: zImage] Error 2
make: *** [Makefile:248: __sub-make] Error 2

I tried adding KBUILD_CFLAGS += -std=gnu11 to arch/powerpc/boot/Makefile, but
that didn't fix the issue. I am building Linux 6.15.9 because that is the
latest that Gentoo has an official default config for, but
arch/powerpc/boot/types.h and arch/powerpc/boot/Makefile haven't changed from
there to master. 6.12 fails too, for that matter.

(Truncated) output from emerge --info (I am using a 64-bit kernel in the
emulator, and building a 32-bit userland + kernel for the target system):

Portage 3.0.68 (python 3.13.5-final-0, default/linux/ppc/23.0/desktop, gcc-15,
glibc-2.41-r4, 6.12.21-gentoo-ppc64-ppc ppc64)
=================================================================
System uname:
Linux-6.12.21-gentoo-ppc64-ppc-ppc64-POWER9_-architected-,_altivec_supported-with-glibc2.41
KiB Mem:    24096492 total,  10071272 free
KiB Swap:          0 total,         0 free
Head commit of repository gentoo: 5fbe5609e04996b5d2c6bed17f8bc55970d759bb

ld GNU ld (Gentoo 2.44 p4) 2.44.0
sys-devel/binutils:        2.44-r3::gentoo, 2.45::gentoo
sys-devel/gcc:             15.1.1_p20250705-r1::gentoo
sys-kernel/linux-headers:  6.16::gentoo (virtual/os-headers)
sys-libs/glibc:            2.41-r4::gentoo

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.