diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h index fe925220e81..e76a87ae31a 100644 --- a/tools/winebuild/build.h +++ b/tools/winebuild/build.h @@ -268,6 +268,7 @@ extern DLLSPEC *alloc_dll_spec(void); extern void free_dll_spec( DLLSPEC *spec ); extern char *make_c_identifier( const char *str ); extern const char *get_stub_name( const ORDDEF *odp, const DLLSPEC *spec ); +extern const char *get_link_name( const ORDDEF *odp ); extern int get_cpu_from_name( const char *name ); extern unsigned int get_alignment(unsigned int align); extern unsigned int get_page_size(void); diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c index 2816c658c1b..5c4de1c1607 100644 --- a/tools/winebuild/import.c +++ b/tools/winebuild/import.c @@ -498,7 +498,7 @@ static char *create_undef_symbols_file( DLLSPEC *spec ) ORDDEF *odp = &spec->entry_points[i]; if (odp->type == TYPE_STUB || odp->type == TYPE_ABS || odp->type == TYPE_VARIABLE) continue; if (odp->flags & FLAG_FORWARD) continue; - output( "\t%s %s\n", get_asm_ptr_keyword(), asm_name(odp->link_name) ); + output( "\t%s %s\n", get_asm_ptr_keyword(), asm_name( get_link_name( odp ))); } for (j = 0; j < extra_ld_symbols.count; j++) output( "\t%s %s\n", get_asm_ptr_keyword(), asm_name(extra_ld_symbols.str[j]) ); diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c index 80124f03edf..69b6d2fbb31 100644 --- a/tools/winebuild/spec32.c +++ b/tools/winebuild/spec32.c @@ -419,7 +419,7 @@ void output_exports( DLLSPEC *spec ) } else { - output( "\t%s %s\n", get_asm_ptr_keyword(), asm_name(odp->link_name) ); + output( "\t%s %s\n", get_asm_ptr_keyword(), asm_name( get_link_name( odp ))); } break; case TYPE_STUB: @@ -977,15 +977,9 @@ void output_def_file( DLLSPEC *spec, int include_private ) int at_param = get_args_size( odp ); if (!kill_at && target_cpu == CPU_x86) output( "@%d", at_param ); if (odp->flags & FLAG_FORWARD) - { output( "=%s", odp->link_name ); - } else if (strcmp(name, odp->link_name)) /* try to reduce output */ - { - output( "=%s", odp->link_name ); - if (!kill_at && target_cpu == CPU_x86 && !(odp->flags & FLAG_THISCALL)) - output( "@%d", at_param ); - } + output( "=%s", get_link_name( odp )); break; } default: diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c index 06c3d39b079..63be3af7c6b 100644 --- a/tools/winebuild/utils.c +++ b/tools/winebuild/utils.c @@ -894,6 +894,21 @@ const char *get_stub_name( const ORDDEF *odp, const DLLSPEC *spec ) return buffer; } +/* return the stdcall-decorated name for an entry point */ +const char *get_link_name( const ORDDEF *odp ) +{ + static char *buffer; + + if (!kill_at && target_platform == PLATFORM_WINDOWS && target_cpu == CPU_x86 && + odp->type == TYPE_STDCALL && !(odp->flags & FLAG_THISCALL)) + { + free( buffer ); + buffer = strmake( "%s@%u", odp->link_name, get_args_size( odp )); + return buffer; + } + return odp->link_name; +} + /* parse a cpu name and return the corresponding value */ int get_cpu_from_name( const char *name ) {