mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@kernel.org>
To: x86@kernel.org
Cc: linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	Peter Zijlstra <peterz@infradead.org>
Subject: [PATCH] objtool: Support Clang RAX DRAP sequence
Date: Mon, 16 Mar 2026 17:47:56 -0700	[thread overview]
Message-ID: <3f33dc720b83dc6d3a2b7094f75a5c90a0b1cbc5.1773708458.git.jpoimboe@kernel.org> (raw)

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@arndb.de>
Closes: https://lore.kernel.org/cefefdd1-7b82-406d-8ff4-e4b167e45ee6@app.fastmail.com
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
 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
 
 #define ORC_TYPE_UNDEFINED		0
diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
index f610fde2d5c4..32f7e918d3d9 100644
--- a/arch/x86/kernel/unwind_orc.c
+++ b/arch/x86/kernel/unwind_orc.c
@@ -578,6 +578,14 @@ bool unwind_next_frame(struct unwind_state *state)
 		}
 		break;
 
+	case ORC_REG_AX:
+		if (!get_reg(state, offsetof(struct pt_regs, ax), &sp)) {
+			orc_warn_current("missing AX value at %pB\n",
+					 (void *)state->ip);
+			goto err;
+		}
+		break;
+
 	default:
 		orc_warn("unknown SP base reg %d at %pB\n",
 			 orc->sp_reg, (void *)state->ip);
diff --git a/tools/arch/x86/include/asm/orc_types.h b/tools/arch/x86/include/asm/orc_types.h
index e0125afa53fb..b3cc7970fa54 100644
--- a/tools/arch/x86/include/asm/orc_types.h
+++ b/tools/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
 
 #define ORC_TYPE_UNDEFINED		0
diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c
index c5817829cdfa..5931b2393bd8 100644
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -896,6 +896,9 @@ int arch_decode_hint_reg(u8 sp_reg, int *base)
 	case ORC_REG_DX:
 		*base = CFI_DX;
 		break;
+	case ORC_REG_AX:
+		*base = CFI_AX;
+		break;
 	default:
 		return -1;
 	}
diff --git a/tools/objtool/arch/x86/orc.c b/tools/objtool/arch/x86/orc.c
index 735e150ca6b7..5494bb450ab5 100644
--- a/tools/objtool/arch/x86/orc.c
+++ b/tools/objtool/arch/x86/orc.c
@@ -70,6 +70,9 @@ int init_orc_entry(struct orc_entry *orc, struct cfi_state *cfi, struct instruct
 	case CFI_DX:
 		orc->sp_reg = ORC_REG_DX;
 		break;
+	case CFI_AX:
+		orc->sp_reg = ORC_REG_AX;
+		break;
 	default:
 		ERROR_INSN(insn, "unknown CFA base reg %d", cfi->cfa.base);
 		return -1;
@@ -138,6 +141,8 @@ static const char *reg_name(unsigned int reg)
 		return "bp(ind)";
 	case ORC_REG_SP_INDIRECT:
 		return "sp(ind)";
+	case ORC_REG_AX:
+		return "ax";
 	default:
 		return "?";
 	}
-- 
2.53.0


             reply	other threads:[~2026-03-17  0:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-17  0:47 Josh Poimboeuf [this message]
2026-03-17  8:18 ` Peter Zijlstra
2026-03-17 15:30   ` Josh Poimboeuf
2026-03-17 20:35     ` Peter Zijlstra
2026-03-17 22:44       ` Josh Poimboeuf
2026-03-18  8:28         ` Peter Zijlstra
2026-03-18  8:41 ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3f33dc720b83dc6d3a2b7094f75a5c90a0b1cbc5.1773708458.git.jpoimboe@kernel.org \
    --to=jpoimboe@kernel.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®