Re: [PATCH] objtool: Support Clang RAX DRAP sequence

From: Peter Zijlstra

Date: Tue Mar 17 2026 - 04:22:53 EST


On Mon, Mar 16, 2026 at 05:47:56PM -0700, Josh Poimboeuf wrote:
> Recent Clang can use RAX as a temporary register for the DRAP stack
> alignment sequence. Add support for that.
>
> Fixes the following warning:
>
> vmlinux.o: error: objtool: vmw_host_printf+0xd: unknown CFA base reg 0
>
> Reported-by: Arnd Bergmann <arnd@xxxxxxxx>
> Closes: https://lore.kernel.org/cefefdd1-7b82-406d-8ff4-e4b167e45ee6@xxxxxxxxxxxxxxxx
> Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
> ---
> arch/x86/include/asm/orc_types.h | 1 +
> arch/x86/kernel/unwind_orc.c | 8 ++++++++
> tools/arch/x86/include/asm/orc_types.h | 1 +
> tools/objtool/arch/x86/decode.c | 3 +++
> tools/objtool/arch/x86/orc.c | 5 +++++
> 5 files changed, 18 insertions(+)
>
> diff --git a/arch/x86/include/asm/orc_types.h b/arch/x86/include/asm/orc_types.h
> index e0125afa53fb..b3cc7970fa54 100644
> --- a/arch/x86/include/asm/orc_types.h
> +++ b/arch/x86/include/asm/orc_types.h
> @@ -37,6 +37,7 @@
> #define ORC_REG_R13 7
> #define ORC_REG_BP_INDIRECT 8
> #define ORC_REG_SP_INDIRECT 9
> +#define ORC_REG_AX 10
> #define ORC_REG_MAX 15

I'm 'annoyed' at the placement of that register. I know its not
important, but I can't silence my OCD saying that AX should come before
DX.

Also, SP comes before BP and both before DI.

Something like so perhaps?

---
diff --git a/arch/x86/include/asm/orc_types.h b/arch/x86/include/asm/orc_types.h
index e0125afa53fb..5df398761c70 100644
--- a/arch/x86/include/asm/orc_types.h
+++ b/arch/x86/include/asm/orc_types.h
@@ -28,15 +28,19 @@
* and GCC realigned stacks.
*/
#define ORC_REG_UNDEFINED 0
-#define ORC_REG_PREV_SP 1
+
+#define ORC_REG_AX 1
#define ORC_REG_DX 2
-#define ORC_REG_DI 3
+#define ORC_REG_SP 3
#define ORC_REG_BP 4
-#define ORC_REG_SP 5
+#define ORC_REG_DI 5
#define ORC_REG_R10 6
#define ORC_REG_R13 7
-#define ORC_REG_BP_INDIRECT 8
+
+#define ORC_REG_PREV_SP 8
#define ORC_REG_SP_INDIRECT 9
+#define ORC_REG_BP_INDIRECT 10
+
#define ORC_REG_MAX 15

#define ORC_TYPE_UNDEFINED 0