zig cc: Add support for -z

This is only the first step; it makes zig cc recognize -z and append it to the linker args, but the linker arg parsing doesn't support -z yet so it will just give the warning 'unsupported linker arg: -z'
This commit is contained in:
Ryan Liptak 2020-03-28 00:35:54 -07:00
parent b0b29b8a2f
commit 874b4618ca
5 changed files with 18 additions and 1 deletions

View File

@ -4255,7 +4255,14 @@ flagpd1("fno-whole-file"),
flagpd1("fwhole-program"),
flagpd1("fno-whole-program"),
flagpd1("whyload"),
sepd1("z"),
.{
.name = "z",
.syntax = .separate,
.zig_equivalent = .linker_input_z,
.pd1 = true,
.pd2 = false,
.psl = false,
},
joinpd1("fsanitize-undefined-strip-path-components="),
joinpd1("fopenmp-cuda-teams-reduction-recs-num="),
joinpd1("analyzer-config-compatibility-mode="),

View File

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

View File

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

View File

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

View File

@ -90,6 +90,10 @@ const known_options = [_]KnownOpt{
.name = "for-linker=",
.ident = "for_linker",
},
.{
.name = "z",
.ident = "linker_input_z",
},
.{
.name = "E",
.ident = "preprocess",