Re: [PATCH v5 00/13] treewide: Replace __ASSEMBLY__ with __ASSEMBLER__ in header files
From: Arnd Bergmann
Date: Thu Oct 29 2026 - 08:42:32 EST
On Fri, Oct 23, 2026, at 08:48, Thomas Huth wrote:
> The kernel Makefiles define the __ASSEMBLY__ macro to provide
> a way to use headers in both, assembly and C source code.
> However, all the supported versions of the GCC and Clang compilers (and
> also other compilers like Tiny-C or PCC) define the macro __ASSEMBLER__
> automatically already when compiling assembly code, too, so some kernel
> headers are using __ASSEMBLER__ instead. With regards to userspace code,
> this seems also to be constant source of confusion, see for example these
> links here:
>
> https://lore.kernel.org/kvm/20250222014526.2302653-1-seanjc@xxxxxxxxxx/
>
> https://stackoverflow.com/questions/28924355/gcc-assembler-preprocessor-not-compatible-with-standard-headers
> https://forums.raspberrypi.com/viewtopic.php?p=1652944#p1653834
> https://github.com/riscv-software-src/opensbi/issues/199
>
> To avoid confusion in the future, it makes sense to standardize
> on the macro that gets defined by the compiler, so this patch series
> changes all occurrences of __ASSEMBLY__ into __ASSEMBLER__ and
> finally removes the -D__ASSEMBLY__ from the Makefiles.
>
> I split the patches per architecture / maintained subsystem to ease
> the review, and I also split the uapi headers from the normal ones in
> case we ever decide that uapi needs to be treated differently from the
> normal headers here and the patches would need to get reverted.
I have started an asm-generic branch[1] for 7.5 based on today's mainline
snapshot and applied the series. I'll rebase once more after -rc1 is
out to ensure this can be tested in linux-next.
Thanks a lot for getting this finished!
Arnd
[1] https://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git/log/?h=asm-generic