Re: [tip: x86/asm] x86/asm: Make ASM_CALL_CONSTRAINT conditional on frame pointers

From: Josh Poimboeuf
Date: Tue Mar 04 2025 - 15:00:20 EST


On Tue, Mar 04, 2025 at 11:47:52AM -0800, Josh Poimboeuf wrote:
> On Tue, Mar 04, 2025 at 08:48:29AM -1000, Linus Torvalds wrote:
> > In your own words from 8 years go in commit f5caf621ee35 ("x86/asm:
> > Fix inline asm call constraints for Clang"), just having the register
> > variable makes the problem go away:
> >
> > With GCC 7.2, however, GCC's behavior has changed. It now changes its
> > behavior based on the conversion of the register variable to a global.
> > That somehow convinces it to *always* set up the frame pointer before
> > inserting *any* inline asm. (Therefore, listing the variable as an
> > output constraint is a no-op and is no longer necessary.)
> >
> > and the whole ASM_CALL_CONSTRAINT thing is just unnecessary.
>
> I don't know if that GCC 7.2 thing from eight years ago was a fluke or
> what, but without ASM_CALL_CONSTRAINT, those "call without frame pointer
> save/setup" warnings are still very much active with recent compilers.
>
> Below is what I get with empty ASM_CALL_CONSTRAINT + GCC 14 + defconfig
> + CONFIG_UNWINDER_FRAME_POINTER.

And to clarify, yes, those still have the global register variable
defined.

--
Josh