[PATCH v3 2/5] winegcc: Support -Wl, --strip-debug for stripping debug info only.

Rémi Bernon rbernon at codeweavers.com
Wed Oct 9 02:47:10 CDT 2019


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 tools/winegcc/winegcc.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index 893ad1021ea..d1440a64367 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -209,6 +209,7 @@ struct options
     int wine_builtin;
     int unwind_tables;
     int strip;
+    int strip_debug;
     int pic;
     const char* wine_objdir;
     const char* winebuild;
@@ -1256,6 +1257,8 @@ static void build(struct options* opts)
 
     if (opts->target_platform != PLATFORM_APPLE && !is_pe && opts->strip)
         strarray_add(link_args, "-s");
+    else if (!is_pe && opts->strip_debug)
+        strarray_add(link_args, "-Wl,--strip-debug");
 
     spawn(opts->prefix, link_args, 0);
     strarray_free (link_args);
@@ -1268,6 +1271,14 @@ static void build(struct options* opts)
         spawn(opts->prefix, strip_args, 1);
         strarray_free(strip_args);
     }
+    else if (is_pe && opts->strip_debug)
+    {
+        strarray *strip_args = strarray_fromstring(build_tool_name(opts, "strip", "strip"), " ");
+        strarray_add(strip_args, "--strip-debug");
+        strarray_add(strip_args, output_path);
+        spawn(opts->prefix, strip_args, 1);
+        strarray_free(strip_args);
+    }
 
     if (is_pe && opts->wine_builtin) make_wine_builtin( output_path );
 
@@ -1683,6 +1694,11 @@ int main(int argc, char **argv)
                                 opts.strip = 1;
                                 continue;
                             }
+                            if (!strcmp(Wl->base[j], "--strip-debug") || !strcmp(Wl->base[j], "-S"))
+                            {
+                                opts.strip_debug = 1;
+                                continue;
+                            }
                             if (!strcmp(Wl->base[j], "--subsystem") && j < Wl->size - 1)
                             {
                                 opts.subsystem = strdup( Wl->base[++j] );
-- 
2.23.0




More information about the wine-devel mailing list