[PATCH] x86/entry/vdso32: Omit '.cfi_offset eflags' for LLVM < 16

Nathan Chancellor posted 1 patch 2 weeks ago
arch/x86/entry/vdso/vdso32/sigreturn.S | 8 ++++++++
1 file changed, 8 insertions(+)
[PATCH] x86/entry/vdso32: Omit '.cfi_offset eflags' for LLVM < 16
Posted by Nathan Chancellor 2 weeks ago
After commit 884961618ee5 ("x86/entry/vdso32: Remove open-coded DWARF in
sigreturn.S"), building arch/x86/entry/vdso/vdso32/sigreturn.S with LLVM
15 fails with:

  <instantiation>:18:20: error: invalid register name
   .cfi_offset eflags, 64
                     ^
  arch/x86/entry/vdso/vdso32/sigreturn.S:33:2: note: while in macro instantiation
   STARTPROC_SIGNAL_FRAME 8
   ^

Support for eflags as an argument to .cfi_offset was added in the LLVM
16 development cycle [1]. Only add this .cfi_offset directive if it is
supported by the assembler to clear up the error.

Fixes: 884961618ee5 ("x86/entry/vdso32: Remove open-coded DWARF in sigreturn.S")
Link: https://github.com/llvm/llvm-project/commit/67bd3c58c0c7389e39c5a2f4d3b1a30459ccf5b7 [1]
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 arch/x86/entry/vdso/vdso32/sigreturn.S | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/x86/entry/vdso/vdso32/sigreturn.S b/arch/x86/entry/vdso/vdso32/sigreturn.S
index 25b0ac4b4bfe..8dfcf18f9582 100644
--- a/arch/x86/entry/vdso/vdso32/sigreturn.S
+++ b/arch/x86/entry/vdso/vdso32/sigreturn.S
@@ -22,7 +22,15 @@
 	CFI_OFFSET	cs,     IA32_SIGCONTEXT_cs
 	CFI_OFFSET	ss,     IA32_SIGCONTEXT_ss
 	CFI_OFFSET	ds,     IA32_SIGCONTEXT_ds
+/*
+ * .cfi_offset eflags requires LLVM 16 or newer:
+ * https://github.com/llvm/llvm-project/commit/67bd3c58c0c7389e39c5a2f4d3b1a30459ccf5b7
+ * Check for 16.0.1 to ensure the support is present, as 16.0.0 may be a
+ * prerelease version.
+ */
+#if defined(CONFIG_AS_IS_GNU) || (defined(CONFIG_AS_IS_LLVM) && CONFIG_AS_VERSION >= 160001)
 	CFI_OFFSET	eflags, IA32_SIGCONTEXT_flags
+#endif
 .endm
 
 	.text

---
base-commit: 436ee609df7da5671ae5a717d1df867313868baf
change-id: 20260123-x86-vdso32-wa-llvm-15-cfi-offset-eflags-b7b40f934280

Best regards,
--  
Nathan Chancellor <nathan@kernel.org>
Re: [PATCH] x86/entry/vdso32: Omit '.cfi_offset eflags' for LLVM < 16
Posted by H. Peter Anvin 2 weeks ago
On 2026-01-23 15:20, Nathan Chancellor wrote:
> After commit 884961618ee5 ("x86/entry/vdso32: Remove open-coded DWARF in
> sigreturn.S"), building arch/x86/entry/vdso/vdso32/sigreturn.S with LLVM
> 15 fails with:
> 
>   <instantiation>:18:20: error: invalid register name
>    .cfi_offset eflags, 64
>                      ^
>   arch/x86/entry/vdso/vdso32/sigreturn.S:33:2: note: while in macro instantiation
>    STARTPROC_SIGNAL_FRAME 8
>    ^
> 
> Support for eflags as an argument to .cfi_offset was added in the LLVM
> 16 development cycle [1]. Only add this .cfi_offset directive if it is
> supported by the assembler to clear up the error.
> 
> Fixes: 884961618ee5 ("x86/entry/vdso32: Remove open-coded DWARF in sigreturn.S")
> Link: https://github.com/llvm/llvm-project/commit/67bd3c58c0c7389e39c5a2f4d3b1a30459ccf5b7 [1]
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Unfortunate, but simple enough.

Acked-by: H. Peter Anvin (Intel) <hpa@zytor.com>