Re: [tip: x86/asm] x86/asm: Make ASM_CALL_CONSTRAINT conditional on frame pointers
From: H. Peter Anvin
Date: Mon Mar 03 2025 - 17:32:27 EST
On March 3, 2025 3:02:41 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: e5ff90b179d45df71373cf79f99d20c9abe229cb
>Gitweb: https://git.kernel.org/tip/e5ff90b179d45df71373cf79f99d20c9abe229cb
>Author: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
>AuthorDate: Sun, 02 Mar 2025 17:21:03 -08:00
>Committer: Ingo Molnar <mingo@xxxxxxxxxx>
>CommitterDate: Mon, 03 Mar 2025 11:39:54 +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__ */
>
Wait, why was this changed? I actually tested this form at least once and found that it didn't work under all circumstances...