[PATCH 2/5] winegcc: Handle -Wl,--subsystem.

Zebediah Figura z.figura12 at gmail.com
Mon Apr 30 13:59:55 CDT 2018


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 tools/winegcc/winegcc.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index 4be35d5..f628ff2 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -210,6 +210,7 @@ struct options
     const char* image_base;
     const char* section_align;
     const char* lib_suffix;
+    const char* subsystem;
     strarray* prefix;
     strarray* lib_dirs;
     strarray* linker_args;
@@ -916,6 +917,9 @@ static void build(struct options* opts)
             if (opts->nodefaultlibs) strarray_add(link_args, "-nodefaultlibs");
         }
 
+        if (opts->subsystem)
+            strarray_add(link_args, strmake("-Wl,--subsystem,%s", opts->subsystem));
+
         for ( j = 0 ; j < opts->linker_args->size ; j++ )
             strarray_add(link_args, opts->linker_args->base[j]);
 
@@ -1070,6 +1074,12 @@ static void build(struct options* opts)
         if (opts->large_address_aware) strarray_add( spec_args, "--large-address-aware" );
     }
 
+    if (opts->subsystem)
+    {
+        strarray_add(spec_args, "--subsystem");
+        strarray_add(spec_args, opts->subsystem);
+    }
+
     for ( j = 0; j < lib_dirs->size; j++ )
 	strarray_add(spec_args, strmake("-L%s", lib_dirs->base[j]));
 
@@ -1600,6 +1610,11 @@ int main(int argc, char **argv)
                                 opts.large_address_aware = 1;
                                 continue;
                             }
+                            if (!strcmp(Wl->base[j], "--subsystem") && j < Wl->size - 1)
+                            {
+                                opts.subsystem = strdup( Wl->base[++j] );
+                                continue;
+                            }
                             if (!strcmp(Wl->base[j], "-static")) linking = -1;
                             strarray_add(opts.linker_args, strmake("-Wl,%s",Wl->base[j]));
                         }
-- 
2.7.4




More information about the wine-devel mailing list