Alexandre Julliard : winebuild: Add a helper for decorating stdcall function names.
Alexandre Julliard
julliard at winehq.org
Wed Mar 6 15:29:40 CST 2019
Module: wine
Branch: master
Commit: ef9bda4c960204c81882f53792ee3e83729024c0
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ef9bda4c960204c81882f53792ee3e83729024c0
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Mar 6 10:12:55 2019 +0100
winebuild: Add a helper for decorating stdcall function names.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
tools/winebuild/build.h | 1 +
tools/winebuild/import.c | 2 +-
tools/winebuild/spec32.c | 10 ++--------
tools/winebuild/utils.c | 15 +++++++++++++++
4 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index fe92522..e76a87a 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 2816c65..5c4de1c 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 80124f0..69b6d2f 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 06c3d39..63be3af 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 )
{
More information about the wine-cvs
mailing list