Commit 6cbe589b51

Andrew Kelley <andrew@ziglang.org>
2020-03-25 17:05:33
zig cc: support -T linker script option
1 parent 3869e80
src/main.cpp
@@ -704,6 +704,9 @@ static int main0(int argc, char **argv) {
                         }
                     }
                     break;
+                case Stage2ClangArgLinkerScript:
+                    linker_script = it.only_arg;
+                    break;
             }
         }
         // Parse linker args
src/stage2.h
@@ -340,6 +340,7 @@ enum Stage2ClangArg {
     Stage2ClangArgOptimize,
     Stage2ClangArgDebug,
     Stage2ClangArgSanitize,
+    Stage2ClangArgLinkerScript,
 };
 
 // ABI warning
src-self-hosted/clang_options_data.zig
@@ -5614,7 +5614,14 @@ jspd1("L"),
     .psl = false,
 },
 joinpd1("R"),
-jspd1("T"),
+.{
+    .name = "T",
+    .syntax = .joined_or_separate,
+    .zig_equivalent = .linker_script,
+    .pd1 = true,
+    .pd2 = false,
+    .psl = false,
+},
 jspd1("U"),
 jspd1("V"),
 joinpd1("W"),
src-self-hosted/stage2.zig
@@ -1278,6 +1278,7 @@ pub const ClangArgIterator = extern struct {
         optimize,
         debug,
         sanitize,
+        linker_script,
     };
 
     fn init(argv: []const [*:0]const u8) ClangArgIterator {
tools/update_clang_options.zig
@@ -146,6 +146,10 @@ const known_options = [_]KnownOpt{
         .name = "fsanitize",
         .ident = "sanitize",
     },
+    .{
+        .name = "T",
+        .ident = "linker_script",
+    },
 };
 
 const blacklisted_options = [_][]const u8{};