From: Rémi Bernon rbernon@codeweavers.com
Set it only when -Wl,--delay-load linker flag is supported to keep support for MSVC-like import libs, as generated by LLVM dlltool. --- tools/makedep.c | 1 + tools/winebuild/build.h | 1 + tools/winebuild/import.c | 12 ++++++++++-- tools/winebuild/main.c | 9 ++++++++- tools/winebuild/winebuild.man.in | 3 +++ 5 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/tools/makedep.c b/tools/makedep.c index ca1efed4533..a042621cec7 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -3404,6 +3404,7 @@ static void output_import_lib( struct makefile *make, unsigned int arch ) output_filenames_obj_dir( make, make->implib_files[arch] ); output( "\n" ); output( "\t%s%s -w --implib -o $@", cmd_prefix( "BUILD" ), tools_path( make, "winebuild" ) ); + if (!delay_load_flags[arch]) output_filename( "--without-dlltool" ); output_filenames( target_flags[arch] ); if (make->is_win16) output_filename( "-m16" ); output_filename( "--export" ); diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h index 7ce502143e3..accfa9a47dd 100644 --- a/tools/winebuild/build.h +++ b/tools/winebuild/build.h @@ -357,6 +357,7 @@ extern int verbose; extern int link_ext_symbols; extern int force_pointer_size; extern int unwind_tables; +extern int use_dlltool; extern int use_msvcrt; extern int unix_lib; extern int safe_seh; diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c index a2ada71ae36..8d05b91ec9b 100644 --- a/tools/winebuild/import.c +++ b/tools/winebuild/import.c @@ -1581,8 +1581,8 @@ void output_static_lib( const char *output_name, struct strarray files, int crea } }
-/* create a Windows-style import library */ -static void build_windows_import_lib( const char *lib_name, DLLSPEC *spec, struct strarray files ) +/* create a Windows-style import library using dlltool */ +static void build_dlltool_import_lib( const char *lib_name, DLLSPEC *spec, struct strarray files ) { struct strarray args; char *def_file; @@ -1627,6 +1627,13 @@ static void build_windows_import_lib( const char *lib_name, DLLSPEC *spec, struc if (files.count) output_static_lib( output_file_name, files, 0 ); }
+/* create a Windows-style import library */ +static void build_windows_import_lib( const char *lib_name, DLLSPEC *spec, struct strarray files ) +{ + if (verbose) fprintf( stderr, "Not implemented, falling back to dlltool.\n" ); + build_dlltool_import_lib( output_file_name, spec, files ); +} + /* create a Unix-style import library */ static void build_unix_import_lib( DLLSPEC *spec, struct strarray files ) { @@ -1689,5 +1696,6 @@ static void build_unix_import_lib( DLLSPEC *spec, struct strarray files ) void output_import_lib( DLLSPEC *spec, struct strarray files ) { if (!is_pe()) build_unix_import_lib( spec, files ); + else if (use_dlltool) build_dlltool_import_lib( output_file_name, spec, files ); else build_windows_import_lib( output_file_name, spec, files ); } diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c index cbe1e4669c1..01ceba9e516 100644 --- a/tools/winebuild/main.c +++ b/tools/winebuild/main.c @@ -42,6 +42,7 @@ int verbose = 0; int link_ext_symbols = 0; int force_pointer_size = 0; int unwind_tables = 0; +int use_dlltool = 1; int use_msvcrt = 0; int unix_lib = 0; int safe_seh = 0; @@ -233,6 +234,7 @@ static const char usage_str[] = " -v, --verbose Display the programs invoked\n" " --version Print the version and exit\n" " -w, --warnings Turn on warnings\n" +" --without-dlltool Generate import library without using dlltool\n" "\nMode options:\n" " --dll Build a library from a .spec file and object files\n" " --def Build a .def file from a .spec file\n" @@ -268,7 +270,8 @@ enum long_options_values LONG_OPT_STATICLIB, LONG_OPT_SUBSYSTEM, LONG_OPT_SYSCALL_TABLE, - LONG_OPT_VERSION + LONG_OPT_VERSION, + LONG_OPT_WITHOUT_DLLTOOL, };
static const char short_options[] = "B:C:D:E:F:H:I:K:L:M:N:b:d:e:f:hkl:m:o:r:u:vw"; @@ -300,6 +303,7 @@ static const struct long_option long_options[] = { "subsystem", 1, LONG_OPT_SUBSYSTEM }, { "syscall-table", 1, LONG_OPT_SYSCALL_TABLE }, { "version", 0, LONG_OPT_VERSION }, + { "without-dlltool", 0, LONG_OPT_WITHOUT_DLLTOOL }, /* aliases for short options */ { "target", 1, 'b' }, { "delay-lib", 1, 'd' }, @@ -531,6 +535,9 @@ static void option_callback( int optc, char *optarg ) case LONG_OPT_VERSION: printf( "winebuild version " PACKAGE_VERSION "\n" ); exit(0); + case LONG_OPT_WITHOUT_DLLTOOL: + use_dlltool = 0; + break; case '?': fprintf( stderr, "winebuild: %s\n\n", optarg ); usage(1); diff --git a/tools/winebuild/winebuild.man.in b/tools/winebuild/winebuild.man.in index 2637b5beb5f..7f93a5befdc 100644 --- a/tools/winebuild/winebuild.man.in +++ b/tools/winebuild/winebuild.man.in @@ -279,6 +279,9 @@ Display the program version and exit. .TP .B -w, --warnings Turn on warnings. +.TP +.B --without-dlltool +Generate import library without using dlltool. .SH "SPEC FILE SYNTAX" .SS "General syntax" A spec file should contain a list of ordinal declarations. The general