Added a common function to declare global symbols, and make them

hidden on platforms that support it.
This commit is contained in:
Alexandre Julliard 2005-09-15 18:48:39 +00:00
parent 084148267b
commit 13baa7b364
5 changed files with 31 additions and 22 deletions

View File

@ -185,6 +185,7 @@ extern unsigned int get_ptr_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 *asm_globl( const char *func );
extern const char *get_asm_ptr_keyword(void);
extern const char *get_asm_string_keyword(void);
extern const char *get_asm_short_keyword(void);

View File

@ -615,8 +615,7 @@ static void output_import_thunk( FILE *outfile, const char *name, const char *ta
{
fprintf( outfile, "\n\t.align %d\n", get_alignment(4) );
fprintf( outfile, "\t%s\n", func_declaration(name) );
fprintf( outfile, "\t.globl %s\n", asm_name(name) );
fprintf( outfile, "%s:\n", asm_name(name) );
fprintf( outfile, "%s\n", asm_globl(name) );
switch(target_cpu)
{
@ -854,8 +853,7 @@ static void output_delayed_imports( FILE *outfile, const DLLSPEC *spec )
fprintf( outfile, "\n/* delayed imports */\n\n" );
fprintf( outfile, "\t.data\n" );
fprintf( outfile, "\t.align %d\n", get_alignment(get_ptr_size()) );
fprintf( outfile, "\t.globl %s\n", asm_name("__wine_spec_delay_imports") );
fprintf( outfile, "%s:\n", asm_name("__wine_spec_delay_imports"));
fprintf( outfile, "%s\n", asm_globl("__wine_spec_delay_imports") );
/* list of dlls */

View File

@ -36,8 +36,7 @@ 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 %s\n", asm_name(name) );
fprintf( outfile, "%s:\n", asm_name(name) );
fprintf( outfile, "%s\n", asm_globl(name) );
}
@ -900,14 +899,12 @@ static void BuildPendingEventCheck( FILE *outfile )
/* Start cleanup. Restore fs register. */
fprintf( outfile, "\t.globl %s\n", asm_name("DPMI_PendingEventCheck_Cleanup") );
fprintf( outfile, "%s:\n", asm_name("DPMI_PendingEventCheck_Cleanup") );
fprintf( outfile, "%s\n", asm_globl("DPMI_PendingEventCheck_Cleanup") );
fprintf( outfile, "\tpopw %%fs\n" );
/* Return from function. */
fprintf( outfile, "\t.globl %s\n", asm_name("DPMI_PendingEventCheck_Return") );
fprintf( outfile, "%s:\n", asm_name("DPMI_PendingEventCheck_Return") );
fprintf( outfile, "%s\n", asm_globl("DPMI_PendingEventCheck_Return") );
fprintf( outfile, "\tiret\n" );
function_footer( outfile, "DPMI_PendingEventCheck" );
@ -934,8 +931,7 @@ void BuildRelays16( FILE *outfile )
fprintf( outfile, "%s:\n\n", asm_name("__wine_spec_thunk_text_16") );
fprintf( outfile, "\t.globl %s\n", asm_name("__wine_call16_start") );
fprintf( outfile, "%s:\n", asm_name("__wine_call16_start") );
fprintf( outfile, "%s\n", asm_globl("__wine_call16_start") );
/* Standard CallFrom16 routine (WORD return) */
BuildCallFrom16Core( outfile, FALSE, FALSE, TRUE );
@ -967,16 +963,13 @@ void BuildRelays16( FILE *outfile )
/* Pending DPMI events check stub */
BuildPendingEventCheck( outfile );
fprintf( outfile, "\t.globl %s\n", asm_name("__wine_call16_end") );
fprintf( outfile, "%s:\n", asm_name("__wine_call16_end") );
fprintf( outfile, "%s\n", asm_globl("__wine_call16_end") );
function_footer( outfile, "__wine_spec_thunk_text_16" );
/* Declare the return address and data selector variables */
fprintf( outfile, "\n\t.data\n\t.align %d\n", get_alignment(4) );
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") );
fprintf( outfile, "%s\n\t.long 0\n", asm_globl("CallTo16_DataSelector") );
fprintf( outfile, "%s\n\t.long 0\n", asm_globl("CallTo16_TebSelector") );
if (UsePIC) fprintf( outfile, "wine_ldt_copy_ptr:\t.long %s\n", asm_name("wine_ldt_copy") );
}

View File

@ -482,8 +482,7 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec )
fprintf( outfile, "\n\t.data\n" );
fprintf( outfile, "\t.align %d\n", get_alignment(get_ptr_size()) );
fprintf( outfile, "\t.globl %s\n", asm_name("__wine_spec_nt_header") );
fprintf( outfile, "%s:\n", asm_name("__wine_spec_nt_header"));
fprintf( outfile, "%s\n", asm_globl("__wine_spec_nt_header") );
fprintf( outfile, "\t.long 0x%04x\n", IMAGE_NT_SIGNATURE ); /* Signature */
switch(target_cpu)
@ -575,8 +574,7 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec )
fprintf( outfile, "\t.long 0,0\n" ); /* DataDirectory[15] */
fprintf( outfile, "\n\t%s\n", get_asm_string_section() );
fprintf( outfile, "\t.globl %s\n", asm_name("__wine_spec_file_name") );
fprintf( outfile, "%s:\n", asm_name("__wine_spec_file_name"));
fprintf( outfile, "%s\n", asm_globl("__wine_spec_file_name") );
fprintf( outfile, "\t%s \"%s\"\n", get_asm_string_keyword(), spec->file_name );
if (target_platform == PLATFORM_APPLE)
fprintf( outfile, "\t.comm %s,4\n", asm_name("_end") );

View File

@ -470,6 +470,25 @@ const char *func_size( const char *func )
}
}
/* return a global symbol declaration for an assembly symbol */
const char *asm_globl( const char *func )
{
static char buffer[256];
switch (target_platform)
{
case PLATFORM_APPLE:
sprintf( buffer, "\t.globl _%s\n\t.private_extern _%s\n_%s:", func, func, func );
return buffer;
case PLATFORM_WINDOWS:
sprintf( buffer, "\t.globl _%s\n_%s:", func, func );
return buffer;
default:
sprintf( buffer, "\t.globl %s\n\t.hidden %s\n%s:", func, func, func );
return buffer;
}
}
const char *get_asm_ptr_keyword(void)
{
switch(get_ptr_size())