Commit 13baa7b3 authored by Alexandre Julliard's avatar Alexandre Julliard

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

hidden on platforms that support it.
parent 08414826
...@@ -185,6 +185,7 @@ extern unsigned int get_ptr_size(void); ...@@ -185,6 +185,7 @@ extern unsigned int get_ptr_size(void);
extern const char *asm_name( const char *func ); extern const char *asm_name( const char *func );
extern const char *func_declaration( const char *func ); extern const char *func_declaration( const char *func );
extern const char *func_size( 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_ptr_keyword(void);
extern const char *get_asm_string_keyword(void); extern const char *get_asm_string_keyword(void);
extern const char *get_asm_short_keyword(void); extern const char *get_asm_short_keyword(void);
......
...@@ -615,8 +615,7 @@ static void output_import_thunk( FILE *outfile, const char *name, const char *ta ...@@ -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, "\n\t.align %d\n", get_alignment(4) );
fprintf( outfile, "\t%s\n", func_declaration(name) ); fprintf( outfile, "\t%s\n", func_declaration(name) );
fprintf( outfile, "\t.globl %s\n", asm_name(name) ); fprintf( outfile, "%s\n", asm_globl(name) );
fprintf( outfile, "%s:\n", asm_name(name) );
switch(target_cpu) switch(target_cpu)
{ {
...@@ -854,8 +853,7 @@ static void output_delayed_imports( FILE *outfile, const DLLSPEC *spec ) ...@@ -854,8 +853,7 @@ static void output_delayed_imports( FILE *outfile, const DLLSPEC *spec )
fprintf( outfile, "\n/* delayed imports */\n\n" ); fprintf( outfile, "\n/* delayed imports */\n\n" );
fprintf( outfile, "\t.data\n" ); fprintf( outfile, "\t.data\n" );
fprintf( outfile, "\t.align %d\n", get_alignment(get_ptr_size()) ); 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_globl("__wine_spec_delay_imports") );
fprintf( outfile, "%s:\n", asm_name("__wine_spec_delay_imports"));
/* list of dlls */ /* list of dlls */
......
...@@ -36,8 +36,7 @@ static void function_header( FILE *outfile, const char *name ) ...@@ -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, "\n\t.align %d\n", get_alignment(4) );
fprintf( outfile, "\t%s\n", func_declaration(name) ); fprintf( outfile, "\t%s\n", func_declaration(name) );
fprintf( outfile, "\t.globl %s\n", asm_name(name) ); fprintf( outfile, "%s\n", asm_globl(name) );
fprintf( outfile, "%s:\n", asm_name(name) );
} }
...@@ -900,14 +899,12 @@ static void BuildPendingEventCheck( FILE *outfile ) ...@@ -900,14 +899,12 @@ static void BuildPendingEventCheck( FILE *outfile )
/* Start cleanup. Restore fs register. */ /* Start cleanup. Restore fs register. */
fprintf( outfile, "\t.globl %s\n", asm_name("DPMI_PendingEventCheck_Cleanup") ); fprintf( outfile, "%s\n", asm_globl("DPMI_PendingEventCheck_Cleanup") );
fprintf( outfile, "%s:\n", asm_name("DPMI_PendingEventCheck_Cleanup") );
fprintf( outfile, "\tpopw %%fs\n" ); fprintf( outfile, "\tpopw %%fs\n" );
/* Return from function. */ /* Return from function. */
fprintf( outfile, "\t.globl %s\n", asm_name("DPMI_PendingEventCheck_Return") ); fprintf( outfile, "%s\n", asm_globl("DPMI_PendingEventCheck_Return") );
fprintf( outfile, "%s:\n", asm_name("DPMI_PendingEventCheck_Return") );
fprintf( outfile, "\tiret\n" ); fprintf( outfile, "\tiret\n" );
function_footer( outfile, "DPMI_PendingEventCheck" ); function_footer( outfile, "DPMI_PendingEventCheck" );
...@@ -934,8 +931,7 @@ void BuildRelays16( FILE *outfile ) ...@@ -934,8 +931,7 @@ void BuildRelays16( FILE *outfile )
fprintf( outfile, "%s:\n\n", asm_name("__wine_spec_thunk_text_16") ); 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_globl("__wine_call16_start") );
fprintf( outfile, "%s:\n", asm_name("__wine_call16_start") );
/* Standard CallFrom16 routine (WORD return) */ /* Standard CallFrom16 routine (WORD return) */
BuildCallFrom16Core( outfile, FALSE, FALSE, TRUE ); BuildCallFrom16Core( outfile, FALSE, FALSE, TRUE );
...@@ -967,16 +963,13 @@ void BuildRelays16( FILE *outfile ) ...@@ -967,16 +963,13 @@ void BuildRelays16( FILE *outfile )
/* Pending DPMI events check stub */ /* Pending DPMI events check stub */
BuildPendingEventCheck( outfile ); BuildPendingEventCheck( outfile );
fprintf( outfile, "\t.globl %s\n", asm_name("__wine_call16_end") ); fprintf( outfile, "%s\n", asm_globl("__wine_call16_end") );
fprintf( outfile, "%s:\n", asm_name("__wine_call16_end") );
function_footer( outfile, "__wine_spec_thunk_text_16" ); function_footer( outfile, "__wine_spec_thunk_text_16" );
/* Declare the return address and data selector variables */ /* Declare the return address and data selector variables */
fprintf( outfile, "\n\t.data\n\t.align %d\n", get_alignment(4) ); 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\n\t.long 0\n", asm_globl("CallTo16_DataSelector") );
fprintf( outfile, "%s:\t.long 0\n", asm_name("CallTo16_DataSelector") ); fprintf( outfile, "%s\n\t.long 0\n", asm_globl("CallTo16_TebSelector") );
fprintf( outfile, "\t.globl %s\n", asm_name("CallTo16_TebSelector") );
fprintf( outfile, "%s:\t.long 0\n", asm_name("CallTo16_TebSelector") );
if (UsePIC) fprintf( outfile, "wine_ldt_copy_ptr:\t.long %s\n", asm_name("wine_ldt_copy") ); if (UsePIC) fprintf( outfile, "wine_ldt_copy_ptr:\t.long %s\n", asm_name("wine_ldt_copy") );
} }
......
...@@ -482,8 +482,7 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec ) ...@@ -482,8 +482,7 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec )
fprintf( outfile, "\n\t.data\n" ); fprintf( outfile, "\n\t.data\n" );
fprintf( outfile, "\t.align %d\n", get_alignment(get_ptr_size()) ); 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_globl("__wine_spec_nt_header") );
fprintf( outfile, "%s:\n", asm_name("__wine_spec_nt_header"));
fprintf( outfile, "\t.long 0x%04x\n", IMAGE_NT_SIGNATURE ); /* Signature */ fprintf( outfile, "\t.long 0x%04x\n", IMAGE_NT_SIGNATURE ); /* Signature */
switch(target_cpu) switch(target_cpu)
...@@ -575,8 +574,7 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec ) ...@@ -575,8 +574,7 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec )
fprintf( outfile, "\t.long 0,0\n" ); /* DataDirectory[15] */ fprintf( outfile, "\t.long 0,0\n" ); /* DataDirectory[15] */
fprintf( outfile, "\n\t%s\n", get_asm_string_section() ); 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_globl("__wine_spec_file_name") );
fprintf( outfile, "%s:\n", asm_name("__wine_spec_file_name"));
fprintf( outfile, "\t%s \"%s\"\n", get_asm_string_keyword(), spec->file_name ); fprintf( outfile, "\t%s \"%s\"\n", get_asm_string_keyword(), spec->file_name );
if (target_platform == PLATFORM_APPLE) if (target_platform == PLATFORM_APPLE)
fprintf( outfile, "\t.comm %s,4\n", asm_name("_end") ); fprintf( outfile, "\t.comm %s,4\n", asm_name("_end") );
......
...@@ -470,6 +470,25 @@ const char *func_size( const char *func ) ...@@ -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) const char *get_asm_ptr_keyword(void)
{ {
switch(get_ptr_size()) switch(get_ptr_size())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment