* Re: [PATCH v2] arm: Replace ASSEMBLY with ASSEMBLER in uapi headers
2026-03-01 20:12 ` Maciej W. Rozycki
@ 2026-03-01 22:06 ` Thomas Weißschuh
2026-03-03 16:10 ` Nick Huang
2026-03-09 15:24 ` [PATCH v2] arm: Replace ASSEMBLY with ASSEMBLER in uapi Nick Huang
2 siblings, 0 replies; 9+ messages in thread
From: Thomas Weißschuh @ 2026-03-01 22:06 UTC (permalink / raw)
To: Maciej W. Rozycki
Cc: Nick Huang, linux, davidgow, dongsheng.yang, dory85109, ebiggers,
idryomov, jlayton, john.g.garry, namhyung, robh, kusogame68,
wdhh6, wqu, yot4106, likerockman102, squid, linux-arm-kernel,
linux-kernel
On 2026-03-01 20:12:11+0000, Maciej W. Rozycki wrote:
> On Sat, 28 Feb 2026, Nick Huang wrote:
>
> > > 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.
>
> It seems to whom? Have you got a reference to a discussion with libc
> maintainers where the consensus has been that support for older compilers
> can be dropped? Why does it remain in the GNU C library?
To me, based on the fact that nobody has complained so far about the
other architectures. But I don't really want to advocate for dropping
compatibility.
> > I'm aware that other architectures have transitioned to __ASSEMBLER__.
> > However, I implemented this check here because Maciej W. Rozycki
> > specifically suggested this approach during our discussion.
>
> I asked a question whether this is relevant. The outcome could well be
> that it is not, but with data available at hand such a conclusion cannot
> be made in my opinion.
Fair enough. I have no issues with retaining the compatibility.
But the approach in this patch is counterproductive to compatibility.
For regular C sources, which I assume are most users of the UAPI
headers, the __ASSEMBLER__ or __ASSEMBLY__ are wholly irrelevant.
But with this patch they will be hard broken. Also UAPI consumers which
might be perfectly happy to manually define __ASSEMBLY__ will now run
into a hard error. So this check is strictly *less* compatible with
exactly those old compilers.
Given that there is a general switch to __ASSEMBLY__ for regular kernel
headers, the chances are high that adding these manual version checks to
the UAPI headers will be forgotten frequently and will require a lot of
fixups. If we want to stay compatible, we should do the following:
diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh
index 9c15e748761c..2f1d1767ca26 100755
--- a/scripts/headers_install.sh
+++ b/scripts/headers_install.sh
@@ -36,6 +36,7 @@ sed -E -e '
s/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g
s/(^|[[:space:](])(inline|asm|volatile)([[:space:](]|$)/\1__\2__\3/g
s@#(ifndef|define|endif[[:space:]]*/[*])[[:space:]]*_UAPI@#\1 @
+ s/__ASSEMBLY__/__ASSEMBLER__/g
' $INFILE > $TMPFILE || exit 1
scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ $TMPFILE > $OUTFILE
Then we can convert all UAPI headers to the in-kernel style using
__ASSEMBLY__ and drop -DASSEMBLER from kbuild. Userspace will still
work as before and if we come to the point to drop compatibility,
we can do so far all UAPI headers at the same time, without any
inconsistencies.
Right now I think the consistency argument is enough that this should
have been done from the beginning. Your thoughts?
Thomas
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v2] arm: Replace ASSEMBLY with ASSEMBLER in uapi headers
2026-03-01 20:12 ` Maciej W. Rozycki
2026-03-01 22:06 ` Thomas Weißschuh
@ 2026-03-03 16:10 ` Nick Huang
2026-03-09 15:24 ` [PATCH v2] arm: Replace ASSEMBLY with ASSEMBLER in uapi Nick Huang
2 siblings, 0 replies; 9+ messages in thread
From: Nick Huang @ 2026-03-03 16:10 UTC (permalink / raw)
To: Maciej W. Rozycki
Cc: linux, davidgow, dongsheng.yang, dory85109, ebiggers, idryomov,
jlayton, john.g.garry, namhyung, robh, kusogame68, wdhh6, wqu,
yot4106, likerockman102, squid, linux-arm-kernel, linux-kernel
On Sun, 1 Mar 2026, Maciej W. Rozycki wrote:
> It seems to whom? Have you got a reference to a discussion with libc
> maintainers where the consensus has been that support for older compilers
> can be dropped? Why does it remain in the GNU C library?
I have now consulted the glibc maintainers directly on this question.
The thread is available here:
https://inbox.sourceware.org/libc-alpha/mvm342hx8tf.fsf@suse.de/
Andreas Schwab (SUSE Labs) responded:
"Since the compiler will define __ASSEMBLER__ automatically when
preprocessing assembler-with-cpp files, there is no need to change
anything on the glibc side. The places that define __ASSEMBLY__ for
that purpose will just become redundant."
Best regards,
Nick Huang <sef1548@gmail.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] arm: Replace ASSEMBLY with ASSEMBLER in uapi
2026-03-01 20:12 ` Maciej W. Rozycki
2026-03-01 22:06 ` Thomas Weißschuh
2026-03-03 16:10 ` Nick Huang
@ 2026-03-09 15:24 ` Nick Huang
2026-03-09 16:01 ` Thomas Weißschuh
2 siblings, 1 reply; 9+ messages in thread
From: Nick Huang @ 2026-03-09 15:24 UTC (permalink / raw)
To: macro
Cc: davidgow, dongsheng.yang, dory85109, ebiggers, idryomov, jlayton,
john.g.garry, kusogame68, likerockman102, linux-arm-kernel,
linux-kernel, linux, linux, namhyung, robh, sef1548, squid, wdhh6,
wqu, yot4106
Add a compatibility shim for __ASSEMBLER__ to support older GCC versions.
This bridge ensures that toolchains defining only __ASSEMBLY__ can correctly identify assembly stages.
This block can be removed once consensus is reached to drop support for these legacy compilers. If this version is acceptable, I will send it out in the v3 patch.
diff --git a/arch/arm/include/uapi/asm/ptrace.h b/arch/arm/include/uapi/asm/ptrace.h
index 8896c23cc..427eb70bd 100644
--- a/arch/arm/include/uapi/asm/ptrace.h
+++ b/arch/arm/include/uapi/asm/ptrace.h
@@ -119,7 +119,11 @@
#define PT_DATA_ADDR 0x10004
#define PT_TEXT_END_ADDR 0x10008
-#ifndef __ASSEMBLY__
+#if !defined(__ASSEMBLER__) && defined(__ASSEMBLY__)
+#define __ASSEMBLER__ __ASSEMBLY__
+#endif
+
+#ifndef __ASSEMBLER__
/*
* This struct defines the way the registers are stored on the
@@ -158,6 +162,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
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v2] arm: Replace ASSEMBLY with ASSEMBLER in uapi
2026-03-09 15:24 ` [PATCH v2] arm: Replace ASSEMBLY with ASSEMBLER in uapi Nick Huang
@ 2026-03-09 16:01 ` Thomas Weißschuh
2026-03-10 14:13 ` Maciej W. Rozycki
0 siblings, 1 reply; 9+ messages in thread
From: Thomas Weißschuh @ 2026-03-09 16:01 UTC (permalink / raw)
To: Nick Huang
Cc: macro, davidgow, dongsheng.yang, dory85109, ebiggers, idryomov,
jlayton, john.g.garry, kusogame68, likerockman102,
linux-arm-kernel, linux-kernel, linux, namhyung, robh, squid,
wdhh6, wqu, yot4106
Hi Nick,
thanks for the update. After our last discussion I prepared a
supplemental patch for this, but of course forgot to actually
send it out.
On 2026-03-09 15:24:23+0000, Nick Huang wrote:
> Add a compatibility shim for __ASSEMBLER__ to support older GCC versions.
> This bridge ensures that toolchains defining only __ASSEMBLY__ can correctly identify assembly stages.
> This block can be removed once consensus is reached to drop support for these legacy compilers. If this version is acceptable, I will send it out in the v3 patch.
>
> diff --git a/arch/arm/include/uapi/asm/ptrace.h b/arch/arm/include/uapi/asm/ptrace.h
> index 8896c23cc..427eb70bd 100644
> --- a/arch/arm/include/uapi/asm/ptrace.h
> +++ b/arch/arm/include/uapi/asm/ptrace.h
> @@ -119,7 +119,11 @@
> #define PT_DATA_ADDR 0x10004
> #define PT_TEXT_END_ADDR 0x10008
> -#ifndef __ASSEMBLY__
> +#if !defined(__ASSEMBLER__) && defined(__ASSEMBLY__)
> +#define __ASSEMBLER__ __ASSEMBLY__
> +#endif
With [0] this hunk should also be unnecesarry. It would free all
UAPI authors from worrying about the problem at all.
[0] https://lore.kernel.org/lkml/20260309-uapi-assembly-v1-1-a7ebfbf14309@weissschuh.net/T/#u
> +#ifndef __ASSEMBLER__
>
> /*
> * This struct defines the way the registers are stored on the
> @@ -158,6 +162,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
>
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH v2] arm: Replace ASSEMBLY with ASSEMBLER in uapi
2026-03-09 16:01 ` Thomas Weißschuh
@ 2026-03-10 14:13 ` Maciej W. Rozycki
0 siblings, 0 replies; 9+ messages in thread
From: Maciej W. Rozycki @ 2026-03-10 14:13 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Nick Huang, davidgow, dongsheng.yang, dory85109, ebiggers,
idryomov, jlayton, john.g.garry, kusogame68, likerockman102,
linux-arm-kernel, linux-kernel, linux, namhyung, robh, squid,
wdhh6, wqu, yot4106
On Mon, 9 Mar 2026, Thomas Weißschuh wrote:
> thanks for the update. After our last discussion I prepared a
> supplemental patch for this, but of course forgot to actually
> send it out.
I have now dug a bit deeper and realised that GCC used to have explicit
-D__ASSEMBLER__ in the specs for `@assembler-with-cpp' before switching to
the internal macro definition. So I take my concern back, the original
change is good to go in. Apologies for the confusion.
Maciej
^ permalink raw reply [flat|nested] 9+ messages in thread