Re: [PATCH] x86/irqflags: Force a register output in native_save_fl()
From: Peter Zijlstra
Date: Thu Dec 18 2025 - 05:24:26 EST
On Thu, Dec 18, 2025 at 11:15:37AM +0100, Eric Dumazet wrote:
> > >--- a/arch/x86/include/asm/irqflags.h
> > >+++ b/arch/x86/include/asm/irqflags.h
> > >@@ -18,14 +18,9 @@ extern __always_inline unsigned long native_save_fl(void)
> > > {
> > > unsigned long flags;
> > >
> > >- /*
> > >- * "=rm" is safe here, because "pop" adjusts the stack before
> > >- * it evaluates its effective address -- this is part of the
> > >- * documented behavior of the "pop" instruction.
> > >- */
> > > asm volatile("# __raw_save_flags\n\t"
> > > "pushf ; pop %0"
> > >- : "=rm" (flags)
> > >+ : "=r" (flags)
> > > : /* no input */
> > > : "memory");
> > >
> >
> > Maybe report a bug to the clang team?
>
> This has been done 8 years ago. No progress so far...
>
> They claim we should use __builtin_ia32_readeflags_u64 /
> __builtin_ia32_writeeflags_u64, which seems unlikely to please x86
> maintainers ?
Yeah, because the "rm" thing not being supported properly goes way
further than just this one case. And it really is abysmal that clang
hasn't managed to implement it in all that time :/