Commit b0b29b8a2f

Ryan Liptak <squeek502@hotmail.com>
2020-03-28 07:23:56
zig cc: Add support for -Xlinker, --for-linker, --for-linker=
1 parent 12e1c6e
src/main.cpp
@@ -734,6 +734,9 @@ static int main0(int argc, char **argv) {
                 case Stage2ClangArgNoRtti:
                     cpp_rtti = false;
                     break;
+                case Stage2ClangArgForLinker:
+                    linker_args.append(buf_create_from_str(it.only_arg));
+                    break;
             }
         }
         // Parse linker args
src/stage2.h
@@ -349,6 +349,7 @@ enum Stage2ClangArg {
     Stage2ClangArgNoExceptions,
     Stage2ClangArgRtti,
     Stage2ClangArgNoRtti,
+    Stage2ClangArgForLinker,
 };
 
 // ABI warning
src-self-hosted/clang_options_data.zig
@@ -80,7 +80,14 @@ sepd1("Xassembler"),
 sepd1("Xclang"),
 sepd1("Xcuda-fatbinary"),
 sepd1("Xcuda-ptxas"),
-sepd1("Xlinker"),
+.{
+    .name = "Xlinker",
+    .syntax = .separate,
+    .zig_equivalent = .for_linker,
+    .pd1 = true,
+    .pd2 = false,
+    .psl = false,
+},
 sepd1("Xopenmp-target"),
 sepd1("Xpreprocessor"),
 flagpd1("Z"),
@@ -1563,7 +1570,7 @@ sepd1("Zlinker-input"),
 .{
     .name = "for-linker",
     .syntax = .separate,
-    .zig_equivalent = .other,
+    .zig_equivalent = .for_linker,
     .pd1 = false,
     .pd2 = true,
     .psl = false,
@@ -4887,7 +4894,7 @@ jspd1("sub_umbrella"),
 .{
     .name = "for-linker=",
     .syntax = .joined,
-    .zig_equivalent = .other,
+    .zig_equivalent = .for_linker,
     .pd1 = false,
     .pd2 = true,
     .psl = false,
src-self-hosted/stage2.zig
@@ -1289,6 +1289,7 @@ pub const ClangArgIterator = extern struct {
         no_exceptions,
         rtti,
         no_rtti,
+        for_linker,
     };
 
     const Args = struct {
tools/update_clang_options.zig
@@ -78,6 +78,18 @@ const known_options = [_]KnownOpt{
         .name = "Wl,",
         .ident = "wl",
     },
+    .{
+        .name = "Xlinker",
+        .ident = "for_linker",
+    },
+    .{
+        .name = "for-linker",
+        .ident = "for_linker",
+    },
+    .{
+        .name = "for-linker=",
+        .ident = "for_linker",
+    },
     .{
         .name = "E",
         .ident = "preprocess",