Re: [PATCH] asm-generic: bitsperlong: Remove the disabled BITS_PER_LONG check
From: Fang Xieyan
Date: Mon Nov 23 2026 - 12:08:53 EST
Hi Arnd, Thomas,
A follow-up with the build evidence I promised.
I temporarily re-enabled the check and replayed the exact saved
compile commands for each x86-64 build scenario:
- The check fails for 23 objects in arch/x86/boot and 12 objects
in arch/x86/realmode. They are compiled with -m16 (which uses
the 32-bit C data model) but retain the actual 64-bit kernel
configuration, so BITS_PER_LONG is 64 while __BITS_PER_LONG is
32. Both paths reach the header via <linux/types.h>: boot.h
includes it directly, while the realmode path reaches it
through <linux/linkage.h> -> <asm/ibt.h>.
- boot/compressed (-m64) and vdso64 pass. vdso32 also passes
because its build force-includes fake_32bit_build.h, which
undefines CONFIG_64BIT and defines CONFIG_X86_32.
One correction to my earlier reply: boot fails as well, not just
realmode. I missed it because bzImage is only built after vmlinux,
and the realmode failure stopped the build before boot was reached.
So there seem to be two separate issues:
1. boot/realmode: 32-bit C code compiled with -m16 while
retaining the 64-bit kernel configuration.
2. vDSO header isolation: the sanctioned include/vdso headers
still include <linux/types.h>, and the <linux/types.h>
dependency chain eventually reaches the kernel-internal
include/asm-generic/bitsperlong.h. I verified this with
compiler -H traces.
Would you treat these as separate issues? In particular, should
the BITS_PER_LONG check be scoped to native kernel compilation,
with boot/realmode handled separately?
For the vDSO, would you prefer VDSO-specific basic type
definitions, or a sanitized subset of UAPI types that can be used
without pulling in kernel-internal headers?
Thomas, is there any ongoing work in this area?
Thanks,
Fang Xieyan