winebuild: Add a helper for decorating stdcall function names.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Alexandre Julliard 2019-03-06 10:12:55 +01:00
parent a3229faf59
commit ef9bda4c96
4 changed files with 19 additions and 9 deletions

View File

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

View File

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

View File

@ -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:

View File

@ -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 )
{