Am 14.08.2017 um 12:35 schrieb Martin Storsjo:
Windows uses a different ABI for va_list on arm64 just like on x86_64.
On x86_64, the calling convention for windows functions is completely different from the one on other platforms. On arm64, they're mostly the same, with the only exception being variadic functions (where all float arguments are passed in integer registers, since the va_list is a single pointer).
Any functions using __builtin_ms_va_start need to be decorated with __attribute__((ms_abi)).
Add a check in configure for the support of __builtin_ms_va_list (both features appared in clang at the same time, in the 5.0 release).
This fixes running binaries that use e.g. printf style functions (e.g. midl.exe from the windows 10 sdk), fixing https://bugs.winehq.org/show_bug.cgi?id=38886.
Signed-off-by: Martin Storsjo [email protected]
clang 5.0, which this requires, isn't yet released, but is in RC2 and will probably be released pretty soon.
configure.ac | 7 +++++++ include/msvcrt/crtdefs.h | 6 +++++- include/windef.h | 6 +++++- include/wine/test.h | 4 ++-- 4 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac index 7d52b24..c33221f 100644 --- a/configure.ac +++ b/configure.ac @@ -179,6 +179,13 @@ case $host in CFLAGS="$CFLAGS -marm" AC_SUBST(TARGETFLAGS,"-marm") ;;
- aarch64*)
- AC_MSG_CHECKING([whether $CC supports __builtin_ms_va_list])
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>]], [[void func(__builtin_ms_va_list *args);]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_ERROR([You need clang >= 5.0 to build Wine for arm64.])])
Hi,
The upstreamed variadic function handling is terrific, thanks for that! I also like this patch as logical next step, I'm just a bit worried because it locks out current builds without upgrading to an RC... At the moment I'm doing winelib builds with gcc for Linux/ARM64 and clang builds for Android/ARM64. It's quite easy on Linux to pick up a new clang version, not sure how long it takes until clang5 is picked up in the Android NDK... On the other hand, there are not much people building Wine for ARM64, and those can pretty easily revert your patch until they are at clang5 OK... We need this improvement, I'll sign it off :)
Now, we only need to convince distributions to avoid x18
On Mon, 14 Aug 2017, André Hentschel wrote:
Am 14.08.2017 um 12:35 schrieb Martin Storsjo:
Windows uses a different ABI for va_list on arm64 just like on x86_64.
On x86_64, the calling convention for windows functions is completely different from the one on other platforms. On arm64, they're mostly the same, with the only exception being variadic functions (where all float arguments are passed in integer registers, since the va_list is a single pointer).
Any functions using __builtin_ms_va_start need to be decorated with __attribute__((ms_abi)).
Add a check in configure for the support of __builtin_ms_va_list (both features appared in clang at the same time, in the 5.0 release).
This fixes running binaries that use e.g. printf style functions (e.g. midl.exe from the windows 10 sdk), fixing https://bugs.winehq.org/show_bug.cgi?id=38886.
Signed-off-by: Martin Storsjo [email protected]
clang 5.0, which this requires, isn't yet released, but is in RC2 and will probably be released pretty soon.
configure.ac | 7 +++++++ include/msvcrt/crtdefs.h | 6 +++++- include/windef.h | 6 +++++- include/wine/test.h | 4 ++-- 4 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac index 7d52b24..c33221f 100644 --- a/configure.ac +++ b/configure.ac @@ -179,6 +179,13 @@ case $host in CFLAGS="$CFLAGS -marm" AC_SUBST(TARGETFLAGS,"-marm") ;;
- aarch64*)
- AC_MSG_CHECKING([whether $CC supports __builtin_ms_va_list])
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>]], [[void func(__builtin_ms_va_list *args);]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_ERROR([You need clang >= 5.0 to build Wine for arm64.])])
Hi,
The upstreamed variadic function handling is terrific, thanks for that! I also like this patch as logical next step, I'm just a bit worried because it locks out current builds without upgrading to an RC... At the moment I'm doing winelib builds with gcc for Linux/ARM64 and clang builds for Android/ARM64. It's quite easy on Linux to pick up a new clang version, not sure how long it takes until clang5 is picked up in the Android NDK... On the other hand, there are not much people building Wine for ARM64, and those can pretty easily revert your patch until they are at clang5
Yeah, I was a little worried about this, but I thought that making this part conditional in the headers would make it quite messy, for something that is mostly transitional anyway.
Now the other question is who would be willing to implement the same in gcc. Since it requires changes to the implementation of va_start (which, at least in llvm, is pretty closely tied with the implementation of stack frame handling and callee register saving), it's a much larger task than I originally thought when I embarked on it. In June, I tried grepping the gcc tree for the relevant keywords, but I decided to skip it for now.
// Martin
André Hentschel [email protected] writes:
The upstreamed variadic function handling is terrific, thanks for that! I also like this patch as logical next step, I'm just a bit worried because it locks out current builds without upgrading to an RC... At the moment I'm doing winelib builds with gcc for Linux/ARM64 and clang builds for Android/ARM64. It's quite easy on Linux to pick up a new clang version, not sure how long it takes until clang5 is picked up in the Android NDK... On the other hand, there are not much people building Wine for ARM64, and those can pretty easily revert your patch until they are at clang5 OK... We need this improvement, I'll sign it off :)
I'm doing Android/ARM64 builds to verify that the platform doesn't get broken after commit rounds, so I'll need to wait until this feature makes it to the Android NDK to apply the patch.
On Wed, 16 Aug 2017, Alexandre Julliard wrote:
André Hentschel [email protected] writes:
The upstreamed variadic function handling is terrific, thanks for that! I also like this patch as logical next step, I'm just a bit worried because it locks out current builds without upgrading to an RC... At the moment I'm doing winelib builds with gcc for Linux/ARM64 and clang builds for Android/ARM64. It's quite easy on Linux to pick up a new clang version, not sure how long it takes until clang5 is picked up in the Android NDK... On the other hand, there are not much people building Wine for ARM64, and those can pretty easily revert your patch until they are at clang5 OK... We need this improvement, I'll sign it off :)
I'm doing Android/ARM64 builds to verify that the platform doesn't get broken after commit rounds, so I'll need to wait until this feature makes it to the Android NDK to apply the patch.
Ok, let's hope it makes its way into NDK r16. They don't use fixed releases of LLVM but some random snapshot plus fixes, iirc. The feature itself was merged around mid July, with the last fixes early August.
Since the amount of users building for arm64 probably is very small so far (the three of us?), I don't mind waiting until it's easily available for you, so we don't need to do a huge mess with compiler version identification for this feature in the headers.
// Martin
Am 16.08.2017 um 09:54 schrieb Alexandre Julliard:
André Hentschel [email protected] writes:
The upstreamed variadic function handling is terrific, thanks for that! I also like this patch as logical next step, I'm just a bit worried because it locks out current builds without upgrading to an RC... At the moment I'm doing winelib builds with gcc for Linux/ARM64 and clang builds for Android/ARM64. It's quite easy on Linux to pick up a new clang version, not sure how long it takes until clang5 is picked up in the Android NDK... On the other hand, there are not much people building Wine for ARM64, and those can pretty easily revert your patch until they are at clang5 OK... We need this improvement, I'll sign it off :)
I'm doing Android/ARM64 builds to verify that the platform doesn't get broken after commit rounds, so I'll need to wait until this feature makes it to the Android NDK to apply the patch.
At least in 16B it is Android clang version 5.0.300080 But for some reason it seems it doesn't support __builtin_ms_va_list Martin, can you please check?