winegcc: Force stack alignment on all x86 platforms.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2015-11-16 22:52:41 +09:00
parent cd525dda2a
commit bf73faefc7
1 changed files with 11 additions and 24 deletions

View File

@ -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)))");