Replace all uses of PREFIX and @function by the __ASM_NAME and

__ASM_FUNC macros.
This commit is contained in:
Alexandre Julliard 2002-07-22 20:47:11 +00:00
parent 15fc23693f
commit 65c6d38581
9 changed files with 149 additions and 202 deletions

View File

@ -148,7 +148,7 @@ __ASM_GLOBAL_FUNC(vm86_enter,
"pushl %fs\n\t"
"int $0x80\n"
".globl " __ASM_NAME("vm86_return") "\n\t"
".type " __ASM_NAME("vm86_return") ",@function\n"
__ASM_FUNC("vm86_return") "\n"
__ASM_NAME("vm86_return") ":\n\t"
"popl %fs\n\t"
"popl %ecx\n\t"
@ -162,7 +162,7 @@ __ASM_GLOBAL_FUNC(vm86_enter,
"movl 4(%esp),%ecx\n\t" /* vm86_ptr */
"movl $0,(%ecx)\n\t"
".globl " __ASM_NAME("vm86_return_end") "\n\t"
".type " __ASM_NAME("vm86_return_end") ",@function\n"
__ASM_FUNC("vm86_return_end") "\n"
__ASM_NAME("vm86_return_end") ":\n\t"
"ret" );

View File

@ -50,12 +50,6 @@ extern const char **debug_snoop_includelist;
extern void WINAPI SNOOP_Entry();
extern void WINAPI SNOOP_Return();
#ifdef NEED_UNDERSCORE_PREFIX
# define PREFIX "_"
#else
# define PREFIX
#endif
#include "pshpack1.h"
typedef struct tagSNOOP_FUN {

View File

@ -53,13 +53,7 @@ void PTHREAD_init_done(void)
#include <pthread.h>
#include <signal.h>
#ifdef NEED_UNDERSCORE_PREFIX
# define PREFIX "_"
#else
# define PREFIX
#endif
#define PSTR(str) PREFIX #str
#define PSTR(str) __ASM_NAME(#str)
/* adapt as necessary (a construct like this is used in glibc sources) */
#define strong_alias(orig, alias) \
@ -70,11 +64,7 @@ void PTHREAD_init_done(void)
* so for those, we need to use the pogo stick */
#if defined(__i386__) && !defined(__PIC__)
/* FIXME: PIC */
#define jump_alias(orig, alias) \
asm(".globl " PSTR(alias) "\n" \
"\t.type " PSTR(alias) ",@function\n" \
PSTR(alias) ":\n" \
"\tjmp " PSTR(orig))
#define jump_alias(orig, alias) __ASM_GLOBAL_FUNC( alias, "jmp " PSTR(orig))
#endif
/* get necessary libc symbols */

View File

@ -31,12 +31,6 @@
#include <stdlib.h>
#include <string.h>
#ifdef NEED_UNDERSCORE_PREFIX
# define PREFIX "_"
#else
# define PREFIX
#endif
#ifdef HAVE_ASM_STRING
# define STRING ".string"
#else

View File

@ -470,13 +470,9 @@ static int output_immediate_imports( FILE *outfile )
{
fprintf( outfile, " \"\\t" __ASM_FUNC("%s") "\\n\"\n",
dll_imports[i]->imports[j] );
fprintf( outfile, " \"\\t.globl " PREFIX "%s\\n\"\n",
fprintf( outfile, " \"\\t.globl " __ASM_NAME("%s") "\\n\"\n",
dll_imports[i]->imports[j] );
fprintf( outfile, " \"" PREFIX "%s:\\n\\t", dll_imports[i]->imports[j] );
fprintf( outfile, " \"" __ASM_NAME("%s") ":\\n\\t", dll_imports[i]->imports[j] );
#if defined(__i386__)
if (strstr( dll_imports[i]->imports[j], "__wine_call_from_16" ))
@ -651,7 +647,7 @@ static int output_delayed_imports( FILE *outfile )
fprintf( outfile, "asm(\".align %d\\n\"\n", get_alignment(8) );
fprintf( outfile, " \"\\t" __ASM_FUNC("__wine_delay_load_asm") "\\n\"\n" );
fprintf( outfile, " \"" PREFIX "__wine_delay_load_asm:\\n\"\n" );
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" );
@ -675,7 +671,7 @@ static int output_delayed_imports( FILE *outfile )
char buffer[128];
sprintf( buffer, "__wine_delay_imp_%d_%s", i, dll_imports[i]->imports[j]);
fprintf( outfile, " \"\\t" __ASM_FUNC("%s") "\\n\"\n", buffer );
fprintf( outfile, " \"" PREFIX "%s:\\n\"\n", buffer );
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" );
@ -700,9 +696,9 @@ static int output_delayed_imports( FILE *outfile )
{
fprintf( outfile, " \"\\t" __ASM_FUNC("%s") "\\n\"\n",
dll_imports[i]->imports[j] );
fprintf( outfile, " \"\\t.globl " PREFIX "%s\\n\"\n",
fprintf( outfile, " \"\\t.globl " __ASM_NAME("%s") "\\n\"\n",
dll_imports[i]->imports[j] );
fprintf( outfile, " \"" PREFIX "%s:\\n\\t", dll_imports[i]->imports[j] );
fprintf( outfile, " \"" __ASM_NAME("%s") ":\\n\\t", dll_imports[i]->imports[j] );
#if defined(__i386__)
if (strstr( dll_imports[i]->imports[j], "__wine_call_from_16" ))
fprintf( outfile, ".byte 0x2e\\n\\tjmp *(delay_imports+%d)\\n\\tnop\\n", pos );

View File

@ -43,14 +43,11 @@ static const int use_stabs = 0;
static void function_header( FILE *outfile, const char *name )
{
fprintf( outfile, "\n\t.align %d\n", get_alignment(4) );
if (use_stabs) fprintf( outfile, "\t.stabs \"%s:F1\",36,0,0," PREFIX "%s\n", name, name);
#ifdef NEED_TYPE_IN_DEF
fprintf( outfile, "\t.def " PREFIX "%s; .scl 2; .type 32; .endef\n", name );
#else
fprintf( outfile, "\t.type " PREFIX "%s,@function\n", name );
#endif
fprintf( outfile, "\t.globl " PREFIX "%s\n", name );
fprintf( outfile, PREFIX "%s:\n", name );
if (use_stabs)
fprintf( outfile, "\t.stabs \"%s:F1\",36,0,0," __ASM_NAME("%s") "\n", name, name);
fprintf( outfile, "\t" __ASM_FUNC("%s") "\n", name );
fprintf( outfile, "\t.globl " __ASM_NAME("%s") "\n", name );
fprintf( outfile, __ASM_NAME("%s") ":\n", name );
}
@ -154,11 +151,11 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk, int sho
if (UsePIC)
{
fprintf( outfile, "\t.byte 0x2e\n\tmovl " PREFIX "CallTo16_DataSelector@GOT(%%ecx), %%edx\n" );
fprintf( outfile, "\t.byte 0x2e\n\tmovl " __ASM_NAME("CallTo16_DataSelector@GOT") "(%%ecx), %%edx\n" );
fprintf( outfile, "\t.byte 0x2e\n\tmovl (%%edx), %%edx\n" );
}
else
fprintf( outfile, "\t.byte 0x2e\n\tmovl " PREFIX "CallTo16_DataSelector,%%edx\n" );
fprintf( outfile, "\t.byte 0x2e\n\tmovl " __ASM_NAME("CallTo16_DataSelector") ",%%edx\n" );
/* Load 32-bit segment registers */
#ifdef __svr4__
@ -172,17 +169,17 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk, int sho
if ( UsePIC )
{
fprintf( outfile, "\tmovl " PREFIX "SYSLEVEL_Win16CurrentTeb@GOT(%%ecx), %%edx\n" );
fprintf( outfile, "\tmovl " __ASM_NAME("SYSLEVEL_Win16CurrentTeb@GOT") "(%%ecx), %%edx\n" );
fprintf( outfile, "\tmovw (%%edx), %%fs\n" );
}
else
fprintf( outfile, "\tmovw " PREFIX "SYSLEVEL_Win16CurrentTeb, %%fs\n" );
fprintf( outfile, "\tmovw " __ASM_NAME("SYSLEVEL_Win16CurrentTeb") ", %%fs\n" );
/* Get address of wine_ldt_copy array into %ecx */
if ( UsePIC )
fprintf( outfile, "\tmovl " PREFIX "wine_ldt_copy@GOT(%%ecx), %%ecx\n" );
fprintf( outfile, "\tmovl " __ASM_NAME("wine_ldt_copy@GOT") "(%%ecx), %%ecx\n" );
else
fprintf( outfile, "\tmovl $" PREFIX "wine_ldt_copy, %%ecx\n" );
fprintf( outfile, "\tmovl $" __ASM_NAME("wine_ldt_copy") ", %%ecx\n" );
/* Translate STACK16FRAME base to flat offset in %edx */
fprintf( outfile, "\tmovw %%ss, %%dx\n" );
@ -325,9 +322,9 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk, int sho
fprintf( outfile, "\tpushl $0\n" );
if ( UsePIC )
fprintf( outfile, "\tcall " PREFIX "RELAY_DebugCallFrom16@PLT\n ");
fprintf( outfile, "\tcall " __ASM_NAME("RELAY_DebugCallFrom16@PLT") "\n ");
else
fprintf( outfile, "\tcall " PREFIX "RELAY_DebugCallFrom16\n ");
fprintf( outfile, "\tcall " __ASM_NAME("RELAY_DebugCallFrom16") "\n ");
fprintf( outfile, "\tpopl %%edx\n" );
fprintf( outfile, "\tpopl %%edx\n" );
@ -364,9 +361,9 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk, int sho
fprintf( outfile, "\tpushl $0\n" );
if ( UsePIC )
fprintf( outfile, "\tcall " PREFIX "RELAY_DebugCallFrom16Ret@PLT\n ");
fprintf( outfile, "\tcall " __ASM_NAME("RELAY_DebugCallFrom16Ret@PLT") "\n ");
else
fprintf( outfile, "\tcall " PREFIX "RELAY_DebugCallFrom16Ret\n ");
fprintf( outfile, "\tcall " __ASM_NAME("RELAY_DebugCallFrom16Ret") "\n ");
fprintf( outfile, "\tpopl %%eax\n" );
fprintf( outfile, "\tpopl %%eax\n" );
@ -506,9 +503,9 @@ static void BuildCallTo16Core( FILE *outfile, int short_ret, int reg_func )
/* Enter Win16 Mutex */
if ( UsePIC )
fprintf( outfile, "\tcall " PREFIX "_EnterWin16Lock@PLT\n" );
fprintf( outfile, "\tcall " __ASM_NAME("_EnterWin16Lock@PLT") "\n" );
else
fprintf( outfile, "\tcall " PREFIX "_EnterWin16Lock\n" );
fprintf( outfile, "\tcall " __ASM_NAME("_EnterWin16Lock") "\n" );
/* Print debugging info */
if (debugging)
@ -519,9 +516,9 @@ static void BuildCallTo16Core( FILE *outfile, int short_ret, int reg_func )
fprintf( outfile, "\tpushl 8(%%ebp)\n" );
if ( UsePIC )
fprintf( outfile, "\tcall " PREFIX "RELAY_DebugCallTo16@PLT\n" );
fprintf( outfile, "\tcall " __ASM_NAME("RELAY_DebugCallTo16@PLT") "\n" );
else
fprintf( outfile, "\tcall " PREFIX "RELAY_DebugCallTo16\n" );
fprintf( outfile, "\tcall " __ASM_NAME("RELAY_DebugCallTo16") "\n" );
fprintf( outfile, "\taddl $12, %%esp\n" );
}
@ -529,11 +526,11 @@ static void BuildCallTo16Core( FILE *outfile, int short_ret, int reg_func )
/* Get return address */
if ( UsePIC )
{
fprintf( outfile, "\tmovl " PREFIX "CallTo16_RetAddr@GOT(%%ebx), %%ecx\n" );
fprintf( outfile, "\tmovl " PREFIX "(%%ecx), %%ecx\n" );
fprintf( outfile, "\tmovl " __ASM_NAME("CallTo16_RetAddr@GOT") "(%%ebx), %%ecx\n" );
fprintf( outfile, "\tmovl (%%ecx), %%ecx\n" );
}
else
fprintf( outfile, "\tmovl " PREFIX "CallTo16_RetAddr, %%ecx\n" );
fprintf( outfile, "\tmovl " __ASM_NAME("CallTo16_RetAddr") ", %%ecx\n" );
/* Call the actual CallTo16 routine (simulate a lcall) */
fprintf( outfile, "\tpushl %%cs\n" );
@ -593,18 +590,18 @@ static void BuildCallTo16Core( FILE *outfile, int short_ret, int reg_func )
fprintf( outfile, "\tpushl $%d\n", reg_func );
if ( UsePIC )
fprintf( outfile, "\tcall " PREFIX "RELAY_DebugCallTo16Ret@PLT\n" );
fprintf( outfile, "\tcall " __ASM_NAME("RELAY_DebugCallTo16Ret@PLT") "\n" );
else
fprintf( outfile, "\tcall " PREFIX "RELAY_DebugCallTo16Ret\n" );
fprintf( outfile, "\tcall " __ASM_NAME("RELAY_DebugCallTo16Ret") "\n" );
fprintf( outfile, "\taddl $4, %%esp\n" );
}
/* Leave Win16 Mutex */
if ( UsePIC )
fprintf( outfile, "\tcall " PREFIX "_LeaveWin16Lock@PLT\n" );
fprintf( outfile, "\tcall " __ASM_NAME("_LeaveWin16Lock@PLT") "\n" );
else
fprintf( outfile, "\tcall " PREFIX "_LeaveWin16Lock\n" );
fprintf( outfile, "\tcall " __ASM_NAME("_LeaveWin16Lock") "\n" );
/* Get return value */
fprintf( outfile, "\tpopl %%eax\n" );
@ -723,7 +720,7 @@ static void BuildRet16Func( FILE *outfile )
/* Restore 32-bit segment registers */
fprintf( outfile, "\t.byte 0x2e\n\tmovl " PREFIX "CallTo16_DataSelector-" PREFIX "Call16_Ret_Start,%%edi\n" );
fprintf( outfile, "\t.byte 0x2e\n\tmovl " __ASM_NAME("CallTo16_DataSelector") "-" __ASM_NAME("Call16_Ret_Start") ",%%edi\n" );
#ifdef __svr4__
fprintf( outfile, "\tdata16\n");
#endif
@ -733,7 +730,7 @@ static void BuildRet16Func( FILE *outfile )
#endif
fprintf( outfile, "\tmovw %%di,%%es\n" );
fprintf( outfile, "\tmovw " PREFIX "SYSLEVEL_Win16CurrentTeb,%%fs\n" );
fprintf( outfile, "\tmovw " __ASM_NAME("SYSLEVEL_Win16CurrentTeb") ",%%fs\n" );
/* Restore the 32-bit stack */
@ -751,10 +748,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 " PREFIX "CallTo16_DataSelector\n" );
fprintf( outfile, PREFIX "CallTo16_DataSelector:\t.long 0\n" );
fprintf( outfile, "\t.globl " PREFIX "CallTo16_RetAddr\n" );
fprintf( outfile, PREFIX "CallTo16_RetAddr:\t.long 0\n" );
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_RetAddr") "\n" );
fprintf( outfile, __ASM_NAME("CallTo16_RetAddr") ":\t.long 0\n" );
}
@ -857,9 +854,10 @@ static void BuildCallTo32CBClient( FILE *outfile, BOOL isEx )
fprintf( outfile, "\n\t.align %d\n", get_alignment(4) );
if (use_stabs)
fprintf( outfile, ".stabs \"CALL32_%s:F1\",36,0,0," PREFIX "CALL32_%s\n", name, name );
fprintf( outfile, "\t.globl " PREFIX "CALL32_%s\n", name );
fprintf( outfile, PREFIX "CALL32_%s:\n", name );
fprintf( outfile, ".stabs \"CALL32_%s:F1\",36,0,0," __ASM_NAME("CALL32_%s") "\n",
name, name );
fprintf( outfile, "\t.globl " __ASM_NAME("CALL32_%s") "\n", name );
fprintf( outfile, __ASM_NAME("CALL32_%s") ":\n", name );
/* Entry code */
@ -878,7 +876,7 @@ static void BuildCallTo32CBClient( FILE *outfile, BOOL isEx )
fprintf( outfile, "\tshldl $16,%%ebx,%%eax\n" );
fprintf( outfile, "\tandl $0xfff8,%%eax\n" );
fprintf( outfile, "\tshrl $1,%%eax\n" );
fprintf( outfile, "\tmovl " PREFIX "wine_ldt_copy(%%eax),%%esi\n" );
fprintf( outfile, "\tmovl " __ASM_NAME("wine_ldt_copy") "(%%eax),%%esi\n" );
fprintf( outfile, "\tmovw %%bx,%%ax\n" );
fprintf( outfile, "\taddl %%eax,%%esi\n" );
@ -911,7 +909,7 @@ static void BuildCallTo32CBClient( FILE *outfile, BOOL isEx )
fprintf( outfile, "\taddl $%d, %%ebx\n", sizeof(STACK16FRAME)-size+4 + 4 );
fprintf( outfile, "\tmovl %%ebx, 0(%%edi)\n" ); /* 16-bit ss:sp */
fprintf( outfile, "\tmovl " PREFIX "CALL32_%s_RetAddr, %%eax\n", name );
fprintf( outfile, "\tmovl " __ASM_NAME("CALL32_%s_RetAddr") ", %%eax\n", name );
fprintf( outfile, "\tmovl %%eax, 4(%%edi)\n" ); /* overwrite return address */
}
else
@ -932,7 +930,7 @@ static void BuildCallTo32CBClient( FILE *outfile, BOOL isEx )
fprintf( outfile, "\tandl $0x0000ffff, %%eax\n" );
fprintf( outfile, "\tmovl %%eax, 16(%%edi)\n" );
fprintf( outfile, "\tmovl " PREFIX "CALL32_%s_RetAddr, %%eax\n", name );
fprintf( outfile, "\tmovl " __ASM_NAME("CALL32_%s_RetAddr") ", %%eax\n", name );
fprintf( outfile, "\tmovl %%eax, 20(%%edi)\n" );
}
@ -989,8 +987,8 @@ static void BuildCallTo32CBClientRet( FILE *outfile, BOOL isEx )
/* '16-bit' return stub */
fprintf( outfile, "\n\t.globl " PREFIX "CALL32_%s_Ret\n", name );
fprintf( outfile, PREFIX "CALL32_%s_Ret:\n", name );
fprintf( outfile, "\n\t.globl " __ASM_NAME("CALL32_%s_Ret") "\n", name );
fprintf( outfile, __ASM_NAME("CALL32_%s_Ret") ":\n", name );
if ( !isEx )
{
@ -1008,8 +1006,8 @@ static void BuildCallTo32CBClientRet( FILE *outfile, BOOL isEx )
/* Declare the return address variable */
fprintf( outfile, "\n\t.globl " PREFIX "CALL32_%s_RetAddr\n", name );
fprintf( outfile, PREFIX "CALL32_%s_RetAddr:\t.long 0\n", name );
fprintf( outfile, "\n\t.globl " __ASM_NAME("CALL32_%s_RetAddr") "\n", name );
fprintf( outfile, __ASM_NAME("CALL32_%s_RetAddr") ":\t.long 0\n", name );
}
@ -1172,8 +1170,8 @@ void BuildRelays16( FILE *outfile )
fprintf( outfile, "Code_Start:\n\n" );
}
fprintf( outfile, PREFIX"Call16_Start:\n" );
fprintf( outfile, "\t.globl "PREFIX"Call16_Start\n" );
fprintf( outfile, __ASM_NAME("Call16_Start") ":\n" );
fprintf( outfile, "\t.globl " __ASM_NAME("Call16_Start") "\n" );
fprintf( outfile, "\t.byte 0\n\n" );
/* Standard CallFrom16 routine (WORD return) */
@ -1206,8 +1204,8 @@ void BuildRelays16( FILE *outfile )
/* CBClientThunkSLEx routine */
BuildCallTo32CBClient( outfile, TRUE );
fprintf( outfile, PREFIX"Call16_End:\n" );
fprintf( outfile, "\t.globl "PREFIX"Call16_End\n" );
fprintf( outfile, __ASM_NAME("Call16_End") ":\n" );
fprintf( outfile, "\t.globl " __ASM_NAME("Call16_End") "\n" );
if (use_stabs)
{
@ -1226,8 +1224,8 @@ void BuildRelays16( FILE *outfile )
/* The whole Call16_Ret segment must lie within the .data section */
fprintf( outfile, "\n\t.data\n" );
fprintf( outfile, "\t.globl " PREFIX "Call16_Ret_Start\n" );
fprintf( outfile, PREFIX "Call16_Ret_Start:\n" );
fprintf( outfile, "\t.globl " __ASM_NAME("Call16_Ret_Start") "\n" );
fprintf( outfile, __ASM_NAME("Call16_Ret_Start") ":\n" );
/* Standard CallTo16 return stub */
BuildRet16Func( outfile );
@ -1239,8 +1237,8 @@ void BuildRelays16( FILE *outfile )
BuildCallTo32CBClientRet( outfile, TRUE );
/* End of Call16_Ret segment */
fprintf( outfile, "\n\t.globl " PREFIX "Call16_Ret_End\n" );
fprintf( outfile, PREFIX "Call16_Ret_End:\n" );
fprintf( outfile, "\n\t.globl " __ASM_NAME("Call16_Ret_End") "\n" );
fprintf( outfile, __ASM_NAME("Call16_Ret_End") ":\n" );
}
/*******************************************************************
@ -1293,4 +1291,3 @@ void BuildRelays32( FILE *outfile )
}
#endif /* __i386__ */

View File

@ -134,14 +134,14 @@ static int output_exports( FILE *outfile, int nr_exports )
fprintf( outfile, "asm(\".data\\n\"\n" );
fprintf( outfile, " \"\\t.align %d\\n\"\n", get_alignment(4) );
fprintf( outfile, " \"" PREFIX "__wine_spec_exports:\\n\"\n" );
fprintf( outfile, " \"" __ASM_NAME("__wine_spec_exports") ":\\n\"\n" );
/* 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 " PREFIX "dllname\\n\"\n" ); /* Name */
fprintf( outfile, " \"\\t.long " __ASM_NAME("dllname") "\\n\"\n" ); /* Name */
fprintf( outfile, " \"\\t.long %d\\n\"\n", Base ); /* Base */
fprintf( outfile, " \"\\t.long %d\\n\"\n", nr_exports ); /* NumberOfFunctions */
fprintf( outfile, " \"\\t.long %d\\n\"\n", nb_names ); /* NumberOfNames */
@ -168,19 +168,19 @@ static int output_exports( FILE *outfile, int nr_exports )
else switch(odp->type)
{
case TYPE_EXTERN:
fprintf( outfile, " \"\\t.long " PREFIX "%s\\n\"\n", odp->link_name );
fprintf( outfile, " \"\\t.long " __ASM_NAME("%s") "\\n\"\n", odp->link_name );
break;
case TYPE_STDCALL:
case TYPE_VARARGS:
case TYPE_CDECL:
fprintf( outfile, " \"\\t.long " PREFIX "%s\\n\"\n",
fprintf( outfile, " \"\\t.long " __ASM_NAME("%s") "\\n\"\n",
(odp->flags & FLAG_REGISTER) ? make_internal_name(odp,"regs") : odp->link_name );
break;
case TYPE_STUB:
fprintf( outfile, " \"\\t.long " PREFIX "%s\\n\"\n", make_internal_name( odp, "stub" ) );
fprintf( outfile, " \"\\t.long " __ASM_NAME("%s") "\\n\"\n", make_internal_name( odp, "stub" ) );
break;
case TYPE_VARIABLE:
fprintf( outfile, " \"\\t.long " PREFIX "%s\\n\"\n", make_internal_name( odp, "var" ) );
fprintf( outfile, " \"\\t.long " __ASM_NAME("%s") "\\n\"\n", make_internal_name( odp, "var" ) );
break;
case TYPE_FORWARD:
fprintf( outfile, " \"\\t.long __wine_spec_forwards+%d\\n\"\n", fwd_size );
@ -279,15 +279,15 @@ static int output_exports( FILE *outfile, int nr_exports )
switch(odp->type)
{
case TYPE_STDCALL:
fprintf( outfile, " \"\\tjmp " PREFIX "%s\\n\"\n", name );
fprintf( outfile, " \"\\tjmp " __ASM_NAME("%s") "\\n\"\n", name );
fprintf( outfile, " \"\\tret $0x%04x\\n\"\n", args );
fprintf( outfile, " \"\\t.long " PREFIX "%s,0x%08x\\n\"\n", name, mask );
fprintf( outfile, " \"\\t.long " __ASM_NAME("%s") ",0x%08x\\n\"\n", name, mask );
break;
case TYPE_CDECL:
fprintf( outfile, " \"\\tjmp " PREFIX "%s\\n\"\n", name );
fprintf( outfile, " \"\\tjmp " __ASM_NAME("%s") "\\n\"\n", name );
fprintf( outfile, " \"\\tret\\n\"\n" );
fprintf( outfile, " \"\\t.short 0x%04x\\n\"\n", args );
fprintf( outfile, " \"\\t.long " PREFIX "%s,0x%08x\\n\"\n", name, mask );
fprintf( outfile, " \"\\t.long " __ASM_NAME("%s") ",0x%08x\\n\"\n", name, mask );
break;
default:
assert(0);
@ -309,9 +309,9 @@ static int output_exports( FILE *outfile, int nr_exports )
for (p = Names[i]->name; *p; p++)
if (!isalnum(*p) && *p != '_' && *p != '.') break;
if (*p) continue;
fprintf( outfile, " \"\\t.globl " PREFIX "__wine_dllexport_%s_%s\\n\"\n",
fprintf( outfile, " \"\\t.globl " __ASM_NAME("__wine_dllexport_%s_%s") "\\n\"\n",
make_c_identifier(DLLFileName), Names[i]->name );
fprintf( outfile, " \"" PREFIX "__wine_dllexport_%s_%s:\\n\"\n",
fprintf( outfile, " \"" __ASM_NAME("__wine_dllexport_%s_%s") ":\\n\"\n",
make_c_identifier(DLLFileName), Names[i]->name );
}
fprintf( outfile, " \"\\t.long 0xffffffff\\n\"\n" );
@ -415,9 +415,9 @@ static void output_register_funcs( FILE *outfile )
fprintf( outfile,
"asm(\".align %d\\n\\t\"\n"
" \"" __ASM_FUNC("%s") "\\n\\t\"\n"
" \"" PREFIX "%s:\\n\\t\"\n"
" \"call " PREFIX "__wine_call_from_32_regs\\n\\t\"\n"
" \".long " PREFIX "%s\\n\\t\"\n"
" \"" __ASM_NAME("%s") ":\\n\\t\"\n"
" \"call " __ASM_NAME("__wine_call_from_32_regs") "\\n\\t\"\n"
" \".long " __ASM_NAME("%s") "\\n\\t\"\n"
" \".byte %d,%d\");\n",
get_alignment(4),
name, name, odp->link_name,
@ -442,27 +442,27 @@ 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 " PREFIX "%s\\n\"\n", constructor );
fprintf( outfile, " \"\\tcall " __ASM_NAME("%s") "\\n\"\n", constructor );
fprintf( outfile, " \"\\t.section\\t\\\".text\\\"\\n\");\n" );
}
if (destructor)
{
fprintf( outfile, "asm(\"\\t.section\\t\\\".fini\\\" ,\\\"ax\\\"\\n\"\n" );
fprintf( outfile, " \"\\tcall " PREFIX "%s\\n\"\n", destructor );
fprintf( outfile, " \"\\tcall " __ASM_NAME("%s") "\\n\"\n", destructor );
fprintf( outfile, " \"\\t.section\\t\\\".text\\\"\\n\");\n" );
}
#elif defined(__sparc__)
if (constructor)
{
fprintf( outfile, "asm(\"\\t.section\\t\\\".init\\\" ,\\\"ax\\\"\\n\"\n" );
fprintf( outfile, " \"\\tcall " PREFIX "%s\\n\"\n", constructor );
fprintf( outfile, " \"\\tcall " __ASM_NAME("%s") "\\n\"\n", 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 " PREFIX "%s\\n\"\n", destructor );
fprintf( outfile, " \"\\tcall " __ASM_NAME("%s") "\\n\"\n", destructor );
fprintf( outfile, " \"\\tnop\\n\"\n" );
fprintf( outfile, " \"\\t.section\\t\\\".text\\\"\\n\");\n" );
}
@ -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 " PREFIX "%s\\n\"\n", constructor );
fprintf( outfile, " \"\\tbl " __ASM_NAME("%s") "\\n\"\n", constructor );
fprintf( outfile, " \"\\t.section\\t\\\".text\\\"\\n\");\n" );
}
if (destructor)
{
fprintf( outfile, "asm(\"\\t.section\\t\\\".fini\\\" ,\\\"ax\\\"\\n\"\n" );
fprintf( outfile, " \"\\tbl " PREFIX "%s\\n\"\n", destructor );
fprintf( outfile, " \"\\tbl " __ASM_NAME("%s") "\\n\"\n", destructor );
fprintf( outfile, " \"\\t.section\\t\\\".text\\\"\\n\");\n" );
}
#else
@ -529,7 +529,7 @@ void BuildSpec32File( FILE *outfile )
fprintf( outfile, "#endif\n" );
fprintf( outfile, "asm(\".section \\\".text\\\"\\n\\t\"\n" );
fprintf( outfile, " \".align %d\\n\"\n", get_alignment(page_size) );
fprintf( outfile, " \"" PREFIX "pe_header:\\t.skip %ld\\n\\t\");\n", page_size );
fprintf( outfile, " \"" __ASM_NAME("pe_header") ":\\t.skip %ld\\n\\t\");\n", page_size );
fprintf( outfile, "#ifndef __GNUC__\n" );
fprintf( outfile, "}\n" );
fprintf( outfile, "#endif\n" );
@ -900,23 +900,23 @@ void BuildDebugFile( FILE *outfile )
#if defined(__i386__)
fprintf( outfile, "asm(\"\\t.section\\t\\\".init\\\" ,\\\"ax\\\"\\n\"\n" );
fprintf( outfile, " \"\\tcall " PREFIX "__wine_dbg_%s_init\\n\"\n", prefix );
fprintf( outfile, " \"\\tcall " __ASM_NAME("__wine_dbg_%s_init") "\\n\"\n", prefix );
fprintf( outfile, " \"\\t.section\\t\\\".fini\\\" ,\\\"ax\\\"\\n\"\n" );
fprintf( outfile, " \"\\tcall " PREFIX "__wine_dbg_%s_fini\\n\"\n", prefix );
fprintf( outfile, " \"\\tcall " __ASM_NAME("__wine_dbg_%s_fini") "\\n\"\n", prefix );
fprintf( outfile, " \"\\t.section\\t\\\".text\\\"\\n\");\n" );
#elif defined(__sparc__)
fprintf( outfile, "asm(\"\\t.section\\t\\\".init\\\" ,\\\"ax\\\"\\n\"\n" );
fprintf( outfile, " \"\\tcall " PREFIX "__wine_dbg_%s_init\\n\"\n", prefix );
fprintf( outfile, " \"\\tcall " __ASM_NAME("__wine_dbg_%s_init") "\\n\"\n", prefix );
fprintf( outfile, " \"\\tnop\\n\"\n" );
fprintf( outfile, " \"\\t.section\\t\\\".fini\\\" ,\\\"ax\\\"\\n\"\n" );
fprintf( outfile, " \"\\tcall " PREFIX "__wine_dbg_%s_fini\\n\"\n", prefix );
fprintf( outfile, " \"\\tcall " __ASM_NAME("__wine_dbg_%s_fini") "\\n\"\n", prefix );
fprintf( outfile, " \"\\tnop\\n\"\n" );
fprintf( outfile, " \"\\t.section\t\\\".text\\\"\\n\");\n" );
#elif defined(__PPC__)
fprintf( outfile, "asm(\"\\t.section\\t\\\".init\\\" ,\\\"ax\\\"\\n\"\n" );
fprintf( outfile, " \"\\tbl " PREFIX "__wine_dbg_%s_init\\n\"\n", prefix );
fprintf( outfile, " \"\\tbl " __ASM_NAME("__wine_dbg_%s_init") "\\n\"\n", prefix );
fprintf( outfile, " \"\\t.section\\t\\\".fini\\\" ,\\\"ax\\\"\\n\"\n" );
fprintf( outfile, " \"\\tbl " PREFIX "__wine_dbg_%s_fini\\n\"\n", prefix );
fprintf( outfile, " \"\\tbl " __ASM_NAME("__wine_dbg_%s_fini") "\\n\"\n", prefix );
fprintf( outfile, " \"\\t.section\\t\\\".text\\\"\\n\");\n" );
#else
#error You need to define the DLL constructor for your architecture

View File

@ -48,6 +48,7 @@
*/
#include "config.h"
#include "wine/port.h"
#include <stdio.h>
#include <stdlib.h>
@ -127,11 +128,7 @@ char version_string[] = "Wine Resource Compiler Version " WRC_FULLVERSION "\n"
* Default prefix for resource names used in the C array.
* Option '-p name' sets it to 'name'
*/
#ifdef NEED_UNDERSCORE_PREFIX
char *prefix = "__Resource";
#else
char *prefix = "_Resource";
#endif
char *prefix = __ASM_NAME("_Resource");
/*
* Set if compiling in 32bit mode (default).
@ -385,13 +382,7 @@ int main(int argc,char *argv[])
output_name = strdup(optarg);
break;
case 'p':
#ifdef NEED_UNDERSCORE_PREFIX
prefix = (char *)xmalloc(strlen(optarg)+2);
prefix[0] = '_';
strcpy(prefix+1, optarg);
#else
prefix = xstrdup(optarg);
#endif
break;
case 'r':
create_res = 1;

View File

@ -19,6 +19,7 @@
*/
#include "config.h"
#include "wine/port.h"
#include <stdio.h>
#include <stdlib.h>
@ -32,12 +33,6 @@
#include "newstruc.h"
#include "utils.h"
#ifdef NEED_UNDERSCORE_PREFIX
char Underscore[] = "_";
#else
char Underscore[] = "";
#endif
static char s_file_head_str[] =
"/* This file is generated with wrc version " WRC_FULLVERSION ". Do not edit! */\n"
"/* Source : %s */\n"
@ -56,12 +51,8 @@ static char s_file_tail_str[] =
static char s_file_autoreg_str[] =
"\t.text\n"
".LAuto_Register:\n"
"\tpushl\t$%s%s\n"
#ifdef NEED_UNDERSCORE_PREFIX
"\tcall\t_LIBRES_RegisterResources\n"
#else
"\tcall\tLIBRES_RegisterResources\n"
#endif
"\tpushl\t$" __ASM_NAME("%s%s") "\n"
"\tcall\t" __ASM_NAME("LIBRES_RegisterResources") "\n"
"\taddl\t$4,%%esp\n"
"\tret\n\n"
#ifdef __NetBSD__
@ -536,8 +527,8 @@ static void write_pe_segment(FILE *fp)
int i;
fprintf(fp, "\t.align\t4\n");
fprintf(fp, "%s%s:\n", prefix, _PEResTab);
fprintf(fp, "\t.globl\t%s%s\n", prefix, _PEResTab);
fprintf(fp, __ASM_NAME("%s%s") ":\n", prefix, _PEResTab);
fprintf(fp, "\t.globl\t" __ASM_NAME("%s%s") "\n", prefix, _PEResTab);
/* Flags */
fprintf(fp, "\t.long\t0\n");
/* Time/Date stamp */
@ -561,7 +552,7 @@ static void write_pe_segment(FILE *fp)
else
{
char *name = prep_nid_for_label(&(rcp->type));
fprintf(fp, "\t.long\t(%s_%s_typename - %s%s) | 0x80000000\n",
fprintf(fp, "\t.long\t(" __ASM_NAME("%s_%s_typename") " - " __ASM_NAME("%s%s") ") | 0x80000000\n",
prefix,
name,
prefix,
@ -569,7 +560,7 @@ static void write_pe_segment(FILE *fp)
}
/* Offset */
label = prep_nid_for_label(&(rcp->type));
fprintf(fp, "\t.long\t(.L%s - %s%s) | 0x80000000\n",
fprintf(fp, "\t.long\t(.L%s - " __ASM_NAME("%s%s") ") | 0x80000000\n",
label,
prefix,
_PEResTab);
@ -601,7 +592,7 @@ static void write_pe_segment(FILE *fp)
fprintf(fp, "\t.long\t%d\n", rsc->name->name.i_name);
else
{
fprintf(fp, "\t.long\t(%s%s_name - %s%s) | 0x80000000\n",
fprintf(fp, "\t.long\t(" __ASM_NAME("%s%s_name") " - " __ASM_NAME("%s%s") ") | 0x80000000\n",
prefix,
rsc->c_name,
prefix,
@ -613,7 +604,7 @@ static void write_pe_segment(FILE *fp)
*/
/* Offset */
namelabel = prep_nid_for_label(rsc->name);
fprintf(fp, "\t.long\t(.L%s_%s - %s%s) | 0x80000000\n",
fprintf(fp, "\t.long\t(.L%s_%s - " __ASM_NAME("%s%s") ") | 0x80000000\n",
typelabel,
namelabel,
prefix,
@ -654,7 +645,7 @@ static void write_pe_segment(FILE *fp)
/* LanguageId */
fprintf(fp, "\t.long\t0x%08x\n", rsc->lan ? MAKELANGID(rsc->lan->id, rsc->lan->sub) : 0);
/* Offset */
fprintf(fp, "\t.long\t.L%s_%s_%d - %s%s\n",
fprintf(fp, "\t.long\t.L%s_%s_%d - " __ASM_NAME("%s%s") "\n",
typelabel,
namelabel,
rsc->lan ? MAKELANGID(rsc->lan->id, rsc->lan->sub) : 0,
@ -667,8 +658,8 @@ static void write_pe_segment(FILE *fp)
}
/* Write the resource table itself */
fprintf(fp, "%s_ResourceDirectory:\n", prefix);
fprintf(fp, "\t.globl\t%s_ResourceDirectory\n", prefix);
fprintf(fp, __ASM_NAME("%s_ResourceDirectory") ":\n", prefix);
fprintf(fp, "\t.globl\t" __ASM_NAME("%s_ResourceDirectory") "\n", prefix);
direntries = 0;
for(i = 0; i < rccount; i++)
@ -700,7 +691,7 @@ static void write_pe_segment(FILE *fp)
rsc->lan ? MAKELANGID(rsc->lan->id, rsc->lan->sub) : 0);
/* Data RVA */
fprintf(fp, "\t.long\t%s%s_data - %s%s\n",
fprintf(fp, "\t.long\t" __ASM_NAME("%s%s_data") " - " __ASM_NAME("%s%s") "\n",
prefix,
rsc->c_name,
prefix,
@ -736,8 +727,8 @@ static void write_ne_segment(FILE *fp)
int i, j;
fprintf(fp, "\t.align\t4\n");
fprintf(fp, "%s%s:\n", prefix, _NEResTab);
fprintf(fp, "\t.globl\t%s%s\n", prefix, _NEResTab);
fprintf(fp, __ASM_NAME("%s%s") ":\n", prefix, _NEResTab);
fprintf(fp, "\t.globl\t" __ASM_NAME("%s%s") "\n", prefix, _NEResTab);
/* AlignmentShift */
fprintf(fp, "\t.short\t%d\n", alignment_pwr);
@ -751,7 +742,7 @@ static void write_ne_segment(FILE *fp)
if(rcp->type.type == name_ord)
fprintf(fp, "\t.short\t0x%04x\n", rcp->type.name.i_name | 0x8000);
else
fprintf(fp, "\t.short\t%s_%s_typename - %s%s\n",
fprintf(fp, "\t.short\t" __ASM_NAME("%s_%s_typename") " - " __ASM_NAME("%s%s") "\n",
prefix,
rcp->type.name.s_name->str.cstr,
prefix,
@ -772,7 +763,7 @@ static void write_ne_segment(FILE *fp)
* All other things are as the MS doc describes (alignment etc.)
*/
/* Offset */
fprintf(fp, "\t.short\t(%s%s_data - %s%s) >> %d\n",
fprintf(fp, "\t.short\t(" __ASM_NAME("%s%s_data") " - " __ASM_NAME("%s%s") ") >> %d\n",
prefix,
rcp->rscarray[j]->c_name,
prefix,
@ -787,7 +778,7 @@ static void write_ne_segment(FILE *fp)
if(rcp->rscarray[j]->name->type == name_ord)
fprintf(fp, "\t.short\t0x%04x\n", rcp->rscarray[j]->name->name.i_name | 0x8000);
else
fprintf(fp, "\t.short\t%s%s_name - %s%s\n",
fprintf(fp, "\t.short\t" __ASM_NAME("%s%s_name") " - " __ASM_NAME("%s%s") "\n",
prefix,
rcp->rscarray[j]->c_name,
prefix,
@ -827,7 +818,7 @@ static void write_rsc_names(FILE *fp)
if(rcp->type.type == name_str)
{
char *name = prep_nid_for_label(&(rcp->type));
fprintf(fp, "%s_%s_typename:\n",
fprintf(fp, __ASM_NAME("%s_%s_typename") ":\n",
prefix,
name);
write_name_str(fp, &(rcp->type));
@ -839,7 +830,7 @@ static void write_rsc_names(FILE *fp)
if(rsc->name->type == name_str)
{
fprintf(fp, "%s%s_name:\n",
fprintf(fp, __ASM_NAME("%s%s_name") ":\n",
prefix,
rsc->c_name);
write_name_str(fp, rsc->name);
@ -856,7 +847,7 @@ static void write_rsc_names(FILE *fp)
if(rcp->type.type == name_str)
{
fprintf(fp, "%s_%s_typename:\n",
fprintf(fp, __ASM_NAME("%s_%s_typename") ":\n",
prefix,
rcp->type.name.s_name->str.cstr);
write_name_str(fp, &(rcp->type));
@ -865,7 +856,7 @@ static void write_rsc_names(FILE *fp)
{
if(rcp->rscarray[j]->name->type == name_str)
{
fprintf(fp, "%s%s_name:\n",
fprintf(fp, __ASM_NAME("%s%s_name") ":\n",
prefix,
rcp->rscarray[j]->c_name);
write_name_str(fp, rcp->rscarray[j]->name);
@ -943,9 +934,9 @@ void write_s_file(char *outname, resource_t *top)
continue;
fprintf(fo, "\t.align\t%d\n", win32 ? 4 : alignment);
fprintf(fo, "%s%s_data:\n", prefix, rsc->c_name);
fprintf(fo, __ASM_NAME("%s%s_data") ":\n", prefix, rsc->c_name);
if(global)
fprintf(fo, "\t.globl\t%s%s_data\n", prefix, rsc->c_name);
fprintf(fo, "\t.globl\t" __ASM_NAME("%s%s_data") "\n", prefix, rsc->c_name);
write_s_res(fo, rsc->binres);
@ -956,26 +947,26 @@ void write_s_file(char *outname, resource_t *top)
{
/* Add a resource descriptor for built-in and elf-dlls */
fprintf(fo, "\t.align\t4\n");
fprintf(fo, "%s_ResourceDescriptor:\n", prefix);
fprintf(fo, "\t.globl\t%s_ResourceDescriptor\n", prefix);
fprintf(fo, "%s_ResourceTable:\n", prefix);
fprintf(fo, __ASM_NAME("%s_ResourceDescriptor") ":\n", prefix);
fprintf(fo, "\t.globl\t" __ASM_NAME("%s_ResourceDescriptor") "\n", prefix);
fprintf(fo, __ASM_NAME("%s_ResourceTable") ":\n", prefix);
if(global)
fprintf(fo, "\t.globl\t%s_ResourceTable\n", prefix);
fprintf(fo, "\t.long\t%s%s\n", prefix, win32 ? _PEResTab : _NEResTab);
fprintf(fo, "%s_NumberOfResources:\n", prefix);
fprintf(fo, "\t.globl\t" __ASM_NAME("%s_ResourceTable") "\n", prefix);
fprintf(fo, "\t.long\t" __ASM_NAME("%s%s") "\n", prefix, win32 ? _PEResTab : _NEResTab);
fprintf(fo, __ASM_NAME("%s_NumberOfResources") ":\n", prefix);
if(global)
fprintf(fo, "\t.globl\t%s_NumberOfResources\n", prefix);
fprintf(fo, "\t.globl\t" __ASM_NAME("%s_NumberOfResources") "\n", prefix);
fprintf(fo, "\t.long\t%d\n", direntries);
fprintf(fo, "%s_ResourceSectionSize:\n", prefix);
fprintf(fo, __ASM_NAME("%s_ResourceSectionSize") ":\n", prefix);
if(global)
fprintf(fo, "\t.globl\t%s_ResourceSectionSize\n", prefix);
fprintf(fo, "\t.long\t.LResTabEnd - %s%s\n", prefix, win32 ? _PEResTab : _NEResTab);
fprintf(fo, "\t.globl\t" __ASM_NAME("%s_ResourceSectionSize") "\n", prefix);
fprintf(fo, "\t.long\t.LResTabEnd - " __ASM_NAME("%s%s") "\n", prefix, win32 ? _PEResTab : _NEResTab);
if(win32)
{
fprintf(fo, "%s_ResourcesEntries:\n", prefix);
fprintf(fo, __ASM_NAME("%s_ResourcesEntries") ":\n", prefix);
if(global)
fprintf(fo, "\t.globl\t%s_ResourcesEntries\n", prefix);
fprintf(fo, "\t.long\t%s_ResourceDirectory\n", prefix);
fprintf(fo, "\t.globl\t" __ASM_NAME("%s_ResourcesEntries") "\n", prefix);
fprintf(fo, "\t.long\t" __ASM_NAME("%s_ResourceDirectory") "\n", prefix);
}
}
}
@ -1024,19 +1015,21 @@ void write_s_file(char *outname, resource_t *top)
* first byte/word denotes the size and the rest the string
* itself.
*/
fprintf(fo, "%s%s:\n", prefix, rsc->c_name);
fprintf(fo, __ASM_NAME("%s%s") ":\n", prefix, rsc->c_name);
if(global)
fprintf(fo, "\t.globl\t%s%s\n", prefix, rsc->c_name);
fprintf(fo, "\t.long\t%d, %s%s%s, %d, %s%s%s%s, %s%s_data, %d\n",
rsc->name->type == name_ord ? rsc->name->name.i_name : 0,
rsc->name->type == name_ord ? "0" : prefix,
rsc->name->type == name_ord ? "" : rsc->c_name,
rsc->name->type == name_ord ? "" : "_name",
type,
type ? "0" : prefix,
type ? "" : "_",
type ? "" : type_name,
type ? "" : "_typename",
fprintf(fo, "\t.globl\t" __ASM_NAME("%s%s") "\n", prefix, rsc->c_name);
if (rsc->name->type == name_ord)
fprintf(fo, "\t.long\t%d, 0, ", rsc->name->name.i_name );
else
fprintf(fo, "\t.long\t0, " __ASM_NAME("%s%s_name") ", ",
prefix, rsc->c_name );
if (type)
fprintf(fo, "%d, 0, ", type);
else
fprintf(fo, "0, " __ASM_NAME("%s_%s_typename") ", ",
prefix, type_name );
fprintf(fo, __ASM_NAME("%s%s_data") ", %d\n",
prefix,
rsc->c_name,
rsc->binres->size - rsc->binres->dataidx);
@ -1047,11 +1040,11 @@ void write_s_file(char *outname, resource_t *top)
/* Write the indirection table */
fprintf(fo, "/* Resource indirection table */\n\n");
fprintf(fo, "\t.align\t4\n");
fprintf(fo, "%s%s:\n", prefix, _ResTable);
fprintf(fo, "\t.globl\t%s%s\n", prefix, _ResTable);
fprintf(fo, __ASM_NAME("%s%s") ":\n", prefix, _ResTable);
fprintf(fo, "\t.globl\t" __ASM_NAME("%s%s") "\n", prefix, _ResTable);
for(rsc = top; rsc; rsc = rsc->next)
{
fprintf(fo, "\t.long\t%s%s\n", prefix, rsc->c_name);
fprintf(fo, "\t.long\t" __ASM_NAME("%s%s") "\n", prefix, rsc->c_name);
}
fprintf(fo, "\t.long\t0\n");
fprintf(fo, "\n");
@ -1080,13 +1073,6 @@ void write_h_file(char *outname, resource_t *top)
{
FILE *fo;
resource_t *rsc;
char *h_prefix;
#ifdef NEED_UNDERSCORE_PREFIX
h_prefix = prefix + 1;
#else
h_prefix = prefix;
#endif
fo = fopen(outname, "wt");
if(!fo)
@ -1102,7 +1088,7 @@ void write_h_file(char *outname, resource_t *top)
{
fprintf(fo, "extern %schar %s%s[];\n\n",
constant ? "const " : "",
h_prefix,
prefix,
win32 ? _PEResTab : _NEResTab);
}
@ -1114,7 +1100,7 @@ void write_h_file(char *outname, resource_t *top)
fprintf(fo, "extern %schar %s%s_data[];\n",
constant ? "const " : "",
h_prefix,
prefix,
rsc->c_name);
}
@ -1129,7 +1115,7 @@ void write_h_file(char *outname, resource_t *top)
fprintf(fo, "extern %swrc_resource%d_t %s%s;\n",
constant ? "const " : "",
win32 ? 32 : 16,
h_prefix,
prefix,
rsc->c_name);
}
@ -1140,11 +1126,10 @@ void write_h_file(char *outname, resource_t *top)
fprintf(fo, "extern %swrc_resource%d_t %s%s[];\n\n",
constant ? "const " : "",
win32 ? 32 : 16,
h_prefix,
prefix,
_ResTable);
}
fprintf(fo, h_file_tail_str);
fclose(fo);
}