On PE platforms when linking without a spec file nor resources, this produces an empty file.
From: Jacek Caban jacek@codeweavers.com
On PE platforms when linking without a spec file nor resources, this produces an empty file. --- tools/winegcc/winegcc.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c index 56fe179c92b..2736c18d7df 100644 --- a/tools/winegcc/winegcc.c +++ b/tools/winegcc/winegcc.c @@ -944,7 +944,8 @@ static void add_library( struct options *opts, struct strarray lib_dirs,
/* run winebuild to generate the .spec.o file */ static const char *build_spec_obj( struct options *opts, const char *spec_file, const char *output_file, - struct strarray files, struct strarray lib_dirs, const char *entry_point ) + struct strarray files, struct strarray resources, struct strarray lib_dirs, + const char *entry_point ) { unsigned int i; int is_pe = is_pe_target( opts ); @@ -952,6 +953,8 @@ static const char *build_spec_obj( struct options *opts, const char *spec_file, struct strarray tool; const char *spec_o_name, *output_name;
+ if (is_pe && !spec_file && !resources.count) return NULL; + /* get the filename from the path */ output_name = get_basename( output_file );
@@ -1021,9 +1024,7 @@ static const char *build_spec_obj( struct options *opts, const char *spec_file, strarray_add(&spec_args, strmake("-d%s", opts->delayimports.str[i])); }
- /* add resource files */ - for (i = 0; i < files.count; i++) - if (files.str[i][1] == 'r') strarray_add(&spec_args, files.str[i]); + strarray_addall(&spec_args, resources);
/* add other files */ strarray_add(&spec_args, "--"); @@ -1067,6 +1068,7 @@ static void build_data_lib( struct options *opts, const char *spec_file, const c
static void build(struct options* opts) { + struct strarray resources = empty_strarray; struct strarray lib_dirs = empty_strarray; struct strarray files = empty_strarray; struct strarray link_args; @@ -1076,7 +1078,7 @@ static void build(struct options* opts) int generate_app_loader = 1; const char *crt_lib = NULL, *entry_point = NULL; int is_pe = is_pe_target( opts ); - unsigned int j; + unsigned int i, j;
/* NOTE: for the files array we'll use the following convention: * -axxx: xxx is an archive (.a) @@ -1225,7 +1227,11 @@ static void build(struct options* opts) build_data_lib( opts, spec_file, output_file, files ); return; } - spec_o_name = build_spec_obj( opts, spec_file, output_file, files, lib_dirs, entry_point ); + + for (i = 0; i < files.count; i++) + if (files.str[i][1] == 'r') strarray_add( &resources, files.str[i] ); + + spec_o_name = build_spec_obj( opts, spec_file, output_file, files, resources, lib_dirs, entry_point );
if (opts->fake_module) return; /* nothing else to do */
Presumably the same thing would happen with a spec file that doesn't export anything. Maybe this should be handled in winebuild?
On Thu Feb 29 22:52:21 2024 +0000, Alexandre Julliard wrote:
Presumably the same thing would happen with a spec file that doesn't export anything. Maybe this should be handled in winebuild?
Fixed by !5184
This merge request was closed by Jacek Caban.