zig cc: add support for -L linker arguments

This commit is contained in:
Rejean Loyer 2020-04-01 05:22:19 -04:00 committed by Andrew Kelley
parent 783f73c7e3
commit 2b6dfdd3d4
5 changed files with 23 additions and 3 deletions

View File

@ -1658,7 +1658,7 @@ sepd1("Zlinker-input"),
.{
.name = "library-directory",
.syntax = .separate,
.zig_equivalent = .other,
.zig_equivalent = .linker_input_l,
.pd1 = false,
.pd2 = true,
.psl = false,
@ -4534,7 +4534,7 @@ joinpd1("target-sdk-version="),
.{
.name = "library-directory=",
.syntax = .joined,
.zig_equivalent = .other,
.zig_equivalent = .linker_input_l,
.pd1 = false,
.pd2 = true,
.psl = false,
@ -5632,7 +5632,14 @@ jspd1("F"),
jspd1("G"),
jspd1("I"),
jspd1("J"),
jspd1("L"),
.{
.name = "L",
.syntax = .joined_or_separate,
.zig_equivalent = .linker_input_l,
.pd1 = true,
.pd2 = false,
.psl = false,
},
.{
.name = "O",
.syntax = .joined,

View File

@ -1288,6 +1288,7 @@ pub const ClangArgIterator = extern struct {
verbose_cmds,
for_linker,
linker_input_z,
linker_input_l,
};
const Args = struct {

View File

@ -735,6 +735,9 @@ static int main0(int argc, char **argv) {
linker_args.append(buf_create_from_str("-z"));
linker_args.append(buf_create_from_str(it.only_arg));
break;
case Stage2ClangArgLinkerInputL:
lib_dirs.append(it.only_arg);
break;
}
}
// Parse linker args

View File

@ -347,6 +347,7 @@ enum Stage2ClangArg {
Stage2ClangArgVerboseCmds,
Stage2ClangArgForLinker,
Stage2ClangArgLinkerInputZ,
Stage2ClangArgLinkerInputL,
};
// ABI warning

View File

@ -174,6 +174,14 @@ const known_options = [_]KnownOpt{
.name = "###",
.ident = "verbose_cmds",
},
.{
.name = "L",
.ident = "linker_input_l",
},
.{
.name = "library-directory",
.ident = "linker_input_l",
},
};
const blacklisted_options = [_][]const u8{};