Replaced all uses of the __ASM_NAME macro by the asm_name function to

allow run-time determination of the correct format.
This commit is contained in:
Alexandre Julliard 2005-06-27 18:59:54 +00:00
parent 7894c1e879
commit 445fb59802
5 changed files with 111 additions and 107 deletions

View File

@ -181,7 +181,7 @@ extern void free_dll_spec( DLLSPEC *spec );
extern const char *make_c_identifier( const char *str );
extern unsigned int get_alignment(unsigned int align);
extern unsigned int get_page_size(void);
extern const char *func_name( const char *func );
extern const char *asm_name( const char *func );
extern const char *func_declaration( const char *func );
extern const char *func_size( const char *func );

View File

@ -603,7 +603,7 @@ void read_undef_symbols( char **argv )
if (!argv[0]) return;
strcpy( name_prefix, func_name("") );
strcpy( name_prefix, asm_name("") );
prefix_len = strlen( name_prefix );
undef_size = nb_undef_symbols = 0;
@ -690,8 +690,8 @@ static void output_import_thunk( FILE *outfile, const char *name, const char *ta
{
fprintf( outfile, " \"\\t.align %d\\n\"\n", get_alignment(8) );
fprintf( outfile, " \"\\t%s\\n\"\n", func_declaration(name) );
fprintf( outfile, " \"\\t.globl " __ASM_NAME("%s") "\\n\"\n", name );
fprintf( outfile, " \"" __ASM_NAME("%s") ":\\n\"\n", name);
fprintf( outfile, " \"\\t.globl %s\\n\"\n", asm_name(name) );
fprintf( outfile, " \"%s:\\n\"\n", asm_name(name) );
switch(target_cpu)
{
@ -712,7 +712,8 @@ 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+" __ASM_NAME("%s") "-.L__wine_spec_%s,%%eax\\n\"\n", pos, table, name );
fprintf( outfile, " \"\\taddl $%d+%s-.L__wine_spec_%s,%%eax\\n\"\n",
pos, asm_name(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" );
@ -725,7 +726,8 @@ 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+" __ASM_NAME("%s") "-.L__wine_spec_%s,%%eax\\n\"\n", pos, table, name );
fprintf( outfile, " \"\\taddl $%d+%s-.L__wine_spec_%s,%%eax\\n\"\n",
pos, asm_name(table), name );
if (strstr( name, "__wine_call_from_16" ))
fprintf( outfile, " \"\\t.byte 0x2e\\n\"\n" );
fprintf( outfile, " \"\\tjmp *0(%%eax)\\n\"\n" );
@ -765,17 +767,17 @@ static void output_import_thunk( FILE *outfile, const char *name, const char *ta
fprintf(outfile, " \"\\tstw %s, 0(%s)\\n\"\n", ppc_reg(7), ppc_reg(1));
if (target_platform == PLATFORM_APPLE)
{
fprintf(outfile, " \"\\tlis %s, ha16(" __ASM_NAME("%s") "+ %d)\\n\"\n",
ppc_reg(9), table, pos);
fprintf(outfile, " \"\\tla %s, lo16(" __ASM_NAME("%s") "+ %d)(%s)\\n\"\n",
ppc_reg(8), table, pos, ppc_reg(9));
fprintf(outfile, " \"\\tlis %s, ha16(%s+%d)\\n\"\n",
ppc_reg(9), asm_name(table), pos);
fprintf(outfile, " \"\\tla %s, lo16(%s+%d)(%s)\\n\"\n",
ppc_reg(8), asm_name(table), pos, ppc_reg(9));
}
else
{
fprintf(outfile, " \"\\tlis %s, (" __ASM_NAME("%s") "+ %d)@hi\\n\"\n",
ppc_reg(9), table, pos);
fprintf(outfile, " \"\\tla %s, (" __ASM_NAME("%s") "+ %d)@l(%s)\\n\"\n",
ppc_reg(8), table, pos, ppc_reg(9));
fprintf(outfile, " \"\\tlis %s, (%s+%d)@hi\\n\"\n",
ppc_reg(9), asm_name(table), pos);
fprintf(outfile, " \"\\tla %s, (%s+%d)@l(%s)\\n\"\n",
ppc_reg(8), asm_name(table), pos, ppc_reg(9));
}
fprintf(outfile, " \"\\tlwz %s, 0(%s)\\n\"\n", ppc_reg(7), ppc_reg(8));
fprintf(outfile, " \"\\tmtctr %s\\n\"\n", ppc_reg(7));
@ -863,7 +865,7 @@ static void output_immediate_import_thunks( FILE *outfile )
(nb_imm + 1); /* offset of imports.data from start of imports */
fprintf( outfile, "/* immediate import thunks */\n" );
fprintf( outfile, "asm(\".text\\n\\t.align %d\\n\"\n", get_alignment(8) );
fprintf( outfile, " \"" __ASM_NAME("%s") ":\\n\"\n", import_thunks);
fprintf( outfile, " \"%s:\\n\"\n", asm_name(import_thunks));
for (i = 0; i < nb_imports; i++)
{
@ -990,24 +992,24 @@ static void output_delayed_import_thunks( FILE *outfile, const DLLSPEC *spec )
fprintf( outfile, "/* delayed import thunks */\n" );
fprintf( outfile, "asm(\".text\\n\"\n" );
fprintf( outfile, " \"\\t.align %d\\n\"\n", get_alignment(8) );
fprintf( outfile, " \"" __ASM_NAME("%s") ":\\n\"\n", delayed_import_loaders);
fprintf( outfile, " \"%s:\\n\"\n", asm_name(delayed_import_loaders));
fprintf( outfile, " \"\\t%s\\n\"\n", func_declaration("__wine_delay_load_asm") );
fprintf( outfile, " \"" __ASM_NAME("__wine_delay_load_asm") ":\\n\"\n" );
fprintf( outfile, " \"%s:\\n\"\n", asm_name("__wine_delay_load_asm") );
switch(target_cpu)
{
case CPU_x86:
fprintf( outfile, " \"\\tpushl %%ecx\\n\\tpushl %%edx\\n\\tpushl %%eax\\n\"\n" );
fprintf( outfile, " \"\\tcall " __ASM_NAME("__wine_delay_load") "\\n\"\n" );
fprintf( outfile, " \"\\tcall %s\\n\"\n", asm_name("__wine_delay_load") );
fprintf( outfile, " \"\\tpopl %%edx\\n\\tpopl %%ecx\\n\\tjmp *%%eax\\n\"\n" );
break;
case CPU_SPARC:
fprintf( outfile, " \"\\tsave %%sp, -96, %%sp\\n\"\n" );
fprintf( outfile, " \"\\tcall " __ASM_NAME("__wine_delay_load") "\\n\"\n" );
fprintf( outfile, " \"\\tcall %s\\n\"\n", asm_name("__wine_delay_load") );
fprintf( outfile, " \"\\tmov %%g1, %%o0\\n\"\n" );
fprintf( outfile, " \"\\tjmp %%o0\\n\\trestore\\n\"\n" );
break;
case CPU_ALPHA:
fprintf( outfile, " \"\\tjsr $26," __ASM_NAME("__wine_delay_load") "\\n\"\n" );
fprintf( outfile, " \"\\tjsr $26,%s\\n\"\n", asm_name("__wine_delay_load") );
fprintf( outfile, " \"\\tjmp $31,($0)\\n\"\n" );
break;
case CPU_POWERPC:
@ -1034,7 +1036,7 @@ static void output_delayed_import_thunks( FILE *outfile, const DLLSPEC *spec )
fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg(0), 44+extra_stack_storage, ppc_reg(1));
/* Call the __wine_delay_load function, arg1 is arg1. */
fprintf( outfile, " \"\\tbl " __ASM_NAME("__wine_delay_load") "\\n\"\n");
fprintf( outfile, " \"\\tbl %s\\n\"\n", asm_name("__wine_delay_load") );
/* Load return value from call into ctr register */
fprintf( outfile, " \"\\tmtctr %s\\n\"\n", ppc_reg(3));
@ -1073,21 +1075,21 @@ static void output_delayed_import_thunks( FILE *outfile, const DLLSPEC *spec )
sprintf( buffer, "__wine_delay_imp_%d_%s", i, name );
fprintf( outfile, " \"\\t%s\\n\"\n", func_declaration(buffer) );
fprintf( outfile, " \"" __ASM_NAME("%s") ":\\n\"\n", buffer );
fprintf( outfile, " \"%s:\\n\"\n", asm_name(buffer) );
switch(target_cpu)
{
case CPU_x86:
fprintf( outfile, " \"\\tmovl $%d, %%eax\\n\"\n", (idx << 16) | j );
fprintf( outfile, " \"\\tjmp " __ASM_NAME("__wine_delay_load_asm") "\\n\"\n" );
fprintf( outfile, " \"\\tjmp %s\\n\"\n", asm_name("__wine_delay_load_asm") );
break;
case CPU_SPARC:
fprintf( outfile, " \"\\tset %d, %%g1\\n\"\n", (idx << 16) | j );
fprintf( outfile, " \"\\tb,a " __ASM_NAME("__wine_delay_load_asm") "\\n\"\n" );
fprintf( outfile, " \"\\tb,a %s\\n\"\n", asm_name("__wine_delay_load_asm") );
break;
case CPU_ALPHA:
fprintf( outfile, " \"\\tlda $0,%d($31)\\n\"\n", j);
fprintf( outfile, " \"\\tldah $0,%d($0)\\n\"\n", idx);
fprintf( outfile, " \"\\tjmp $31," __ASM_NAME("__wine_delay_load_asm") "\\n\"\n" );
fprintf( outfile, " \"\\tjmp $31,%s\\n\"\n", asm_name("__wine_delay_load_asm") );
break;
case CPU_POWERPC:
switch(target_platform)
@ -1098,7 +1100,7 @@ static void output_delayed_import_thunks( FILE *outfile, const DLLSPEC *spec )
fprintf( outfile, " \"\\tlis %s, %d\\n\"\n", ppc_reg(2), idx);
/* Lower part + r2 -> r0, Note we can't use r0 directly */
fprintf( outfile, " \"\\taddi %s, %s, %d\\n\"\n", ppc_reg(0), ppc_reg(2), j);
fprintf( outfile, " \"\\tb " __ASM_NAME("__wine_delay_load_asm") "\\n\"\n");
fprintf( outfile, " \"\\tb %s\\n\"\n", asm_name("__wine_delay_load_asm") );
break;
default:
/* On linux we can't use r2 since r2 is not a scratch register (hold the TOC) */
@ -1112,7 +1114,7 @@ static void output_delayed_import_thunks( FILE *outfile, const DLLSPEC *spec )
/* Restore r13 */
fprintf( outfile, " \"\\tstw %s, 0(%s)\\n\"\n", ppc_reg(13), ppc_reg(1));
fprintf( outfile, " \"\\taddic %s, %s, 0x4\\n\"\n", ppc_reg(1), ppc_reg(1));
fprintf( outfile, " \"\\tb " __ASM_NAME("__wine_delay_load_asm") "\\n\"\n");
fprintf( outfile, " \"\\tb %s\\n\"\n", asm_name("__wine_delay_load_asm") );
break;
}
break;
@ -1124,7 +1126,7 @@ static void output_delayed_import_thunks( FILE *outfile, const DLLSPEC *spec )
output_function_size( outfile, delayed_import_loaders );
fprintf( outfile, "\n \".align %d\\n\"\n", get_alignment(8) );
fprintf( outfile, " \"" __ASM_NAME("%s") ":\\n\"\n", delayed_import_thunks);
fprintf( outfile, " \"%s:\\n\"\n", asm_name(delayed_import_thunks));
pos = nb_delayed * 32;
for (i = 0; i < nb_imports; i++)
{

View File

@ -36,8 +36,8 @@ static void function_header( FILE *outfile, const char *name )
{
fprintf( outfile, "\n\t.align %d\n", get_alignment(4) );
fprintf( outfile, "\t%s\n", func_declaration(name) );
fprintf( outfile, "\t.globl " __ASM_NAME("%s") "\n", name );
fprintf( outfile, __ASM_NAME("%s") ":\n", name );
fprintf( outfile, "\t.globl %s\n", asm_name(name) );
fprintf( outfile, "%s:\n", asm_name(name) );
}
@ -152,11 +152,11 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk, int sho
if (UsePIC)
{
fprintf( outfile, "\t.byte 0x2e\n\tmovl " __ASM_NAME("CallTo16_DataSelector@GOT") "(%%ecx), %%edx\n" );
fprintf( outfile, "\t.byte 0x2e\n\tmovl %s(%%ecx), %%edx\n", asm_name("CallTo16_DataSelector@GOT") );
fprintf( outfile, "\t.byte 0x2e\n\tmovl (%%edx), %%edx\n" );
}
else
fprintf( outfile, "\t.byte 0x2e\n\tmovl " __ASM_NAME("CallTo16_DataSelector") ",%%edx\n" );
fprintf( outfile, "\t.byte 0x2e\n\tmovl %s,%%edx\n", asm_name("CallTo16_DataSelector") );
/* Load 32-bit segment registers */
fprintf( outfile, "%s\tmovw %%dx, %%ds\n", data16_prefix() );
@ -164,19 +164,19 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk, int sho
if ( UsePIC )
{
fprintf( outfile, "\tmovl " __ASM_NAME("CallTo16_TebSelector@GOT") "(%%ecx), %%edx\n" );
fprintf( outfile, "\tmovl %s(%%ecx), %%edx\n", asm_name("CallTo16_TebSelector@GOT") );
fprintf( outfile, "\tmovw (%%edx), %%fs\n" );
}
else
fprintf( outfile, "\tmovw " __ASM_NAME("CallTo16_TebSelector") ", %%fs\n" );
fprintf( outfile, "\tmovw %s, %%fs\n", asm_name("CallTo16_TebSelector") );
fprintf( outfile, "\t.byte 0x64\n\tmov (%d),%%gs\n", STRUCTOFFSET(TEB,gs_sel) );
/* Get address of wine_ldt_copy array into %ecx */
if ( UsePIC )
fprintf( outfile, "\tmovl " __ASM_NAME("wine_ldt_copy@GOT") "(%%ecx), %%ecx\n" );
fprintf( outfile, "\tmovl %s(%%ecx), %%ecx\n", asm_name("wine_ldt_copy@GOT") );
else
fprintf( outfile, "\tmovl $" __ASM_NAME("wine_ldt_copy") ", %%ecx\n" );
fprintf( outfile, "\tmovl $%s, %%ecx\n", asm_name("wine_ldt_copy") );
/* Translate STACK16FRAME base to flat offset in %edx */
fprintf( outfile, "\tmovw %%ss, %%dx\n" );
@ -316,9 +316,9 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk, int sho
fprintf( outfile, "\tpushl $0\n" );
if ( UsePIC )
fprintf( outfile, "\tcall " __ASM_NAME("RELAY_DebugCallFrom16@PLT") "\n ");
fprintf( outfile, "\tcall %s\n ", asm_name("RELAY_DebugCallFrom16@PLT"));
else
fprintf( outfile, "\tcall " __ASM_NAME("RELAY_DebugCallFrom16") "\n ");
fprintf( outfile, "\tcall %s\n ", asm_name("RELAY_DebugCallFrom16"));
fprintf( outfile, "\tpopl %%edx\n" );
fprintf( outfile, "\tpopl %%edx\n" );
@ -355,9 +355,9 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk, int sho
fprintf( outfile, "\tpushl $0\n" );
if ( UsePIC )
fprintf( outfile, "\tcall " __ASM_NAME("RELAY_DebugCallFrom16Ret@PLT") "\n ");
fprintf( outfile, "\tcall %s\n ", asm_name("RELAY_DebugCallFrom16Ret@PLT"));
else
fprintf( outfile, "\tcall " __ASM_NAME("RELAY_DebugCallFrom16Ret") "\n ");
fprintf( outfile, "\tcall %s\n ", asm_name("RELAY_DebugCallFrom16Ret"));
fprintf( outfile, "\tpopl %%eax\n" );
fprintf( outfile, "\tpopl %%eax\n" );
@ -618,11 +618,13 @@ static void BuildRet16Func( FILE *outfile )
/* Restore 32-bit segment registers */
fprintf( outfile, "\t.byte 0x2e\n\tmovl " __ASM_NAME("CallTo16_DataSelector") "-" __ASM_NAME("Call16_Ret_Start") ",%%edi\n" );
fprintf( outfile, "\t.byte 0x2e\n\tmovl %s", asm_name("CallTo16_DataSelector") );
fprintf( outfile, "-%s,%%edi\n", asm_name("Call16_Ret_Start") );
fprintf( outfile, "%s\tmovw %%di,%%ds\n", data16_prefix() );
fprintf( outfile, "%s\tmovw %%di,%%es\n", data16_prefix() );
fprintf( outfile, "\t.byte 0x2e\n\tmov " __ASM_NAME("CallTo16_TebSelector") "-" __ASM_NAME("Call16_Ret_Start") ",%%fs\n" );
fprintf( outfile, "\t.byte 0x2e\n\tmov %s", asm_name("CallTo16_TebSelector") );
fprintf( outfile, "-%s,%%fs\n", asm_name("Call16_Ret_Start") );
fprintf( outfile, "\t.byte 0x64\n\tmov (%d),%%gs\n", STRUCTOFFSET(TEB,gs_sel) );
@ -641,10 +643,10 @@ static void BuildRet16Func( FILE *outfile )
/* Declare the return address and data selector variables */
fprintf( outfile, "\n\t.align %d\n", get_alignment(4) );
fprintf( outfile, "\t.globl " __ASM_NAME("CallTo16_DataSelector") "\n" );
fprintf( outfile, __ASM_NAME("CallTo16_DataSelector") ":\t.long 0\n" );
fprintf( outfile, "\t.globl " __ASM_NAME("CallTo16_TebSelector") "\n" );
fprintf( outfile, __ASM_NAME("CallTo16_TebSelector") ":\t.long 0\n" );
fprintf( outfile, "\t.globl %s\n", asm_name("CallTo16_DataSelector") );
fprintf( outfile, "%s:\t.long 0\n", asm_name("CallTo16_DataSelector") );
fprintf( outfile, "\t.globl %s\n", asm_name("CallTo16_TebSelector") );
fprintf( outfile, "%s:\t.long 0\n", asm_name("CallTo16_TebSelector") );
}
@ -746,8 +748,8 @@ static void BuildCallTo32CBClient( FILE *outfile, BOOL isEx )
/* Function header */
fprintf( outfile, "\n\t.align %d\n", get_alignment(4) );
fprintf( outfile, "\t.globl " __ASM_NAME("%s") "\n", name );
fprintf( outfile, __ASM_NAME("%s") ":\n", name );
fprintf( outfile, "\t.globl %s\n", asm_name(name) );
fprintf( outfile, "%s:\n", asm_name(name) );
/* Entry code */
@ -776,10 +778,10 @@ static void BuildCallTo32CBClient( FILE *outfile, BOOL isEx )
fprintf( outfile, "\tandl $0xfff8,%%eax\n" );
fprintf( outfile, "\tshrl $1,%%eax\n" );
if (!UsePIC)
fprintf( outfile, "\tmovl " __ASM_NAME("wine_ldt_copy") "(%%eax),%%esi\n" );
fprintf( outfile, "\tmovl %s(%%eax),%%esi\n", asm_name("wine_ldt_copy") );
else
{
fprintf( outfile, "\tmovl " __ASM_NAME("wine_ldt_copy@GOT") "(%%edx), %%esi\n" );
fprintf( outfile, "\tmovl %s(%%edx), %%esi\n", asm_name("wine_ldt_copy@GOT") );
fprintf( outfile, "\tmovl (%%esi,%%eax), %%esi\n" );
}
fprintf( outfile, "\tmovw %%bx,%%ax\n" );
@ -815,10 +817,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("%s_RetAddr") ", %%eax\n", name );
fprintf( outfile, "\tmovl %s_RetAddr, %%eax\n", asm_name(name) );
else
{
fprintf( outfile, "\tmovl " __ASM_NAME("%s_RetAddr@GOT") "(%%edx), %%eax\n", name );
fprintf( outfile, "\tmovl %s_RetAddr@GOT(%%edx), %%eax\n", asm_name(name) );
fprintf( outfile, "\tmovl (%%eax), %%eax\n" );
}
fprintf( outfile, "\tmovl %%eax, 4(%%edi)\n" ); /* overwrite return address */
@ -842,10 +844,10 @@ static void BuildCallTo32CBClient( FILE *outfile, BOOL isEx )
fprintf( outfile, "\tmovl %%eax, 16(%%edi)\n" );
if (!UsePIC)
fprintf( outfile, "\tmovl " __ASM_NAME("%s_RetAddr") ", %%eax\n", name );
fprintf( outfile, "\tmovl %s_RetAddr, %%eax\n", asm_name(name) );
else
{
fprintf( outfile, "\tmovl " __ASM_NAME("%s_RetAddr@GOT") "(%%edx), %%eax\n", name );
fprintf( outfile, "\tmovl %s_RetAddr@GOT(%%edx), %%eax\n", asm_name(name) );
fprintf( outfile, "\tmovl (%%eax), %%eax\n" );
}
fprintf( outfile, "\tmovl %%eax, 20(%%edi)\n" );
@ -905,8 +907,8 @@ static void BuildCallTo32CBClientRet( FILE *outfile, BOOL isEx )
/* '16-bit' return stub */
fprintf( outfile, "\n\t.globl " __ASM_NAME("%s") "\n", name );
fprintf( outfile, __ASM_NAME("%s") ":\n", name );
fprintf( outfile, "\n\t.globl %s\n", asm_name(name) );
fprintf( outfile, "%s:\n", asm_name(name) );
if ( !isEx )
{
@ -925,8 +927,8 @@ static void BuildCallTo32CBClientRet( FILE *outfile, BOOL isEx )
/* Declare the return address variable */
fprintf( outfile, "\n\t.globl " __ASM_NAME("%sAddr") "\n", name );
fprintf( outfile, __ASM_NAME("%sAddr") ":\t.long 0\n", name );
fprintf( outfile, "\n\t.globl %sAddr\n", asm_name(name) );
fprintf( outfile, "%sAddr:\t.long 0\n", asm_name(name) );
}
@ -1088,12 +1090,12 @@ static void BuildPendingEventCheck( FILE *outfile )
fprintf( outfile, "\t.byte 0x64\n\ttestl $0xffffffff,(%d)\n",
STRUCTOFFSET(TEB,vm86_pending) );
fprintf( outfile, "\tje " __ASM_NAME("DPMI_PendingEventCheck_Cleanup") "\n" );
fprintf( outfile, "\tje %s\n", asm_name("DPMI_PendingEventCheck_Cleanup") );
fprintf( outfile, "\t.byte 0x64\n\ttestl $0xffffffff,(%d)\n",
STRUCTOFFSET(TEB,dpmi_vif) );
fprintf( outfile, "\tje " __ASM_NAME("DPMI_PendingEventCheck_Cleanup") "\n" );
fprintf( outfile, "\tje %s\n", asm_name("DPMI_PendingEventCheck_Cleanup") );
/* Process pending events. */
@ -1101,14 +1103,14 @@ static void BuildPendingEventCheck( FILE *outfile )
/* Start cleanup. Restore fs register. */
fprintf( outfile, ".globl " __ASM_NAME("DPMI_PendingEventCheck_Cleanup") "\n" );
fprintf( outfile, __ASM_NAME("DPMI_PendingEventCheck_Cleanup") ":\n" );
fprintf( outfile, ".globl %s\n", asm_name("DPMI_PendingEventCheck_Cleanup") );
fprintf( outfile, "%s:\n", asm_name("DPMI_PendingEventCheck_Cleanup") );
fprintf( outfile, "\tpopw %%fs\n" );
/* Return from function. */
fprintf( outfile, ".globl " __ASM_NAME("DPMI_PendingEventCheck_Return") "\n" );
fprintf( outfile, __ASM_NAME("DPMI_PendingEventCheck_Return") ":\n" );
fprintf( outfile, ".globl %s\n", asm_name("DPMI_PendingEventCheck_Return") );
fprintf( outfile, "%s:\n", asm_name("DPMI_PendingEventCheck_Return") );
fprintf( outfile, "\tiret\n" );
function_footer( outfile, "DPMI_PendingEventCheck" );
@ -1133,10 +1135,10 @@ void BuildRelays16( FILE *outfile )
fprintf( outfile, "/* File generated automatically. Do not edit! */\n\n" );
fprintf( outfile, "\t.text\n" );
fprintf( outfile, __ASM_NAME("__wine_spec_thunk_text_16") ":\n\n" );
fprintf( outfile, "%s:\n\n", asm_name("__wine_spec_thunk_text_16") );
fprintf( outfile, __ASM_NAME("Call16_Start") ":\n" );
fprintf( outfile, "\t.globl " __ASM_NAME("Call16_Start") "\n" );
fprintf( outfile, "\t.globl %s\n", asm_name("Call16_Start") );
fprintf( outfile, "%s:\n", asm_name("Call16_Start") );
fprintf( outfile, "\t.byte 0\n\n" );
/* Standard CallFrom16 routine (WORD return) */
@ -1163,15 +1165,15 @@ void BuildRelays16( FILE *outfile )
/* CBClientThunkSLEx routine */
BuildCallTo32CBClient( outfile, TRUE );
fprintf( outfile, __ASM_NAME("Call16_End") ":\n" );
fprintf( outfile, "\t.globl " __ASM_NAME("Call16_End") "\n" );
fprintf( outfile, "\t.globl %s\n", asm_name("Call16_End") );
fprintf( outfile, "%s:\n", asm_name("Call16_End") );
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" );
fprintf( outfile, __ASM_NAME("__wine_spec_thunk_data_16") ":\n\n" );
fprintf( outfile, "\t.globl " __ASM_NAME("Call16_Ret_Start") "\n" );
fprintf( outfile, __ASM_NAME("Call16_Ret_Start") ":\n" );
fprintf( outfile, "%s:\n\n", asm_name("__wine_spec_thunk_data_16") );
fprintf( outfile, "\t.globl %s\n", asm_name("Call16_Ret_Start") );
fprintf( outfile, "%s:\n", asm_name("Call16_Ret_Start") );
/* Standard CallTo16 return stub */
BuildRet16Func( outfile );
@ -1186,8 +1188,8 @@ void BuildRelays16( FILE *outfile )
BuildPendingEventCheck( 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, "\n\t.globl %s\n", asm_name("Call16_Ret_End") );
fprintf( outfile, "%s:\n", asm_name("Call16_Ret_End") );
function_footer( outfile, "__wine_spec_thunk_data_16" );
}
@ -1208,7 +1210,7 @@ void BuildRelays32( FILE *outfile )
fprintf( outfile, "/* File generated automatically. Do not edit! */\n\n" );
fprintf( outfile, "\t.text\n" );
fprintf( outfile, __ASM_NAME("__wine_spec_thunk_text_32") ":\n\n" );
fprintf( outfile, "%s:\n\n", asm_name("__wine_spec_thunk_text_32") );
/* 32-bit register entry point */
BuildCallFrom32Regs( outfile );

View File

@ -78,14 +78,14 @@ static void declare_weak_function( FILE *outfile, const char *ret_type, const ch
fprintf( outfile, "extern %s %s(%s) __attribute__((weak_import));\n", ret_type, name, params );
fprintf( outfile, "static %s (*__wine_spec_weak_%s)(%s) = %s;\n", ret_type, name, params, name );
fprintf( outfile, "#define %s __wine_spec_weak_%s\n", name, name );
fprintf( outfile, "asm(\".weak_reference " __ASM_NAME("%s") "\");\n", name );
fprintf( outfile, "asm(\".weak_reference %s\");\n", asm_name(name) );
}
else fprintf( outfile, "extern %s %s(%s) __attribute__((weak));\n", ret_type, name, params );
fprintf( outfile, "#else\n" );
fprintf( outfile, "extern %s %s(%s);\n", ret_type, name, params );
fprintf( outfile, "static void __asm__dummy_%s(void)", name );
fprintf( outfile, " { asm(\".weak " __ASM_NAME("%s") "\"); }\n", name );
fprintf( outfile, " { asm(\".weak %s\"); }\n", asm_name(name) );
fprintf( outfile, "#endif\n\n" );
}
@ -190,14 +190,14 @@ static void output_exports( FILE *outfile, DLLSPEC *spec )
fprintf( outfile, "/* export table */\n" );
fprintf( outfile, "asm(\".data\\n\"\n" );
fprintf( outfile, " \"\\t.align %d\\n\"\n", get_alignment(4) );
fprintf( outfile, " \"" __ASM_NAME("__wine_spec_exports") ":\\n\"\n" );
fprintf( outfile, " \"%s:\\n\"\n", asm_name("__wine_spec_exports") );
/* export directory header */
fprintf( outfile, " \"\\t.long 0\\n\"\n" ); /* Characteristics */
fprintf( outfile, " \"\\t.long 0\\n\"\n" ); /* TimeDateStamp */
fprintf( outfile, " \"\\t.long 0\\n\"\n" ); /* MajorVersion/MinorVersion */
fprintf( outfile, " \"\\t.long " __ASM_NAME("__wine_spec_exp_names") "\\n\"\n" ); /* Name */
fprintf( outfile, " \"\\t.long %s\\n\"\n", asm_name("__wine_spec_exp_names") ); /* Name */
fprintf( outfile, " \"\\t.long %d\\n\"\n", spec->base ); /* Base */
fprintf( outfile, " \"\\t.long %d\\n\"\n", nr_exports ); /* NumberOfFunctions */
fprintf( outfile, " \"\\t.long %d\\n\"\n", spec->nb_names ); /* NumberOfNames */
@ -228,7 +228,7 @@ static void output_exports( FILE *outfile, DLLSPEC *spec )
case TYPE_CDECL:
if (!(odp->flags & FLAG_FORWARD))
{
fprintf( outfile, " \"\\t.long " __ASM_NAME("%s") "\\n\"\n", odp->link_name );
fprintf( outfile, " \"\\t.long %s\\n\"\n", asm_name(odp->link_name) );
}
else
{
@ -237,8 +237,8 @@ static void output_exports( FILE *outfile, DLLSPEC *spec )
}
break;
case TYPE_STUB:
fprintf( outfile, " \"\\t.long " __ASM_NAME("%s") "\\n\"\n",
make_internal_name( odp, spec, "stub" ) );
fprintf( outfile, " \"\\t.long %s\\n\"\n",
asm_name( make_internal_name( odp, spec, "stub" )) );
break;
default:
assert(0);
@ -254,7 +254,7 @@ static void output_exports( FILE *outfile, DLLSPEC *spec )
fprintf( outfile, " \"__wine_spec_exp_name_ptrs:\\n\"\n" );
for (i = 0; i < spec->nb_names; i++)
{
fprintf( outfile, " \"\\t.long " __ASM_NAME("__wine_spec_exp_names") "+%d\\n\"\n", namepos );
fprintf( outfile, " \"\\t.long %s+%d\\n\"\n", asm_name("__wine_spec_exp_names"), namepos );
namepos += strlen(spec->names[i]->name) + 1;
}
}
@ -317,15 +317,15 @@ static void output_exports( FILE *outfile, DLLSPEC *spec )
switch(odp->type)
{
case TYPE_STDCALL:
fprintf( outfile, " \"\\tjmp " __ASM_NAME("%s") "\\n\"\n", odp->link_name );
fprintf( outfile, " \"\\tjmp %s\\n\"\n", asm_name(odp->link_name) );
fprintf( outfile, " \"\\tret $%d\\n\"\n", args );
fprintf( outfile, " \"\\t.long " __ASM_NAME("%s") ",0x%08x\\n\"\n", odp->link_name, mask );
fprintf( outfile, " \"\\t.long %s,0x%08x\\n\"\n", asm_name(odp->link_name), mask );
break;
case TYPE_CDECL:
fprintf( outfile, " \"\\tjmp " __ASM_NAME("%s") "\\n\"\n", odp->link_name );
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.long " __ASM_NAME("%s") ",0x%08x\\n\"\n", odp->link_name, mask );
fprintf( outfile, " \"\\t.long %s,0x%08x\\n\"\n", asm_name(odp->link_name), mask );
break;
default:
assert(0);
@ -409,14 +409,14 @@ void output_dll_init( FILE *outfile, const char *constructor, const char *destru
{
fprintf( outfile, "asm(\"\\t.mod_init_func\\n\"\n" );
fprintf( outfile, " \"\\t.align 2\\n\"\n" );
fprintf( outfile, " \"\\t.long " __ASM_NAME("%s") "\\n\"\n", constructor );
fprintf( outfile, " \"\\t.long %s\\n\"\n", asm_name(constructor) );
fprintf( outfile, " \"\\t.text\\n\");\n" );
}
if (destructor)
{
fprintf( outfile, "asm(\"\\t.mod_term_func\\n\"\n" );
fprintf( outfile, " \"\\t.align 2\\n\"\n" );
fprintf( outfile, " \"\\t.long " __ASM_NAME("%s") "\\n\"\n", destructor );
fprintf( outfile, " \"\\t.long %s\\n\"\n", asm_name(destructor) );
fprintf( outfile, " \"\\t.text\\n\");\n" );
}
}
@ -426,13 +426,13 @@ void output_dll_init( FILE *outfile, const char *constructor, const char *destru
if (constructor)
{
fprintf( outfile, "asm(\"\\t.section\\t\\\".init\\\" ,\\\"ax\\\"\\n\"\n" );
fprintf( outfile, " \"\\tcall " __ASM_NAME("%s") "\\n\"\n", constructor );
fprintf( outfile, " \"\\tcall %s\\n\"\n", asm_name(constructor) );
fprintf( outfile, " \"\\t.section\\t\\\".text\\\"\\n\");\n" );
}
if (destructor)
{
fprintf( outfile, "asm(\"\\t.section\\t\\\".fini\\\" ,\\\"ax\\\"\\n\"\n" );
fprintf( outfile, " \"\\tcall " __ASM_NAME("%s") "\\n\"\n", destructor );
fprintf( outfile, " \"\\tcall %s\\n\"\n", asm_name(destructor) );
fprintf( outfile, " \"\\t.section\\t\\\".text\\\"\\n\");\n" );
}
break;
@ -440,14 +440,14 @@ void output_dll_init( FILE *outfile, const char *constructor, const char *destru
if (constructor)
{
fprintf( outfile, "asm(\"\\t.section\\t\\\".init\\\" ,\\\"ax\\\"\\n\"\n" );
fprintf( outfile, " \"\\tcall " __ASM_NAME("%s") "\\n\"\n", constructor );
fprintf( outfile, " \"\\tcall %s\\n\"\n", asm_name(constructor) );
fprintf( outfile, " \"\\tnop\\n\"\n" );
fprintf( outfile, " \"\\t.section\\t\\\".text\\\"\\n\");\n" );
}
if (destructor)
{
fprintf( outfile, "asm(\"\\t.section\\t\\\".fini\\\" ,\\\"ax\\\"\\n\"\n" );
fprintf( outfile, " \"\\tcall " __ASM_NAME("%s") "\\n\"\n", destructor );
fprintf( outfile, " \"\\tcall %s\\n\"\n", asm_name(destructor) );
fprintf( outfile, " \"\\tnop\\n\"\n" );
fprintf( outfile, " \"\\t.section\\t\\\".text\\\"\\n\");\n" );
}
@ -456,13 +456,13 @@ void output_dll_init( FILE *outfile, const char *constructor, const char *destru
if (constructor)
{
fprintf( outfile, "asm(\"\\t.section\\t\\\".init\\\" ,\\\"ax\\\"\\n\"\n" );
fprintf( outfile, " \"\\tjsr $26," __ASM_NAME("%s") "\\n\"\n", constructor );
fprintf( outfile, " \"\\tjsr $26,%s\\n\"\n", asm_name(constructor) );
fprintf( outfile, " \"\\t.section\\t\\\".text\\\"\\n\");\n" );
}
if (destructor)
{
fprintf( outfile, "asm(\"\\t.section\\t\\\".fini\\\" ,\\\"ax\\\"\\n\"\n" );
fprintf( outfile, " \"\\tjsr $26," __ASM_NAME("%s") "\\n\"\n", destructor );
fprintf( outfile, " \"\\tjsr $26,%s\\n\"\n", asm_name(destructor) );
fprintf( outfile, " \"\\t.section\\t\\\".text\\\"\\n\");\n" );
}
break;
@ -470,13 +470,13 @@ void output_dll_init( FILE *outfile, const char *constructor, const char *destru
if (constructor)
{
fprintf( outfile, "asm(\"\\t.section\\t\\\".init\\\" ,\\\"ax\\\"\\n\"\n" );
fprintf( outfile, " \"\\tbl " __ASM_NAME("%s") "\\n\"\n", constructor );
fprintf( outfile, " \"\\tbl %s\\n\"\n", asm_name(constructor) );
fprintf( outfile, " \"\\t.section\\t\\\".text\\\"\\n\");\n" );
}
if (destructor)
{
fprintf( outfile, "asm(\"\\t.section\\t\\\".fini\\\" ,\\\"ax\\\"\\n\"\n" );
fprintf( outfile, " \"\\tbl " __ASM_NAME("%s") "\\n\"\n", destructor );
fprintf( outfile, " \"\\tbl %s\\n\"\n", asm_name(destructor) );
fprintf( outfile, " \"\\t.section\\t\\\".text\\\"\\n\");\n" );
}
break;
@ -509,14 +509,14 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec )
fprintf( outfile, "#endif\n" );
fprintf( outfile, "asm(\".text\\n\\t\"\n" );
fprintf( outfile, " \".align %d\\n\"\n", get_alignment(page_size) );
fprintf( outfile, " \"" __ASM_NAME("__wine_spec_pe_header") ":\\t\"\n" );
fprintf( outfile, " \"%s:\\t\"\n", asm_name("__wine_spec_pe_header") );
if (target_platform == PLATFORM_APPLE)
fprintf( outfile, " \".space 65536\\n\\t\"\n" );
else
fprintf( outfile, " \".skip 65536\\n\\t\"\n" );
fprintf( outfile, " \".data\\n\\t\"\n" );
fprintf( outfile, " \".align %d\\n\"\n", get_alignment(4) );
fprintf( outfile, " \"" __ASM_NAME("__wine_spec_data_start") ":\\t.long 1\");\n" );
fprintf( outfile, " \"%s:\\t.long 1\");\n", asm_name("__wine_spec_data_start") );
fprintf( outfile, "#ifndef __GNUC__\n" );
fprintf( outfile, "}\n" );
fprintf( outfile, "#endif\n" );

View File

@ -380,11 +380,11 @@ unsigned int get_page_size(void)
return 0;
}
/* return the assembly name for a C function name */
const char *func_name( const char *func )
/* return the assembly name for a C symbol */
const char *asm_name( const char *sym )
{
static char buffer[256];
sprintf( buffer, __ASM_NAME("%s"), func );
sprintf( buffer, __ASM_NAME("%s"), sym );
return buffer;
}