Alexandre Julliard : winebuild: Support generating a .spec.o file for Windows platforms.
Alexandre Julliard
julliard at winehq.org
Tue Mar 12 16:56:14 CDT 2019
Module: wine
Branch: master
Commit: e4b9a501a3ddbbfb2cd8aee6eb9330f6af91fe6d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=e4b9a501a3ddbbfb2cd8aee6eb9330f6af91fe6d
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Mar 12 10:02:04 2019 +0100
winebuild: Support generating a .spec.o file for Windows platforms.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
tools/winebuild/build.h | 1 +
tools/winebuild/main.c | 3 ++-
tools/winebuild/res32.c | 9 ++++++---
tools/winebuild/spec32.c | 23 ++++++++++++++++++++++-
4 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index 44fa317..1d4f217 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -303,6 +303,7 @@ extern int load_res32_file( const char *name, DLLSPEC *spec );
extern void output_resources( DLLSPEC *spec );
extern void output_bin_resources( DLLSPEC *spec, unsigned int start_rva );
extern void output_spec32_file( DLLSPEC *spec );
+extern void output_pe_module( DLLSPEC *spec );
extern void output_fake_module( DLLSPEC *spec );
extern void output_def_file( DLLSPEC *spec, int include_private );
extern void load_res16_file( const char *name, DLLSPEC *spec );
diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c
index d7bc39f..781d391 100644
--- a/tools/winebuild/main.c
+++ b/tools/winebuild/main.c
@@ -645,7 +645,8 @@ int main(int argc, char **argv)
output_spec16_file( spec );
break;
case SPEC_WIN32:
- output_spec32_file( spec );
+ if (target_platform == PLATFORM_WINDOWS) output_pe_module( spec );
+ else output_spec32_file( spec );
break;
default: assert(0);
}
diff --git a/tools/winebuild/res32.c b/tools/winebuild/res32.c
index 16e5c65..634c933 100644
--- a/tools/winebuild/res32.c
+++ b/tools/winebuild/res32.c
@@ -441,7 +441,7 @@ void output_resources( DLLSPEC *spec )
/* output the resource directories */
output( "\n/* resources */\n\n" );
- output( "\t.data\n" );
+ output( "\t.section %s\n", target_platform == PLATFORM_WINDOWS ? ".rsrc" : ".data" );
output( "\t.align %d\n", get_alignment(get_ptr_size()) );
output( ".L__wine_spec_resources:\n" );
@@ -498,9 +498,12 @@ void output_resources( DLLSPEC *spec )
output( ".L__wine_spec_res_%d:\n", i );
dump_res_data( res );
}
- output( ".L__wine_spec_resources_end:\n" );
- output( "\t.byte 0\n" );
+ if (target_platform != PLATFORM_WINDOWS)
+ {
+ output( ".L__wine_spec_resources_end:\n" );
+ output( "\t.byte 0\n" );
+ }
free_resource_tree( tree );
}
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index 7b4d661..d0c147d 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -384,7 +384,7 @@ void output_exports( DLLSPEC *spec )
if (!nr_exports) return;
output( "\n/* export table */\n\n" );
- output( "\t.data\n" );
+ output( "\t.section %s\n", target_platform == PLATFORM_WINDOWS ? ".edata" : ".data" );
output( "\t.align %d\n", get_alignment(4) );
output( ".L__wine_spec_exports:\n" );
@@ -492,6 +492,9 @@ void output_exports( DLLSPEC *spec )
output( "\t%s \"%s\"\n", get_asm_string_keyword(), odp->link_name );
}
}
+
+ if (target_platform == PLATFORM_WINDOWS) return;
+
output( "\t.align %d\n", get_alignment(get_ptr_size()) );
output( ".L__wine_spec_exports_end:\n" );
@@ -708,6 +711,24 @@ void output_spec32_file( DLLSPEC *spec )
/*******************************************************************
+ * output_pe_module
+ *
+ * Build a PE from a spec file.
+ */
+void output_pe_module( DLLSPEC *spec )
+{
+ UsePIC = 0;
+ resolve_imports( spec );
+ open_output_file();
+ output_standard_file_header();
+ output_stubs( spec );
+ output_exports( spec );
+ output_resources( spec );
+ close_output_file();
+}
+
+
+/*******************************************************************
* output_fake_module
*
* Build a fake binary module from a spec file.
More information about the wine-cvs
mailing list