While wine's configure checks and requires that the ms_abi attribute is supported on aarch64 (without it, variadic functions don't have the correct ABI), these headers are also included when building widl as a generic cross compilation tool as part of mingw-w64-tools. In the case of widl, the functions that use these attributes (and in particular, their ABI) doesn't matter as they aren't used/called, they're just included as a side effect of including the headers that widl actually needs.
This fixes building the widl tool for aarch64 linux with GCC, even if wine itself can't be built in that configuration.
Only windef.h is used/needed by widl, but update msvcrt/corecrt.h as well to keep these definitions in sync.
Signed-off-by: Martin Storsjo martin@martin.st --- include/msvcrt/corecrt.h | 4 ++-- include/windef.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/msvcrt/corecrt.h b/include/msvcrt/corecrt.h index 4d11f68be0d..a66f43877ac 100644 --- a/include/msvcrt/corecrt.h +++ b/include/msvcrt/corecrt.h @@ -81,7 +81,7 @@ # endif # elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__) # define __stdcall __attribute__((pcs("aapcs-vfp"))) -# elif defined(__aarch64__) && defined (__GNUC__) +# elif defined(__aarch64__) && defined (__GNUC__) && __has_attribute(ms_abi) # define __stdcall __attribute__((ms_abi)) # else /* __i386__ */ # define __stdcall @@ -102,7 +102,7 @@ #endif
#ifndef __ms_va_list -# if (defined(__x86_64__) || defined(__aarch64__)) && defined (__GNUC__) +# if (defined(__x86_64__) || (defined(__aarch64__) && __has_attribute(ms_abi))) && defined (__GNUC__) # define __ms_va_list __builtin_ms_va_list # define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg) # define __ms_va_end(list) __builtin_ms_va_end(list) diff --git a/include/windef.h b/include/windef.h index b8e5ed692b1..5351afe66db 100644 --- a/include/windef.h +++ b/include/windef.h @@ -74,7 +74,7 @@ extern "C" { # endif # elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__) # define __stdcall __attribute__((pcs("aapcs-vfp"))) -# elif defined(__aarch64__) && defined (__GNUC__) +# elif defined(__aarch64__) && defined (__GNUC__) && __has_attribute(ms_abi) # define __stdcall __attribute__((ms_abi)) # else /* __i386__ */ # define __stdcall @@ -103,7 +103,7 @@ extern "C" { #endif
#ifndef __ms_va_list -# if (defined(__x86_64__) || defined(__aarch64__)) && defined (__GNUC__) +# if (defined(__x86_64__) || (defined(__aarch64__) && __has_attribute(ms_abi))) && defined (__GNUC__) # define __ms_va_list __builtin_ms_va_list # define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg) # define __ms_va_end(list) __builtin_ms_va_end(list)
December 20, 2020 4:39 PM, "Martin Storsjo" martin@martin.st wrote:
diff --git a/include/msvcrt/corecrt.h b/include/msvcrt/corecrt.h index 4d11f68be0d..a66f43877ac 100644 --- a/include/msvcrt/corecrt.h +++ b/include/msvcrt/corecrt.h @@ -81,7 +81,7 @@ # endif # elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__) # define __stdcall __attribute__((pcs("aapcs-vfp"))) -# elif defined(__aarch64__) && defined (__GNUC__) +# elif defined(__aarch64__) && defined (__GNUC__) && __has_attribute(ms_abi)
Are you sure that every version of GCC that supports __attribute__((ms_abi)) on AArch64 also supports __has_attribute()?
Chip
On 21.12.2020 06:26, Chip Davis wrote:
December 20, 2020 4:39 PM, "Martin Storsjo" martin@martin.st wrote:
diff --git a/include/msvcrt/corecrt.h b/include/msvcrt/corecrt.h index 4d11f68be0d..a66f43877ac 100644 --- a/include/msvcrt/corecrt.h +++ b/include/msvcrt/corecrt.h @@ -81,7 +81,7 @@ # endif # elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__) # define __stdcall __attribute__((pcs("aapcs-vfp"))) -# elif defined(__aarch64__) && defined (__GNUC__) +# elif defined(__aarch64__) && defined (__GNUC__) && __has_attribute(ms_abi)
Are you sure that every version of GCC that supports __attribute__((ms_abi)) on AArch64 also supports __has_attribute()?
No GCC version currently supports ms_abi on aarch64, while recent GCC supports __has_attribute, so it should be fine.
Jacek