zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit b0b29b8a2fe57cb501248c1022a24092f4f56f82 (tree)
parent 12e1c6e21c1d21238450903ad7f8fa4ce52ee758
Author: Ryan Liptak <squeek502@hotmail.com>
Date:   Fri, 27 Mar 2020 23:23:56 -0700

zig cc: Add support for -Xlinker, --for-linker, --for-linker=

Diffstat:
Msrc-self-hosted/clang_options_data.zig | 13++++++++++---
Msrc-self-hosted/stage2.zig | 1+
Msrc/main.cpp | 3+++
Msrc/stage2.h | 1+
Mtools/update_clang_options.zig | 12++++++++++++
5 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/src-self-hosted/clang_options_data.zig b/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, diff --git a/src-self-hosted/stage2.zig b/src-self-hosted/stage2.zig @@ -1289,6 +1289,7 @@ pub const ClangArgIterator = extern struct { no_exceptions, rtti, no_rtti, + for_linker, }; const Args = struct { diff --git a/src/main.cpp b/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 diff --git a/src/stage2.h b/src/stage2.h @@ -349,6 +349,7 @@ enum Stage2ClangArg { Stage2ClangArgNoExceptions, Stage2ClangArgRtti, Stage2ClangArgNoRtti, + Stage2ClangArgForLinker, }; // ABI warning diff --git a/tools/update_clang_options.zig b/tools/update_clang_options.zig @@ -79,6 +79,18 @@ const known_options = [_]KnownOpt{ .ident = "wl", }, .{ + .name = "Xlinker", + .ident = "for_linker", + }, + .{ + .name = "for-linker", + .ident = "for_linker", + }, + .{ + .name = "for-linker=", + .ident = "for_linker", + }, + .{ .name = "E", .ident = "preprocess", },