From: "Marcel W. Wysocki" <maci.stgn@gmail.com>
To: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>,
Nathan Chancellor <nathan@kernel.org>,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
"Marcel W . Wysocki" <maci.stgn@gmail.com>
Subject: [PATCH] x86/vdso: use calll mnemonic for 32-bit vdso calls
Date: Sun, 15 Feb 2026 22:28:34 +0800 [thread overview]
Message-ID: <20260215142834.1455794-1-maci.stgn@gmail.com> (raw)
The VDSO32 fallback functions use unsuffixed "call" in inline asm
that is compiled in 32-bit mode (-m32). In AT&T syntax, the
unsuffixed "call" is ambiguous -- the assembler must infer the
operand size from context.
While both GNU as and the standard LLVM integrated assembler handle
this correctly in practice, the unsuffixed form is inconsistent with
other 32-bit assembly in the kernel tree (arch/x86/boot/header.S,
arch/x86/boot/copy.S, arch/x86/realmode/rm/wakeup_asm.S) which
already uses the explicit "calll" mnemonic.
More importantly, alternative LLVM-based toolchains (e.g. zig cc)
contain a separate assembler implementation that rejects unsuffixed
"call" in 32-bit inline asm context, preventing VDSO32 compilation
entirely.
Use "calll" -- the canonical AT&T mnemonic for a 32-bit near call
-- to match existing kernel convention and ensure compatibility
with all LLVM-based assemblers.
No object code change: "call" and "calll" produce identical machine
code (opcode E8h with 32-bit relative displacement) on all tested
assemblers (GNU as, LLVM 21, LLVM 20).
Signed-off-by: Marcel W. Wysocki <maci.stgn@gmail.com>
---
arch/x86/include/asm/vdso/gettimeofday.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/x86/include/asm/vdso/gettimeofday.h b/arch/x86/include/asm/vdso/gettimeofday.h
--- a/arch/x86/include/asm/vdso/gettimeofday.h
+++ b/arch/x86/include/asm/vdso/gettimeofday.h
@@ -101,7 +101,7 @@
asm (
"mov %%ebx, %%edx \n"
"mov %[clock], %%ebx \n"
- "call __kernel_vsyscall \n"
+ "calll __kernel_vsyscall \n"
"mov %%edx, %%ebx \n"
: "=a" (ret), "=m" (*_ts)
: "0" (__NR_clock_gettime64), [clock] "g" (_clkid), "c" (_ts)
@@ -118,7 +118,7 @@
asm (
"mov %%ebx, %%edx \n"
"mov %[clock], %%ebx \n"
- "call __kernel_vsyscall \n"
+ "calll __kernel_vsyscall \n"
"mov %%edx, %%ebx \n"
: "=a" (ret), "=m" (*_ts)
: "0" (__NR_clock_gettime), [clock] "g" (_clkid), "c" (_ts)
@@ -136,7 +136,7 @@
asm(
"mov %%ebx, %%edx \n"
"mov %2, %%ebx \n"
- "call __kernel_vsyscall \n"
+ "calll __kernel_vsyscall \n"
"mov %%edx, %%ebx \n"
: "=a" (ret)
: "0" (__NR_gettimeofday), "g" (_tv), "c" (_tz)
@@ -153,7 +153,7 @@
asm (
"mov %%ebx, %%edx \n"
"mov %[clock], %%ebx \n"
- "call __kernel_vsyscall \n"
+ "calll __kernel_vsyscall \n"
"mov %%edx, %%ebx \n"
: "=a" (ret), "=m" (*_ts)
: "0" (__NR_clock_getres_time64), [clock] "g" (_clkid), "c" (_ts)
@@ -170,7 +170,7 @@
asm (
"mov %%ebx, %%edx \n"
"mov %[clock], %%ebx \n"
- "call __kernel_vsyscall \n"
+ "calll __kernel_vsyscall \n"
"mov %%edx, %%ebx \n"
: "=a" (ret), "=m" (*_ts)
: "0" (__NR_clock_getres), [clock] "g" (_clkid), "c" (_ts)
next reply other threads:[~2026-02-15 14:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-15 14:28 Marcel W. Wysocki [this message]
2026-02-17 9:08 ` H. Peter Anvin
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=20260215142834.1455794-1-maci.stgn@gmail.com \
--to=maci.stgn@gmail.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mingo@redhat.com \
--cc=nathan@kernel.org \
--cc=tglx@kernel.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®