include: force stack alignment on x86_64 as well

Justas Lavišius bucaneer at gmail.com
Wed Jan 27 10:25:15 CST 2016


Fixes https://bugs.winehq.org/show_bug.cgi?id=27680

Compilation will fail on GCC 5.3 if both -O1 and -fstack-check
options are used. Workaround is to add -fno-omit-frame-pointer.
Details: https://bugs.winehq.org/show_bug.cgi?id=27680#c34

Signed-off-by: Justas Lavišius <bucaneer at gmail.com>
---
 include/windef.h | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/include/windef.h b/include/windef.h
index e914726..1e54fcb 100644
--- a/include/windef.h
+++ b/include/windef.h
@@ -64,7 +64,11 @@ extern "C" {
 #   error You need to define __stdcall for your compiler
 #  endif
 # elif defined(__x86_64__) && defined (__GNUC__)
-#  define __stdcall __attribute__((ms_abi))
+#  if (__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3))
+#   define __stdcall __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
+#  else
+#   define __stdcall __attribute__((ms_abi))
+#  endif
 # else  /* __i386__ */
 #  define __stdcall
 # endif  /* __i386__ */
@@ -78,7 +82,11 @@ extern "C" {
 #   define __cdecl __attribute__((__cdecl__))
 #  endif
 # elif defined(__x86_64__) && defined (__GNUC__)
-#  define __cdecl __attribute__((ms_abi))
+#  if (__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3))
+#   define __cdecl __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
+#  else
+#   define __cdecl __attribute__((ms_abi))
+#  endif
 # elif !defined(_MSC_VER)
 #  define __cdecl
 # endif
-- 
2.7.0




More information about the wine-patches mailing list