From: Rémi Bernon rbernon@codeweavers.com
Instead of the -mwindows / -mconsole flags with MinGW. --- tools/winegcc/winegcc.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-)
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c index aed4f28616c..d98c0e18ce3 100644 --- a/tools/winegcc/winegcc.c +++ b/tools/winegcc/winegcc.c @@ -170,7 +170,6 @@ enum file_type { file_na, file_other, file_obj, file_res, file_rc, file_arh, fil static bool is_pe; static bool is_static; static bool is_shared; -static bool is_gui_app; static bool is_unicode_app; static bool is_win16_app; static bool is_arm64x; @@ -542,7 +541,6 @@ static struct strarray get_link_args( const char *output_name ) strarray_add( &flags, "-shared" ); strarray_add( &flags, "-Wl,--kill-at" ); } - else strarray_add( &flags, is_gui_app ? "-mwindows" : "-mconsole" );
if (is_unicode_app) strarray_add( &flags, "-municode" ); if (subsystem) strarray_add( &flags, strmake("-Wl,--subsystem,%s", subsystem )); @@ -607,8 +605,6 @@ static struct strarray get_link_args( const char *output_name ) strarray_add( &flags, "-Xlinker" ); strarray_add( &flags, strmake( "-subsystem:%s", subsystem ) ); } - else - strarray_add( &flags, strmake("-Wl,-subsystem:%s", is_gui_app ? "windows" : "console" ));
STRARRAY_FOR_EACH( file, &output_debug_files ) { @@ -1142,13 +1138,14 @@ static void build_spec_obj( const char *spec_file, const char *output_file, strarray_add(&spec_args, output_name); }
- if (!is_shared) + if (subsystem) { - strarray_add(&spec_args, "--subsystem"); - strarray_add(&spec_args, is_gui_app ? "windows" : "console"); - if (large_address_aware) strarray_add( &spec_args, "--large-address-aware" ); + strarray_add( &spec_args, "--subsystem" ); + strarray_add( &spec_args, subsystem ); }
+ if (!is_shared && large_address_aware) strarray_add( &spec_args, "--large-address-aware" ); + if (target.platform == PLATFORM_WINDOWS && target.cpu == CPU_i386) strarray_add(&spec_args, "--safeseh");
@@ -1158,12 +1155,6 @@ static void build_spec_obj( const char *spec_file, const char *output_file, strarray_add(&spec_args, entry_point); }
- if (subsystem) - { - strarray_add(&spec_args, "--subsystem"); - strarray_add(&spec_args, subsystem); - } - if (!is_pe) STRARRAY_FOR_EACH( imp, &delayimports ) strarray_add(&spec_args, strmake("-d%s", imp));
strarray_addall( &spec_args, resources ); @@ -1323,7 +1314,7 @@ static void build(struct strarray input_files, const char *output)
if (!wine_objdir && !nodefaultlibs) { - if (is_gui_app) + if (subsystem && !strncmp( subsystem, "windows", 7 )) { add_library(lib_dirs, &files, "shell32"); add_library(lib_dirs, &files, "comdlg32"); @@ -1781,12 +1772,12 @@ int main(int argc, char **argv) } else if (strcmp("-mwindows", args.str[i]) == 0) { - is_gui_app = true; + if (!subsystem || strncmp( subsystem, "windows", 7 )) subsystem = "windows"; raw_compiler_arg = 0; } else if (strcmp("-mconsole", args.str[i]) == 0) { - is_gui_app = false; + if (!subsystem || strncmp( subsystem, "console", 7 )) subsystem = "console"; raw_compiler_arg = 0; } else if (strcmp("-municode", args.str[i]) == 0) @@ -1861,6 +1852,7 @@ int main(int argc, char **argv) { is_shared = true; raw_compiler_arg = raw_linker_arg = 0; + if (!subsystem) subsystem = "console"; } else if (strcmp("-s", args.str[i]) == 0) {