On 5/12/2026 10:33 AM, Ard Biesheuvel wrote:
On Tue, 12 May 2026, at 19:10, Oliver Smith-Denny wrote:
On 5/12/2026 9:57 AM, Ard Biesheuvel via groups.io wrote:
Does MSVC follow the AAPCS64 for varargs?

https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#id120


Thanks for the link here, I didn't realize the va_list definition was
defined in the AAPCS64 ABI spec, I thought that this was only compiler
defined, but its good it is here. Unfortunately...MSVC does not follow
this.

They simply have typedef char * va_list. Presumably to match what x86
had. Which is very unfortunate. So then to match, clang has followed
that.

I'm reaching out to some internal compiler folks on this, but I don't
think this is likely to change, of course.


Even if MSVC grows a 'compliant' mode at some point which could be used to
compile EDK2 with AAPCS64-style varargs, that would be years away.

And the current situation is that MSVC and AAPCS64 disagree, and so putting
VA_LISTs in PPIs or protocol definitions is problematic. So there you have
your answer :-)


That works for me. There could be a check for this in Ecc, perhaps,
though I think the only way you could check is that VA_LIST can't be in
an EFIAPI function, which would be a broader impact (i.e. code that
marks a function as EFIAPI but doesn't actually need to would have to
drop EFIAPI).

If not, then I don't think this is fixable. If it does, then we need to
fix the VA_LIST definitions for _M_ARM64.


Yeah, I think the question is whether we should rely on the compiler
builtins here or use our own definitions here, the char * and related
macros.

Because this is AAPCS64 defined, I somewhat lean towards saying MSVC did
this wrong and we shouldn't punish the toolchains that did this right.
Unfortunately, that doesn't solve the problem.

We still could make sure CLANGPDB takes advantage of the compiler
builtins by avoiding the _M_ARM64 path, that presumably would have
some benefit, but again, doesn't solve this problem.

Agreed. No need to force Clang to do the wrong thing here.

I or someone on my team will put up a PR to address this (which again,
__builtin_va_list on CLANGPDB is still the MS ABI, so there might be
some perf benefit, but no interop benefit) and we'll fix up the in-tree
usage of VA_LIST across ABI boundaries (which may be limited to the
crypto case).

Thanks,
Oliver



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#121940): https://edk2.groups.io/g/devel/message/121940
Mute This Topic: https://groups.io/mt/119278849/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to