From 9fd4647977b4ec17b827f563c675436e6ffe380b Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 26 Jul 2017 10:42:48 +0200 Subject: [PATCH] winebuild: Disallow register functions in 32-bit modules. Signed-off-by: Alexandre Julliard --- tools/winebuild/parser.c | 12 ++++++++++++ tools/winebuild/spec32.c | 24 ++++++------------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tools/winebuild/parser.c b/tools/winebuild/parser.c index 2762a8cd10e..ad996547a5b 100644 --- a/tools/winebuild/parser.c +++ b/tools/winebuild/parser.c @@ -498,6 +498,18 @@ static const char *parse_spec_flags( DLLSPEC *spec, ORDDEF *odp ) error( "Unknown flag '%s'\n", token ); return NULL; } + switch (1 << i) + { + case FLAG_RET16: + case FLAG_REGISTER: + if (spec->type == SPEC_WIN32) + error( "Flag '%s' is not supported in Win32\n", FlagNames[i] ); + break; + case FLAG_RET64: + if (spec->type == SPEC_WIN16) + error( "Flag '%s' is not supported in Win16\n", FlagNames[i] ); + break; + } odp->flags |= 1 << i; } token = GetToken(0); diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c index 39733b2b0b5..6536cd8a8b6 100644 --- a/tools/winebuild/spec32.c +++ b/tools/winebuild/spec32.c @@ -68,8 +68,6 @@ static inline int needs_relay( const ORDDEF *odp ) } /* skip norelay and forward entry points */ if (odp->flags & (FLAG_NORELAY|FLAG_FORWARD)) return 0; - /* skip register entry points on x86_64 */ - if (target_cpu == CPU_x86_64 && (odp->flags & FLAG_REGISTER)) return 0; return 1; } @@ -179,10 +177,7 @@ static void output_relay_debug( DLLSPEC *spec ) output( "\tpushl %%eax\n" ); flags |= 2; } - if (odp->flags & FLAG_REGISTER) - output( "\tpushl %%eax\n" ); - else - output( "\tpushl %%esp\n" ); + output( "\tpushl %%esp\n" ); output_cfi( ".cfi_adjust_cfa_offset 4" ); if (odp->flags & FLAG_RET64) flags |= 1; @@ -199,19 +194,12 @@ static void output_relay_debug( DLLSPEC *spec ) output( "\tpushl %%eax\n" ); output_cfi( ".cfi_adjust_cfa_offset 4" ); - if (odp->flags & FLAG_REGISTER) - { - output( "\tcall *8(%%eax)\n" ); - } + output( "\tcall *4(%%eax)\n" ); + output_cfi( ".cfi_adjust_cfa_offset -12" ); + if (odp->type == TYPE_STDCALL || odp->type == TYPE_THISCALL) + output( "\tret $%u\n", args * get_ptr_size() ); else - { - output( "\tcall *4(%%eax)\n" ); - output_cfi( ".cfi_adjust_cfa_offset -12" ); - if (odp->type == TYPE_STDCALL || odp->type == TYPE_THISCALL) - output( "\tret $%u\n", args * get_ptr_size() ); - else - output( "\tret\n" ); - } + output( "\tret\n" ); break; case CPU_ARM: -- 2.11.4.GIT