mirror of
https://github.com/ziglang/zig.git
synced 2026-01-06 21:43:25 +00:00
Merge pull request #4838 from squeek502/for-linker
zig cc: Add support for -Xlinker, --for-linker, --for-linker=, -z
This commit is contained in:
commit
f9db21f03e
@ -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,
|
||||
@ -2547,7 +2554,14 @@ flagpd1("femulated-tls"),
|
||||
flagpd1("fencode-extended-block-signature"),
|
||||
sepd1("ferror-limit"),
|
||||
flagpd1("fescaping-block-tail-calls"),
|
||||
flagpd1("fexceptions"),
|
||||
.{
|
||||
.name = "fexceptions",
|
||||
.syntax = .flag,
|
||||
.zig_equivalent = .exceptions,
|
||||
.pd1 = true,
|
||||
.pd2 = false,
|
||||
.psl = false,
|
||||
},
|
||||
flagpd1("fexperimental-isel"),
|
||||
flagpd1("fexperimental-new-constant-interpreter"),
|
||||
flagpd1("fexperimental-new-pass-manager"),
|
||||
@ -2751,7 +2765,14 @@ flagpd1("fno-elide-type"),
|
||||
flagpd1("fno-eliminate-unused-debug-symbols"),
|
||||
flagpd1("fno-emulated-tls"),
|
||||
flagpd1("fno-escaping-block-tail-calls"),
|
||||
flagpd1("fno-exceptions"),
|
||||
.{
|
||||
.name = "fno-exceptions",
|
||||
.syntax = .flag,
|
||||
.zig_equivalent = .no_exceptions,
|
||||
.pd1 = true,
|
||||
.pd2 = false,
|
||||
.psl = false,
|
||||
},
|
||||
flagpd1("fno-experimental-isel"),
|
||||
flagpd1("fno-experimental-new-pass-manager"),
|
||||
flagpd1("fno-fast-math"),
|
||||
@ -2840,7 +2861,14 @@ flagpd1("fno-rewrite-includes"),
|
||||
flagpd1("fno-ropi"),
|
||||
flagpd1("fno-rounding-math"),
|
||||
flagpd1("fno-rtlib-add-rpath"),
|
||||
flagpd1("fno-rtti"),
|
||||
.{
|
||||
.name = "fno-rtti",
|
||||
.syntax = .flag,
|
||||
.zig_equivalent = .no_rtti,
|
||||
.pd1 = true,
|
||||
.pd2 = false,
|
||||
.psl = false,
|
||||
},
|
||||
flagpd1("fno-rtti-data"),
|
||||
flagpd1("fno-rwpi"),
|
||||
flagpd1("fno-sanitize-address-poison-custom-array-cookie"),
|
||||
@ -2988,7 +3016,14 @@ flagpd1("fno-frontend-optimize"),
|
||||
flagpd1("fropi"),
|
||||
flagpd1("frounding-math"),
|
||||
flagpd1("frtlib-add-rpath"),
|
||||
flagpd1("frtti"),
|
||||
.{
|
||||
.name = "frtti",
|
||||
.syntax = .flag,
|
||||
.zig_equivalent = .rtti,
|
||||
.pd1 = true,
|
||||
.pd2 = false,
|
||||
.psl = false,
|
||||
},
|
||||
flagpd1("frwpi"),
|
||||
flagpd1("fsanitize-address-globals-dead-stripping"),
|
||||
flagpd1("fsanitize-address-poison-custom-array-cookie"),
|
||||
@ -4248,7 +4283,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="),
|
||||
@ -4887,7 +4929,7 @@ jspd1("sub_umbrella"),
|
||||
.{
|
||||
.name = "for-linker=",
|
||||
.syntax = .joined,
|
||||
.zig_equivalent = .other,
|
||||
.zig_equivalent = .for_linker,
|
||||
.pd1 = false,
|
||||
.pd2 = true,
|
||||
.psl = false,
|
||||
|
||||
@ -1289,6 +1289,8 @@ pub const ClangArgIterator = extern struct {
|
||||
no_exceptions,
|
||||
rtti,
|
||||
no_rtti,
|
||||
for_linker,
|
||||
linker_input_z,
|
||||
};
|
||||
|
||||
const Args = struct {
|
||||
|
||||
@ -734,6 +734,13 @@ 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;
|
||||
case Stage2ClangArgLinkerInputZ:
|
||||
linker_args.append(buf_create_from_str("-z"));
|
||||
linker_args.append(buf_create_from_str(it.only_arg));
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Parse linker args
|
||||
|
||||
@ -349,6 +349,8 @@ enum Stage2ClangArg {
|
||||
Stage2ClangArgNoExceptions,
|
||||
Stage2ClangArgRtti,
|
||||
Stage2ClangArgNoRtti,
|
||||
Stage2ClangArgForLinker,
|
||||
Stage2ClangArgLinkerInputZ,
|
||||
};
|
||||
|
||||
// ABI warning
|
||||
|
||||
@ -78,6 +78,22 @@ 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 = "z",
|
||||
.ident = "linker_input_z",
|
||||
},
|
||||
.{
|
||||
.name = "E",
|
||||
.ident = "preprocess",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user