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

This commit is contained in:
Ryan Liptak 2020-03-27 23:23:56 -07:00
parent 12e1c6e21c
commit b0b29b8a2f
5 changed files with 27 additions and 3 deletions

View File

@ -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,

View File

@ -1289,6 +1289,7 @@ pub const ClangArgIterator = extern struct {
no_exceptions,
rtti,
no_rtti,
for_linker,
};
const Args = struct {

View File

@ -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

View File

@ -349,6 +349,7 @@ enum Stage2ClangArg {
Stage2ClangArgNoExceptions,
Stage2ClangArgRtti,
Stage2ClangArgNoRtti,
Stage2ClangArgForLinker,
};
// ABI warning

View File

@ -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",