authorgravatar for jasonho353@gmail.comcod1r <jasonho353@gmail.com> 2022-09-18 09:47:24-05:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-10-13 13:12:17+02:00
log6af0eeb58d1d220d407ce4c463eaeb25b35f2761
treeccf73504ea6c7aa29c89938df36742c279a00b9a
parentd987bf859e6d8511abb49b258c4d764bd32acc8e

adding `static` and `dynamic` ZigEquivalent enums so that we can branch to set `link_mode` properly when we iterate over the clang arguments. also replaced `dynamic` flag in clang_options_data.zig with proper definition similarly to `static`.


3 files changed, 28 insertions(+), 9 deletions(-)

src/clang_options_data.zig+15-8
......@@ -2480,7 +2480,14 @@ flagpd1("dwarf-ext-refs"),
24802480},
24812481sepd1("dylib_file"),
24822482flagpd1("dylinker"),
2483flagpd1("dynamic"),
2483.{
2484 .name = "dynamic",
2485 .syntax = .flag,
2486 .zig_equivalent = .dynamic,
2487 .pd1 = true,
2488 .pd2 = false,
2489 .psl = false,
2490},
24842491.{
24852492 .name = "dynamiclib",
24862493 .syntax = .flag,
......@@ -4028,7 +4035,7 @@ flagpd1("menable-unsafe-fp-math"),
40284035m("menqcmd"),
40294036m("mexception-handling"),
40304037m("mexecute-only"),
4031flagpd1("mextended-const"),
4038m("mextended-const"),
40324039flagpd1("mextern-sdata"),
40334040m("mf16c"),
40344041flagpd1("mfancy-math-387"),
......@@ -4037,7 +4044,7 @@ flagpd1("mfix4300"),
40374044flagpd1("mfix-and-continue"),
40384045m("mfix-cmse-cve-2021-35465"),
40394046m("mfix-cortex-a53-835769"),
4040flagpd1("mfix-cortex-a57-aes-1742098"),
4047m("mfix-cortex-a57-aes-1742098"),
40414048flagpd1("mfix-cortex-a72-aes-1655431"),
40424049m("mfloat128"),
40434050sepd1("mfloat-abi"),
......@@ -4188,12 +4195,12 @@ m("mno-enqcmd"),
41884195m("mno-exception-handling"),
41894196flagpd1("mnoexecstack"),
41904197m("mno-execute-only"),
4191flagpd1("mno-extended-const"),
4198m("mno-extended-const"),
41924199flagpd1("mno-extern-sdata"),
41934200m("mno-f16c"),
41944201m("mno-fix-cmse-cve-2021-35465"),
41954202m("mno-fix-cortex-a53-835769"),
4196flagpd1("mno-fix-cortex-a57-aes-1742098"),
4203m("mno-fix-cortex-a57-aes-1742098"),
41974204flagpd1("mno-fix-cortex-a72-aes-1655431"),
41984205m("mno-float128"),
41994206m("mno-fma"),
......@@ -4272,7 +4279,7 @@ m("mno-prfchw"),
42724279m("mno-ptwrite"),
42734280flagpd1("mno-pure-code"),
42744281m("mno-rdpid"),
4275flagpd1("mno-rdpru"),
4282m("mno-rdpru"),
42764283m("mno-rdrnd"),
42774284m("mno-rdseed"),
42784285.{
......@@ -4382,7 +4389,7 @@ m("mptwrite"),
43824389flagpd1("mpure-code"),
43834390flagpd1("mqdsp6-compat"),
43844391m("mrdpid"),
4385flagpd1("mrdpru"),
4392m("mrdpru"),
43864393m("mrdrnd"),
43874394m("mrdseed"),
43884395flagpd1("mreassociate"),
......@@ -5034,7 +5041,7 @@ sepd1("stack-usage-file"),
50345041.{
50355042 .name = "static",
50365043 .syntax = .flag,
5037 .zig_equivalent = .other,
5044 .zig_equivalent = .static,
50385045 .pd1 = true,
50395046 .pd2 = true,
50405047 .psl = false,
src/main.zig+4
......@@ -1649,6 +1649,8 @@ fn buildOutputType(
16491649 };
16501650 }
16511651 },
1652 .dynamic => link_mode = .Dynamic,
1653 .static => link_mode = .Static,
16521654 }
16531655 }
16541656 // Parse linker args.
......@@ -4678,6 +4680,8 @@ pub const ClangArgIterator = struct {
46784680 weak_framework,
46794681 headerpad_max_install_names,
46804682 compress_debug_sections,
4683 dynamic,
4684 static,
46814685 };
46824686
46834687 const Args = struct {
tools/update_clang_options.zig+9-1
......@@ -492,6 +492,14 @@ const known_options = [_]KnownOpt{
492492 .name = "compress-debug-sections=",
493493 .ident = "compress_debug_sections",
494494 },
495 .{
496 .name = "dynamic",
497 .ident = "dynamic",
498 },
499 .{
500 .name = "static",
501 .ident = "static",
502 },
495503};
496504
497505const blacklisted_options = [_][]const u8{};
......@@ -798,7 +806,7 @@ fn objSyntax(obj: *json.ObjectMap) ?Syntax {
798806 } else if (std.mem.eql(u8, superclass, "CLRemainingArgsJoined")) {
799807 return .remaining_args_joined;
800808 } else if (std.mem.eql(u8, superclass, "MultiArg")) {
801 return .{ .multi_arg = num_args };
809 return Syntax{ .multi_arg = num_args };
802810 }
803811 }
804812 const name = obj.get("Name").?.String;