[PATCH] msvcp90: Fix vtable alignment on macOS.
Chip Davis
cdavis at codeweavers.com
Wed Mar 6 21:28:55 CST 2019
March 6, 2019 7:01 PM, "Ken Thomases" <ken at codeweavers.com> wrote:
> On macOS, the .align <n> directive aligns to 2^n, not just n.
I wonder if we should explicitly use '.balign 8', since that always means "align to 8 bytes." Unless, of course, there are platforms that don't support it.
>
> 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
Chip
More information about the wine-devel
mailing list