[PATCH v2] arm: Replace ASSEMBLY with ASSEMBLER in uapi headers
Thomas Weißschuh
linux at weissschuh.net
Sat Feb 28 04:19:59 PST 2026
On 2026-02-28 12:13:11+0000, Nick Huang wrote:
> While the transition from __ASSEMBLY__ to __ASSEMBLER__ is not a regression,
> the use of the modern __ASSEMBLER__ macro requires a sufficiently recent
> compiler (GCC 3.0+).
>
> In some environments, userland might still be using ancient tools like
> GCC 2.95.x, which does not natively define __ASSEMBLER__. To provide a
> complete fix and prevent silent build issues or header ambiguity, add
> an #error guard to catch unsupported toolchains.
>
> Changes in v2:
> - Added explicit #error check for GCC versions earlier than 3.0.
> - Updated commit message to clarify the rationale for legacy toolchain support.
> - Link to v1: https://lore.kernel.org/all/20260218133952.5356-1-sef1548@gmail.com/
>
> Signed-off-by: Nick Huang <sef1548 at gmail.com>
> ---
> arch/arm/include/uapi/asm/ptrace.h | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/include/uapi/asm/ptrace.h b/arch/arm/include/uapi/asm/ptrace.h
> index 8896c23cc..51cfefeae 100644
> --- a/arch/arm/include/uapi/asm/ptrace.h
> +++ b/arch/arm/include/uapi/asm/ptrace.h
> @@ -119,7 +119,12 @@
> #define PT_DATA_ADDR 0x10004
> #define PT_TEXT_END_ADDR 0x10008
>
> -#ifndef __ASSEMBLY__
> +#if defined(__GNUC__) && (__GNUC__ < 3)
> +# error "GCC 3.0+ is required for proper __ASSEMBLER__ support. \
> +Your compiler is too old to safely handle modern kernel assembly headers."
> +#endif
Having this check in a random, architecture-specific header does not
make much sense. It should go into a generic header if we want to have it.
Or we can have some generic postprocessing in 'headers_install'.
But as most other architecture UAPI headers already have switched to
__ASSEMBLER__, it seems nobody will be affected by this, so this check
should be unnecessary.
> +
> +#ifndef __ASSEMBLER__
>
> /*
> * This struct defines the way the registers are stored on the
> @@ -158,6 +163,6 @@ struct pt_regs {
> #define ARM_VFPREGS_SIZE ( 32 * 8 /*fpregs*/ + 4 /*fpscr*/ )
>
>
> -#endif /* __ASSEMBLY__ */
> +#endif /* __ASSEMBLER__ */
>
> #endif /* _UAPI__ASM_ARM_PTRACE_H */
> --
> 2.43.0
>
More information about the linux-arm-kernel
mailing list