[PATCH] msvcp90: Fix vtable alignment on macOS.

Ken Thomases ken at codeweavers.com
Wed Mar 6 19:01:01 CST 2019


On macOS, the .align <n> directive aligns to 2^n, not just n.

Signed-off-by: Ken Thomases <ken at codeweavers.com>
---
 dlls/msvcp90/cxx.h | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/dlls/msvcp90/cxx.h b/dlls/msvcp90/cxx.h
index 917d814..86295cd 100644
--- a/dlls/msvcp90/cxx.h
+++ b/dlls/msvcp90/cxx.h
@@ -43,9 +43,15 @@
 
 #define VTABLE_ADD_FUNC(name) "\t.quad " THISCALL_NAME(name) "\n"
 
+#ifdef __APPLE__
+#define __ASM_VTABLE_ALIGN ".align 3"
+#else
+#define __ASM_VTABLE_ALIGN ".align 8"
+#endif
+
 #define __ASM_VTABLE(name,funcs) \
     __asm__(".data\n" \
-            "\t.align 8\n" \
+            "\t" __ASM_VTABLE_ALIGN "\n" \
             "\t.quad " __ASM_NAME(#name "_rtti") "\n" \
             "\t.globl " __ASM_NAME("MSVCP_" #name "_vtable") "\n" \
             __ASM_NAME("MSVCP_" #name "_vtable") ":\n" \
@@ -55,9 +61,15 @@
 
 #define VTABLE_ADD_FUNC(name) "\t.long " THISCALL_NAME(name) "\n"
 
+#ifdef __APPLE__
+#define __ASM_VTABLE_ALIGN ".align 2"
+#else
+#define __ASM_VTABLE_ALIGN ".align 4"
+#endif
+
 #define __ASM_VTABLE(name,funcs) \
     __asm__(".data\n" \
-            "\t.align 4\n" \
+            "\t" __ASM_VTABLE_ALIGN "\n" \
             "\t.long " __ASM_NAME(#name "_rtti") "\n" \
             "\t.globl " __ASM_NAME("MSVCP_" #name "_vtable") "\n" \
             __ASM_NAME("MSVCP_" #name "_vtable") ":\n" \
-- 
2.10.2




More information about the wine-devel mailing list