> On Jun 29, 2016, at 2:02 PM, Jordan Justen <jordan.l.jus...@intel.com> wrote: > > On 2016-06-28 08:18:57, Shi, Steven wrote: >> Both GCC and LLVM 3.8 64bits support new variable argument (VA) > > Which versions of GCC? Maybe we should define MS_VA_LIST on the > command line for toolchains that can support this? >
Maybe I'm backwards but VA_LIST is by definition MS_VA_LIST. What you lose access to is UNIX_VA_LIST? Thus for a compiler that uses the EFIAPI __builtin_va_arg is EFIABI. For a compiler that produces Sys V ABI __builtin_va_arg is the Unix ABI. I verified this assertion with the clang maintainers. VA_LIST always points to EFIAPI and that is why you have to decorate var arg functions with EFIAPI to match VA_LIST. We could add a NATIVE_VA_LIST but for an compiler that natively does EFIAPI it would be the same a VA_LIST. Thus it would be hard to enforce, but it would let some one that knew what they are doing get access to __builtin_va_arg. The problem is if you know what you are doing you can decorate with EFIAPI so is adding NATIVE_VA_LIST really solving any problem? Thanks, Andrew Fish > -Jordan > >> intrinsics for Microsoft ABI, enable these new VA intrinsics for >> GNUC family 64bits code build. These VA intrinsics are only >> permitted use in 64bits code, so not use them in 32bits code build. >> The original 32bits GNU VA intrinsics has the same calling conversion >> as MS, so we don’t need change them. >> >> Contributed-under: TianoCore Contribution Agreement 1.0 >> Signed-off-by: Steven Shi <steven....@intel.com> >> --- >> MdePkg/Include/Base.h | 27 +++++++++++++++++++++++++-- >> 1 file changed, 25 insertions(+), 2 deletions(-) >> mode change 100644 => 100755 MdePkg/Include/Base.h >> >> diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h >> old mode 100644 >> new mode 100755 >> index cbd9e55..05fccf3 >> --- a/MdePkg/Include/Base.h >> +++ b/MdePkg/Include/Base.h >> @@ -588,9 +588,32 @@ struct _LIST_ENTRY { >> >> #define VA_COPY(Dest, Start) __va_copy (Dest, Start) >> >> -#elif defined(__GNUC__) && !defined(NO_BUILTIN_VA_FUNCS) >> + >> +#elif defined(__GNUC__) && !defined(NO_BUILTIN_VA_FUNCS) && !defined (EFI32) >> +// >> +// 64bits build only. Use GCC built-in macros for variable argument lists. >> +// >> +/// >> +/// Both GCC and LLVM 3.8 64bits support new variable argument intrinsics >> for Microsoft ABI >> +/// >> + >> +/// >> +/// Variable used to traverse the list of arguments. This type can vary by >> +/// implementation and could be an array or structure. >> +/// >> +typedef __builtin_ms_va_list VA_LIST; >> + >> +#define VA_START(Marker, Parameter) __builtin_ms_va_start (Marker, >> Parameter) >> + >> +#define VA_ARG(Marker, TYPE) ((sizeof (TYPE) < sizeof (UINTN)) ? >> (TYPE)(__builtin_va_arg (Marker, UINTN)) : (TYPE)(__builtin_va_arg (Marker, >> TYPE))) >> + >> +#define VA_END(Marker) __builtin_ms_va_end (Marker) >> + >> +#define VA_COPY(Dest, Start) __builtin_ms_va_copy (Dest, Start) >> + >> +#elif defined(__GNUC__) && !defined(NO_BUILTIN_VA_FUNCS) && defined (EFI32) >> // >> -// Use GCC built-in macros for variable argument lists. >> +// 32bits build only. Use GCC built-in macros for variable argument lists. >> // >> >> /// >> -- >> 2.7.4 >> >> _______________________________________________ >> edk2-devel mailing list >> edk2-devel@lists.01.org >> https://lists.01.org/mailman/listinfo/edk2-devel > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel