Re: [tip: x86/asm] x86/asm: Make ASM_CALL_CONSTRAINT conditional on frame pointers
From: H. Peter Anvin
Date: Fri Mar 07 2025 - 17:08:07 EST
On March 4, 2025 2:36:24 AM PST, tip-bot2 for Josh Poimboeuf <tip-bot2@xxxxxxxxxxxxx> wrote:
>The following commit has been merged into the x86/asm branch of tip:
>
>Commit-ID: 05844663b4fcf22bb3a1494615ae3f25852c9abc
>Gitweb: https://git.kernel.org/tip/05844663b4fcf22bb3a1494615ae3f25852c9abc
>Author: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
>AuthorDate: Sun, 02 Mar 2025 17:21:03 -08:00
>Committer: Ingo Molnar <mingo@xxxxxxxxxx>
>CommitterDate: Tue, 04 Mar 2025 11:21:40 +01:00
>
>x86/asm: Make ASM_CALL_CONSTRAINT conditional on frame pointers
>
>With frame pointers enabled, ASM_CALL_CONSTRAINT is used in an inline
>asm statement with a call instruction to force the compiler to set up
>the frame pointer before doing the call.
>
>Without frame pointers, no such constraint is needed. Make it
>conditional on frame pointers.
>
>Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
>Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
>Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
>Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
>Cc: Brian Gerst <brgerst@xxxxxxxxx>
>Cc: H. Peter Anvin <hpa@xxxxxxxxx>
>Cc: linux-kernel@xxxxxxxxxxxxxxx
>---
> arch/x86/include/asm/asm.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
>diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h
>index 0d268e6..f1db9e8 100644
>--- a/arch/x86/include/asm/asm.h
>+++ b/arch/x86/include/asm/asm.h
>@@ -232,7 +232,11 @@ register unsigned long current_stack_pointer asm(_ASM_SP);
> * gets set up by the containing function. If you forget to do this, objtool
> * may print a "call without frame pointer save/setup" warning.
> */
>+#ifdef CONFIG_UNWINDER_FRAME_POINTER
> #define ASM_CALL_CONSTRAINT "r" (__builtin_frame_address(0))
>+#else
>+#define ASM_CALL_CONSTRAINT
>+#endif
>
> #endif /* __ASSEMBLY__ */
>
So we are going to be using this version despite the gcc maintainers telling us it is not supported?