From 32984a640e57937a5836ff686820977132ee2a2b Mon Sep 17 00:00:00 2001 From: Wolfgang Thaller Date: Mon, 20 Jun 2005 13:38:39 +0000 Subject: [PATCH] Use __ASM_NAME and HAVE_ASM_DOT_SIZE in a few places in winebuild where they have been missing (needed for Darwin/x86). --- tools/winebuild/import.c | 16 ++++++++-------- tools/winebuild/relay.c | 39 ++++++++++++++++++++------------------- 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c index b9e1ea230ad..2d85041f208 100644 --- a/tools/winebuild/import.c +++ b/tools/winebuild/import.c @@ -716,7 +716,7 @@ static void output_import_thunk( FILE *outfile, const char *name, const char *ta fprintf( outfile, " \"\\tcall .L__wine_spec_%s\\n\"\n", name ); fprintf( outfile, " \".L__wine_spec_%s:\\n\"\n", name ); fprintf( outfile, " \"\\tpopl %%eax\\n\"\n" ); - fprintf( outfile, " \"\\taddl $%d+%s-.L__wine_spec_%s,%%eax\\n\"\n", pos, table, name ); + fprintf( outfile, " \"\\taddl $%d+" __ASM_NAME("%s") "-.L__wine_spec_%s,%%eax\\n\"\n", pos, table, name ); if (!strcmp( name, "__wine_call_from_16_regs" )) fprintf( outfile, " \"\\t.byte 0x2e\\n\"\n" ); fprintf( outfile, " \"\\tmovl 0(%%eax),%%eax\\n\"\n" ); @@ -729,7 +729,7 @@ static void output_import_thunk( FILE *outfile, const char *name, const char *ta fprintf( outfile, " \"\\tcall .L__wine_spec_%s\\n\"\n", name ); fprintf( outfile, " \".L__wine_spec_%s:\\n\"\n", name ); fprintf( outfile, " \"\\tpopl %%eax\\n\"\n" ); - fprintf( outfile, " \"\\taddl $%d+%s-.L__wine_spec_%s,%%eax\\n\"\n", pos, table, name ); + fprintf( outfile, " \"\\taddl $%d+" __ASM_NAME("%s") "-.L__wine_spec_%s,%%eax\\n\"\n", pos, table, name ); if (strstr( name, "__wine_call_from_16" )) fprintf( outfile, " \"\\t.byte 0x2e\\n\"\n" ); fprintf( outfile, " \"\\tjmp *0(%%eax)\\n\"\n" ); @@ -987,11 +987,11 @@ static void output_delayed_import_thunks( FILE *outfile, const DLLSPEC *spec ) fprintf( outfile, " \"" __ASM_NAME("__wine_delay_load_asm") ":\\n\"\n" ); #if defined(__i386__) fprintf( outfile, " \"\\tpushl %%ecx\\n\\tpushl %%edx\\n\\tpushl %%eax\\n\"\n" ); - fprintf( outfile, " \"\\tcall __wine_delay_load\\n\"\n" ); + fprintf( outfile, " \"\\tcall " __ASM_NAME("__wine_delay_load") "\\n\"\n" ); fprintf( outfile, " \"\\tpopl %%edx\\n\\tpopl %%ecx\\n\\tjmp *%%eax\\n\"\n" ); #elif defined(__sparc__) fprintf( outfile, " \"\\tsave %%sp, -96, %%sp\\n\"\n" ); - fprintf( outfile, " \"\\tcall __wine_delay_load\\n\"\n" ); + fprintf( outfile, " \"\\tcall " __ASM_NAME("__wine_delay_load") "\\n\"\n" ); fprintf( outfile, " \"\\tmov %%g1, %%o0\\n\"\n" ); fprintf( outfile, " \"\\tjmp %%o0\\n\\trestore\\n\"\n" ); #elif defined(__powerpc__) @@ -1047,7 +1047,7 @@ static void output_delayed_import_thunks( FILE *outfile, const DLLSPEC *spec ) /* branch to ctr register. */ fprintf( outfile, " \"bctr\\n\"\n"); #elif defined(__ALPHA__) - fprintf( outfile, " \"\\tjsr $26,__wine_delay_load\\n\"\n" ); + fprintf( outfile, " \"\\tjsr $26," __ASM_NAME("__wine_delay_load") "\\n\"\n" ); fprintf( outfile, " \"\\tjmp $31,($0)\\n\"\n" ); #else #error You need to defined delayed import thunks for your architecture! @@ -1068,10 +1068,10 @@ static void output_delayed_import_thunks( FILE *outfile, const DLLSPEC *spec ) fprintf( outfile, " \"" __ASM_NAME("%s") ":\\n\"\n", buffer ); #if defined(__i386__) fprintf( outfile, " \"\\tmovl $%d, %%eax\\n\"\n", (idx << 16) | j ); - fprintf( outfile, " \"\\tjmp __wine_delay_load_asm\\n\"\n" ); + fprintf( outfile, " \"\\tjmp " __ASM_NAME("__wine_delay_load_asm") "\\n\"\n" ); #elif defined(__sparc__) fprintf( outfile, " \"\\tset %d, %%g1\\n\"\n", (idx << 16) | j ); - fprintf( outfile, " \"\\tb,a __wine_delay_load_asm\\n\"\n" ); + fprintf( outfile, " \"\\tb,a " __ASM_NAME("__wine_delay_load_asm") "\\n\"\n" ); #elif defined(__powerpc__) #ifdef __APPLE__ /* On Darwin we can use r0 and r2 */ @@ -1097,7 +1097,7 @@ static void output_delayed_import_thunks( FILE *outfile, const DLLSPEC *spec ) #elif defined(__ALPHA__) fprintf( outfile, " \"\\tlda $0,%d($31)\\n\"\n", j); fprintf( outfile, " \"\\tldah $0,%d($0)\\n\"\n", idx); - fprintf( outfile, " \"\\tjmp $31,__wine_delay_load_asm\\n\"\n" ); + fprintf( outfile, " \"\\tjmp $31," __ASM_NAME("__wine_delay_load_asm") "\\n\"\n" ); #else #error You need to defined delayed import thunks for your architecture! #endif diff --git a/tools/winebuild/relay.c b/tools/winebuild/relay.c index 19f987ed254..930a44ab259 100644 --- a/tools/winebuild/relay.c +++ b/tools/winebuild/relay.c @@ -45,7 +45,9 @@ static void function_header( FILE *outfile, const char *name ) static void function_footer( FILE *outfile, const char *name ) { - fprintf( outfile, ".size " __ASM_NAME("%s") ", . - " __ASM_NAME("%s") "\n", name, name ); +#ifdef HAVE_ASM_DOT_SIZE + fprintf( outfile, "\t.size " __ASM_NAME("%s") ", . - " __ASM_NAME("%s") "\n", name, name ); +#endif } /******************************************************************* @@ -757,14 +759,14 @@ static void BuildRet16Func( FILE *outfile ) */ static void BuildCallTo32CBClient( FILE *outfile, BOOL isEx ) { - const char *name = isEx? "CBClientEx" : "CBClient"; + const char *name = isEx? "CALL32_CBClientEx" : "CALL32_CBClient"; int size = isEx? 24 : 12; /* Function header */ fprintf( outfile, "\n\t.align %d\n", get_alignment(4) ); - fprintf( outfile, "\t.globl " __ASM_NAME("CALL32_%s") "\n", name ); - fprintf( outfile, __ASM_NAME("CALL32_%s") ":\n", name ); + fprintf( outfile, "\t.globl " __ASM_NAME("%s") "\n", name ); + fprintf( outfile, __ASM_NAME("%s") ":\n", name ); /* Entry code */ @@ -832,10 +834,10 @@ static void BuildCallTo32CBClient( FILE *outfile, BOOL isEx ) fprintf( outfile, "\tmovl %%ebx, 0(%%edi)\n" ); /* 16-bit ss:sp */ if (!UsePIC) - fprintf( outfile, "\tmovl " __ASM_NAME("CALL32_%s_RetAddr") ", %%eax\n", name ); + fprintf( outfile, "\tmovl " __ASM_NAME("%s_RetAddr") ", %%eax\n", name ); else { - fprintf( outfile, "\tmovl " __ASM_NAME("CALL32_%s_RetAddr@GOT") "(%%edx), %%eax\n", name ); + fprintf( outfile, "\tmovl " __ASM_NAME("%s_RetAddr@GOT") "(%%edx), %%eax\n", name ); fprintf( outfile, "\tmovl (%%eax), %%eax\n" ); } fprintf( outfile, "\tmovl %%eax, 4(%%edi)\n" ); /* overwrite return address */ @@ -859,10 +861,10 @@ static void BuildCallTo32CBClient( FILE *outfile, BOOL isEx ) fprintf( outfile, "\tmovl %%eax, 16(%%edi)\n" ); if (!UsePIC) - fprintf( outfile, "\tmovl " __ASM_NAME("CALL32_%s_RetAddr") ", %%eax\n", name ); + fprintf( outfile, "\tmovl " __ASM_NAME("%s_RetAddr") ", %%eax\n", name ); else { - fprintf( outfile, "\tmovl " __ASM_NAME("CALL32_%s_RetAddr@GOT") "(%%edx), %%eax\n", name ); + fprintf( outfile, "\tmovl " __ASM_NAME("%s_RetAddr@GOT") "(%%edx), %%eax\n", name ); fprintf( outfile, "\tmovl (%%eax), %%eax\n" ); } fprintf( outfile, "\tmovl %%eax, 20(%%edi)\n" ); @@ -913,17 +915,17 @@ static void BuildCallTo32CBClient( FILE *outfile, BOOL isEx ) fprintf( outfile, "\tpopl %%edi\n" ); fprintf( outfile, "\tpopl %%ebp\n" ); fprintf( outfile, "\tret\n" ); - fprintf( outfile, ".size " __ASM_NAME("CALL32_%s") ", . - " __ASM_NAME("CALL32_%s") "\n", name, name ); + function_footer( outfile, name ); } static void BuildCallTo32CBClientRet( FILE *outfile, BOOL isEx ) { - const char *name = isEx? "CBClientEx" : "CBClient"; + const char *name = isEx? "CALL32_CBClientEx_Ret" : "CALL32_CBClient_Ret"; /* '16-bit' return stub */ - fprintf( outfile, "\n\t.globl " __ASM_NAME("CALL32_%s_Ret") "\n", name ); - fprintf( outfile, __ASM_NAME("CALL32_%s_Ret") ":\n", name ); + fprintf( outfile, "\n\t.globl " __ASM_NAME("%s") "\n", name ); + fprintf( outfile, __ASM_NAME("%s") ":\n", name ); if ( !isEx ) { @@ -938,13 +940,12 @@ static void BuildCallTo32CBClientRet( FILE *outfile, BOOL isEx ) fprintf( outfile, "\tlssl %%ss:-12(%%ebx), %%esp\n" ); } fprintf( outfile, "\tlret\n" ); - - fprintf( outfile, ".size " __ASM_NAME("CALL32_%s_Ret") ", . - " __ASM_NAME("CALL32_%s_Ret") "\n", name, name ); + function_footer( outfile, name ); /* Declare the return address variable */ - fprintf( outfile, "\n\t.globl " __ASM_NAME("CALL32_%s_RetAddr") "\n", name ); - fprintf( outfile, __ASM_NAME("CALL32_%s_RetAddr") ":\t.long 0\n", name ); + fprintf( outfile, "\n\t.globl " __ASM_NAME("%sAddr") "\n", name ); + fprintf( outfile, __ASM_NAME("%sAddr") ":\t.long 0\n", name ); } @@ -1177,7 +1178,7 @@ void BuildRelays16( FILE *outfile ) fprintf( outfile, __ASM_NAME("Call16_End") ":\n" ); fprintf( outfile, "\t.globl " __ASM_NAME("Call16_End") "\n" ); - fprintf( outfile, "\t.size " __ASM_NAME("__wine_spec_thunk_text_16") ",. - " __ASM_NAME("__wine_spec_thunk_text_16") "\n" ); + function_footer( outfile, "__wine_spec_thunk_text_16" ); /* The whole Call16_Ret segment must lie within the .data section */ fprintf( outfile, "\n\t.data\n" ); @@ -1200,7 +1201,7 @@ void BuildRelays16( FILE *outfile ) /* End of Call16_Ret segment */ fprintf( outfile, "\n\t.globl " __ASM_NAME("Call16_Ret_End") "\n" ); fprintf( outfile, __ASM_NAME("Call16_Ret_End") ":\n" ); - fprintf( outfile, "\t.size " __ASM_NAME("__wine_spec_thunk_data_16") ",. - " __ASM_NAME("__wine_spec_thunk_data_16") "\n" ); + function_footer( outfile, "__wine_spec_thunk_data_16" ); } /******************************************************************* @@ -1219,7 +1220,7 @@ void BuildRelays32( FILE *outfile ) /* 32-bit register entry point */ BuildCallFrom32Regs( outfile ); - fprintf( outfile, "\t.size " __ASM_NAME("__wine_spec_thunk_text_32") ",. - " __ASM_NAME("__wine_spec_thunk_text_32") "\n" ); + function_footer( outfile, "__wine_spec_thunk_text_32" ); } #else /* __i386__ */