diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h index afb4c635c45..dcdf595d554 100644 --- a/tools/winebuild/build.h +++ b/tools/winebuild/build.h @@ -188,6 +188,7 @@ extern const char *func_size( 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); +extern const char *get_asm_string_section(void); extern void add_import_dll( const char *name, const char *filename ); extern void add_delayed_import( const char *name ); diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c index 8c4659a1f62..cafdbbeb6f6 100644 --- a/tools/winebuild/spec32.c +++ b/tools/winebuild/spec32.c @@ -314,6 +314,7 @@ static void output_stubs( FILE *outfile, DLLSPEC *spec ) if (pos) { + fprintf( outfile, " \"\\t%s\\n\"\n", get_asm_string_section() ); fprintf( outfile, " \".L__wine_stub_strings:\\n\"\n" ); for (i = 0; i < spec->nb_entry_points; i++) { @@ -453,19 +454,11 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec ) if (target_platform == PLATFORM_APPLE) fprintf( outfile, "static char _end[4];\n" ); - else - fprintf( outfile, "extern char _end[];\n" ); - - fprintf( outfile, "const char __wine_spec_file_name[] = \"%s\";\n", spec->file_name ); /* Output the resources */ resources_size = output_resources( outfile, spec ); - /* Output the entry point function */ - - fprintf( outfile, "extern void %s();\n\n", spec->init_func ); - /* Output the NT header */ fprintf( outfile, "#ifndef __GNUC__\n" ); @@ -564,6 +557,12 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec ) fprintf( outfile, " \"\\t.long 0,0\\n\"\n" ); /* DataDirectory[15] */ fprintf( outfile, ");\n" ); + fprintf( outfile, "asm(\"%s\\n\"\n", get_asm_string_section() ); + fprintf( outfile, " \"\\t.globl %s\\n\"\n", asm_name("__wine_spec_file_name") ); + fprintf( outfile, " \"%s:\\n\"\n", asm_name("__wine_spec_file_name")); + fprintf( outfile, " \"\\t%s \\\"%s\\\"\\n\"\n", get_asm_string_keyword(), spec->file_name ); + fprintf( outfile, ");\n" ); + output_stubs( outfile, spec ); output_exports( outfile, spec ); output_imports( outfile, spec ); diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c index 22d105cca5d..37b6b46c917 100644 --- a/tools/winebuild/utils.c +++ b/tools/winebuild/utils.c @@ -501,3 +501,12 @@ const char *get_asm_short_keyword(void) default: return ".short"; } } + +const char *get_asm_string_section(void) +{ + switch (target_platform) + { + case PLATFORM_APPLE: return ".cstring"; + default: return ".section .rodata"; + } +}