From ded2e82f16fb142c8056ba7833d139a1acc94e22 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 4 Jun 2019 12:38:43 +0200 Subject: [PATCH] winebuild: Don't even try to resolve imports for PE builds. Signed-off-by: Alexandre Julliard --- tools/winebuild/build.h | 1 - tools/winebuild/import.c | 1 + tools/winebuild/main.c | 18 +++++++----------- tools/winebuild/spec16.c | 5 ++--- tools/winebuild/spec32.c | 21 ++------------------- 5 files changed, 12 insertions(+), 34 deletions(-) diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h index 49473c7683a..241fd60defd 100644 --- a/tools/winebuild/build.h +++ b/tools/winebuild/build.h @@ -306,7 +306,6 @@ 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_stubs ); extern void load_res16_file( const char *name, DLLSPEC *spec ); diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c index d8abc9d03cc..6c68dbd4f0a 100644 --- a/tools/winebuild/import.c +++ b/tools/winebuild/import.c @@ -1311,6 +1311,7 @@ void output_stubs( DLLSPEC *spec ) /* output the import and delayed import tables of a Win32 module */ void output_imports( DLLSPEC *spec ) { + if (target_platform == PLATFORM_WINDOWS) return; output_immediate_imports(); output_delayed_imports( spec ); output_immediate_import_thunks(); diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c index 781d391f830..831db5deb8b 100644 --- a/tools/winebuild/main.c +++ b/tools/winebuild/main.c @@ -630,26 +630,22 @@ int main(int argc, char **argv) /* fall through */ case MODE_EXE: load_resources( argv, spec ); - load_import_libs( argv ); if (spec_file_name && !parse_input_file( spec )) break; + if (fake_module) { if (spec->type == SPEC_WIN16) output_fake_module16( spec ); else output_fake_module( spec ); break; } - read_undef_symbols( spec, argv ); - switch (spec->type) + if (target_platform != PLATFORM_WINDOWS) { - case SPEC_WIN16: - output_spec16_file( spec ); - break; - case SPEC_WIN32: - if (target_platform == PLATFORM_WINDOWS) output_pe_module( spec ); - else output_spec32_file( spec ); - break; - default: assert(0); + load_import_libs( argv ); + read_undef_symbols( spec, argv ); + resolve_imports( spec ); } + if (spec->type == SPEC_WIN16) output_spec16_file( spec ); + else output_spec32_file( spec ); break; case MODE_DEF: if (argv[0]) fatal_error( "file argument '%s' not allowed in this mode\n", argv[0] ); diff --git a/tools/winebuild/spec16.c b/tools/winebuild/spec16.c index b21f472772b..3a7e457282a 100644 --- a/tools/winebuild/spec16.c +++ b/tools/winebuild/spec16.c @@ -815,17 +815,16 @@ void output_spec16_file( DLLSPEC *spec16 ) { DLLSPEC *spec32 = alloc_dll_spec(); - resolve_imports( spec16 ); add_16bit_exports( spec32, spec16 ); needs_get_pc_thunk = 0; open_output_file(); output_standard_file_header(); - if (target_platform != PLATFORM_WINDOWS) output_module( spec32 ); + output_module( spec32 ); output_module16( spec16 ); output_stubs( spec16 ); output_exports( spec32 ); - if (target_platform != PLATFORM_WINDOWS) output_imports( spec16 ); + output_imports( spec16 ); if (is_undefined( "__wine_call_from_16" )) output_asm_relays16(); if (needs_get_pc_thunk) output_get_pc_thunk(); if (spec16->main_module) diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c index a0aa01754c2..f1dedcccc95 100644 --- a/tools/winebuild/spec32.c +++ b/tools/winebuild/spec32.c @@ -584,6 +584,8 @@ void output_module( DLLSPEC *spec ) switch (target_platform) { + case PLATFORM_WINDOWS: + return; /* nothing to do */ case PLATFORM_APPLE: output( "\t.text\n" ); output( "\t.align %d\n", get_alignment(page_size) ); @@ -710,7 +712,6 @@ void output_module( DLLSPEC *spec ) void output_spec32_file( DLLSPEC *spec ) { needs_get_pc_thunk = 0; - resolve_imports( spec ); open_output_file(); output_standard_file_header(); output_module( spec ); @@ -724,24 +725,6 @@ 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 *