Module: wine Branch: master Commit: bf73faefc7eb67a4940d3b9179568942e48b47c0 URL: http://source.winehq.org/git/wine.git/?a=commit;h=bf73faefc7eb67a4940d3b9179...
Author: Alexandre Julliard julliard@winehq.org Date: Mon Nov 16 22:52:41 2015 +0900
winegcc: Force stack alignment on all x86 platforms.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
tools/winegcc/winegcc.c | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-)
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c index ad139f5..ee5ac6b 100644 --- a/tools/winegcc/winegcc.c +++ b/tools/winegcc/winegcc.c @@ -548,47 +548,34 @@ static void compile(struct options* opts, const char* lang)
if (gcc_defs) { - int fastcall_done = 0; - if (opts->target_cpu == CPU_x86_64) + switch (opts->target_cpu) { + case CPU_x86_64: strarray_add(comp_args, "-D__stdcall=__attribute__((ms_abi))"); strarray_add(comp_args, "-D__cdecl=__attribute__((ms_abi))"); strarray_add(comp_args, "-D_stdcall=__attribute__((ms_abi))"); strarray_add(comp_args, "-D_cdecl=__attribute__((ms_abi))"); strarray_add(comp_args, "-D__fastcall=__attribute__((ms_abi))"); strarray_add(comp_args, "-D_fastcall=__attribute__((ms_abi))"); - fastcall_done = 1; - } - else if (opts->target_platform == PLATFORM_APPLE) - { - /* Mac OS X uses a 16-byte aligned stack and not a 4-byte one */ + break; + case CPU_x86: strarray_add(comp_args, "-D__stdcall=__attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))"); strarray_add(comp_args, "-D__cdecl=__attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))"); strarray_add(comp_args, "-D_stdcall=__attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))"); strarray_add(comp_args, "-D_cdecl=__attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))"); - } - else if (opts->target_cpu == CPU_ARM || opts->target_cpu == CPU_ARM64) - { + strarray_add(comp_args, "-D__fastcall=__attribute__((__fastcall__))"); + strarray_add(comp_args, "-D_fastcall=__attribute__((__fastcall__))"); + break; + case CPU_ARM: + case CPU_ARM64: + case CPU_POWERPC: strarray_add(comp_args, "-D__stdcall="); strarray_add(comp_args, "-D__cdecl="); strarray_add(comp_args, "-D_stdcall="); strarray_add(comp_args, "-D_cdecl="); strarray_add(comp_args, "-D__fastcall="); strarray_add(comp_args, "-D_fastcall="); - fastcall_done = 1; - } - else - { - strarray_add(comp_args, "-D__stdcall=__attribute__((__stdcall__))"); - strarray_add(comp_args, "-D__cdecl=__attribute__((__cdecl__))"); - strarray_add(comp_args, "-D_stdcall=__attribute__((__stdcall__))"); - strarray_add(comp_args, "-D_cdecl=__attribute__((__cdecl__))"); - } - - if (!fastcall_done) - { - strarray_add(comp_args, "-D__fastcall=__attribute__((__fastcall__))"); - strarray_add(comp_args, "-D_fastcall=__attribute__((__fastcall__))"); + break; } strarray_add(comp_args, "-D__declspec(x)=__declspec_##x"); strarray_add(comp_args, "-D__declspec_align(x)=__attribute__((aligned(x)))");