From: Rémi Bernon rbernon@codeweavers.com
--- tools/winegcc/winegcc.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c index a42cfd7a617..f473ec41f36 100644 --- a/tools/winegcc/winegcc.c +++ b/tools/winegcc/winegcc.c @@ -542,7 +542,14 @@ static struct strarray get_link_args( const char *output_name ) }
if (is_unicode_app) strarray_add( &flags, "-municode" ); - if (subsystem) strarray_add( &flags, strmake( "-Wl,--subsystem,%s", subsystem ) ); + + if (subsystem) + { + unsigned int default_minor = target.cpu == CPU_i386 || target.cpu == CPU_x86_64 ? 0 : 2; + if (!strchr( subsystem, ':' )) subsystem = strmake( "%s:6.%d", subsystem, default_minor ); + + strarray_add( &flags, strmake( "-Wl,--subsystem,%s", subsystem ) ); + }
strarray_add( &flags, "-Wl,--exclude-all-symbols" ); strarray_add( &flags, "-Wl,--nxcompat" ); @@ -600,8 +607,11 @@ static struct strarray get_link_args( const char *output_name )
if (subsystem) { - char *version = strchr( subsystem, ':' ); - if (version) subsystem = strmake( "%.*s,%s", (int)(version - subsystem), subsystem, version + 1 ); + unsigned int default_minor = target.cpu == CPU_i386 || target.cpu == CPU_x86_64 ? 0 : 2; + char *version; + + if (!(version = strchr( subsystem, ':' ))) subsystem = strmake( "%s,6.%d", subsystem, default_minor ); + else subsystem = strmake( "%.*s,%s", (int)(version - subsystem), subsystem, version + 1 );
strarray_add( &flags, "-Xlinker" ); strarray_add( &flags, strmake( "-subsystem:%s", subsystem ) ); @@ -1141,6 +1151,9 @@ static void build_spec_obj( const char *spec_file, const char *output_file,
if (subsystem) { + unsigned int default_minor = target.cpu == CPU_i386 || target.cpu == CPU_x86_64 ? 0 : 2; + if (!strchr( subsystem, ':' )) subsystem = strmake( "%s:6.%d", subsystem, default_minor ); + strarray_add( &spec_args, "--subsystem" ); strarray_add( &spec_args, subsystem ); }