diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h index a140d1cea35..a65cf1c235a 100644 --- a/tools/winebuild/build.h +++ b/tools/winebuild/build.h @@ -184,6 +184,8 @@ extern unsigned int get_page_size(void); extern const char *asm_name( const char *func ); extern const char *func_declaration( const char *func ); extern const char *func_size( const char *func ); +extern const char *get_asm_string_keyword(void); +extern const char *get_asm_short_keyword(void); extern void add_import_dll( const char *name, const char *filename ); extern void add_delayed_import( const char *name ); diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c index 3bac09a7530..42514b3800f 100644 --- a/tools/winebuild/spec32.c +++ b/tools/winebuild/spec32.c @@ -266,12 +266,12 @@ static void output_exports( FILE *outfile, DLLSPEC *spec ) fprintf( outfile, " \"__wine_spec_exp_ordinals:\\n\"\n" ); for (i = 0; i < spec->nb_names; i++) { - fprintf( outfile, " \"\\t" __ASM_SHORT " %d\\n\"\n", - spec->names[i]->ordinal - spec->base ); + fprintf( outfile, " \"\\t%s %d\\n\"\n", + get_asm_short_keyword(), spec->names[i]->ordinal - spec->base ); } if (spec->nb_names % 2) { - fprintf( outfile, " \"\\t" __ASM_SHORT " 0\\n\"\n" ); + fprintf( outfile, " \"\\t%s 0\\n\"\n", get_asm_short_keyword() ); } } @@ -284,7 +284,7 @@ static void output_exports( FILE *outfile, DLLSPEC *spec ) { ORDDEF *odp = spec->ordinals[i]; if (odp && (odp->flags & FLAG_FORWARD)) - fprintf( outfile, " \"\\t" __ASM_STRING " \\\"%s\\\"\\n\"\n", odp->link_name ); + fprintf( outfile, " \"\\t%s \\\"%s\\\"\\n\"\n", get_asm_string_keyword(), odp->link_name ); } fprintf( outfile, " \"\\t.align %d\\n\"\n", get_alignment(4) ); } @@ -324,7 +324,7 @@ static void output_exports( FILE *outfile, DLLSPEC *spec ) case TYPE_CDECL: fprintf( outfile, " \"\\tjmp %s\\n\"\n", asm_name(odp->link_name) ); fprintf( outfile, " \"\\tret\\n\"\n" ); - fprintf( outfile, " \"\\t" __ASM_SHORT " %d\\n\"\n", args ); + fprintf( outfile, " \"\\t%s %d\\n\"\n", get_asm_short_keyword(), args ); fprintf( outfile, " \"\\t.long %s,0x%08x\\n\"\n", asm_name(odp->link_name), mask ); break; default: diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c index f6c9d25b7cd..6164646a816 100644 --- a/tools/winebuild/utils.c +++ b/tools/winebuild/utils.c @@ -384,26 +384,72 @@ unsigned int get_page_size(void) const char *asm_name( const char *sym ) { static char buffer[256]; - sprintf( buffer, __ASM_NAME("%s"), sym ); - return buffer; + + switch (target_platform) + { + case PLATFORM_APPLE: + case PLATFORM_WINDOWS: + buffer[0] = '_'; + strcpy( buffer + 1, sym ); + return buffer; + default: + return sym; + } } /* return an assembly function declaration for a C function name */ const char *func_declaration( const char *func ) { static char buffer[256]; - sprintf( buffer, __ASM_FUNC("%s"), func ); + + switch (target_platform) + { + case PLATFORM_WINDOWS: + sprintf( buffer, ".def _%s; .scl 2; .type 32; .endef", func ); + break; + case PLATFORM_APPLE: + sprintf( buffer, ".type _%s,@function", func ); + break; + case PLATFORM_SVR4: + sprintf( buffer, ".type %s,2", func ); + break; + default: + sprintf( buffer, ".type %s,@function", func ); + break; + } return buffer; } /* return a size declaration for an assembly function */ const char *func_size( const char *func ) { -#ifdef HAVE_ASM_DOT_SIZE static char buffer[256]; - sprintf( buffer, ".size " __ASM_NAME("%s") ", .-" __ASM_NAME("%s"), func, func ); - return buffer; -#else - return ""; -#endif + + switch (target_platform) + { + case PLATFORM_APPLE: + case PLATFORM_WINDOWS: + return ""; + default: + sprintf( buffer, ".size %s, .-%s", func, func ); + return buffer; + } +} + +const char *get_asm_string_keyword(void) +{ + switch (target_platform) + { + case PLATFORM_SVR4: return ".asciz"; + default: return ".string"; + } +} + +const char *get_asm_short_keyword(void) +{ + switch (target_platform) + { + case PLATFORM_SVR4: return ".half"; + default: return ".short"; + } }