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"),...@@ -2480,7 +2480,14 @@ flagpd1("dwarf-ext-refs"),
2480},2480},
2481sepd1("dylib_file"),2481sepd1("dylib_file"),
2482flagpd1("dylinker"),2482flagpd1("dylinker"),
2483flagpd1("dynamic"),2483.{
2484 .name = "dynamic",
2485 .syntax = .flag,
2486 .zig_equivalent = .dynamic,
2487 .pd1 = true,
2488 .pd2 = false,
2489 .psl = false,
2490},
2484.{2491.{
2485 .name = "dynamiclib",2492 .name = "dynamiclib",
2486 .syntax = .flag,2493 .syntax = .flag,
...@@ -4028,7 +4035,7 @@ flagpd1("menable-unsafe-fp-math"),...@@ -4028,7 +4035,7 @@ flagpd1("menable-unsafe-fp-math"),
4028m("menqcmd"),4035m("menqcmd"),
4029m("mexception-handling"),4036m("mexception-handling"),
4030m("mexecute-only"),4037m("mexecute-only"),
4031flagpd1("mextended-const"),4038m("mextended-const"),
4032flagpd1("mextern-sdata"),4039flagpd1("mextern-sdata"),
4033m("mf16c"),4040m("mf16c"),
4034flagpd1("mfancy-math-387"),4041flagpd1("mfancy-math-387"),
...@@ -4037,7 +4044,7 @@ flagpd1("mfix4300"),...@@ -4037,7 +4044,7 @@ flagpd1("mfix4300"),
4037flagpd1("mfix-and-continue"),4044flagpd1("mfix-and-continue"),
4038m("mfix-cmse-cve-2021-35465"),4045m("mfix-cmse-cve-2021-35465"),
4039m("mfix-cortex-a53-835769"),4046m("mfix-cortex-a53-835769"),
4040flagpd1("mfix-cortex-a57-aes-1742098"),4047m("mfix-cortex-a57-aes-1742098"),
4041flagpd1("mfix-cortex-a72-aes-1655431"),4048flagpd1("mfix-cortex-a72-aes-1655431"),
4042m("mfloat128"),4049m("mfloat128"),
4043sepd1("mfloat-abi"),4050sepd1("mfloat-abi"),
...@@ -4188,12 +4195,12 @@ m("mno-enqcmd"),...@@ -4188,12 +4195,12 @@ m("mno-enqcmd"),
4188m("mno-exception-handling"),4195m("mno-exception-handling"),
4189flagpd1("mnoexecstack"),4196flagpd1("mnoexecstack"),
4190m("mno-execute-only"),4197m("mno-execute-only"),
4191flagpd1("mno-extended-const"),4198m("mno-extended-const"),
4192flagpd1("mno-extern-sdata"),4199flagpd1("mno-extern-sdata"),
4193m("mno-f16c"),4200m("mno-f16c"),
4194m("mno-fix-cmse-cve-2021-35465"),4201m("mno-fix-cmse-cve-2021-35465"),
4195m("mno-fix-cortex-a53-835769"),4202m("mno-fix-cortex-a53-835769"),
4196flagpd1("mno-fix-cortex-a57-aes-1742098"),4203m("mno-fix-cortex-a57-aes-1742098"),
4197flagpd1("mno-fix-cortex-a72-aes-1655431"),4204flagpd1("mno-fix-cortex-a72-aes-1655431"),
4198m("mno-float128"),4205m("mno-float128"),
4199m("mno-fma"),4206m("mno-fma"),
...@@ -4272,7 +4279,7 @@ m("mno-prfchw"),...@@ -4272,7 +4279,7 @@ m("mno-prfchw"),
4272m("mno-ptwrite"),4279m("mno-ptwrite"),
4273flagpd1("mno-pure-code"),4280flagpd1("mno-pure-code"),
4274m("mno-rdpid"),4281m("mno-rdpid"),
4275flagpd1("mno-rdpru"),4282m("mno-rdpru"),
4276m("mno-rdrnd"),4283m("mno-rdrnd"),
4277m("mno-rdseed"),4284m("mno-rdseed"),
4278.{4285.{
...@@ -4382,7 +4389,7 @@ m("mptwrite"),...@@ -4382,7 +4389,7 @@ m("mptwrite"),
4382flagpd1("mpure-code"),4389flagpd1("mpure-code"),
4383flagpd1("mqdsp6-compat"),4390flagpd1("mqdsp6-compat"),
4384m("mrdpid"),4391m("mrdpid"),
4385flagpd1("mrdpru"),4392m("mrdpru"),
4386m("mrdrnd"),4393m("mrdrnd"),
4387m("mrdseed"),4394m("mrdseed"),
4388flagpd1("mreassociate"),4395flagpd1("mreassociate"),
...@@ -5034,7 +5041,7 @@ sepd1("stack-usage-file"),...@@ -5034,7 +5041,7 @@ sepd1("stack-usage-file"),
5034.{5041.{
5035 .name = "static",5042 .name = "static",
5036 .syntax = .flag,5043 .syntax = .flag,
5037 .zig_equivalent = .other,5044 .zig_equivalent = .static,
5038 .pd1 = true,5045 .pd1 = true,
5039 .pd2 = true,5046 .pd2 = true,
5040 .psl = false,5047 .psl = false,
src/main.zig+4
...@@ -1649,6 +1649,8 @@ fn buildOutputType(...@@ -1649,6 +1649,8 @@ fn buildOutputType(
1649 };1649 };
1650 }1650 }
1651 },1651 },
1652 .dynamic => link_mode = .Dynamic,
1653 .static => link_mode = .Static,
1652 }1654 }
1653 }1655 }
1654 // Parse linker args.1656 // Parse linker args.
...@@ -4678,6 +4680,8 @@ pub const ClangArgIterator = struct {...@@ -4678,6 +4680,8 @@ pub const ClangArgIterator = struct {
4678 weak_framework,4680 weak_framework,
4679 headerpad_max_install_names,4681 headerpad_max_install_names,
4680 compress_debug_sections,4682 compress_debug_sections,
4683 dynamic,
4684 static,
4681 };4685 };
46824686
4683 const Args = struct {4687 const Args = struct {
tools/update_clang_options.zig+9-1
...@@ -492,6 +492,14 @@ const known_options = [_]KnownOpt{...@@ -492,6 +492,14 @@ const known_options = [_]KnownOpt{
492 .name = "compress-debug-sections=",492 .name = "compress-debug-sections=",
493 .ident = "compress_debug_sections",493 .ident = "compress_debug_sections",
494 },494 },
495 .{
496 .name = "dynamic",
497 .ident = "dynamic",
498 },
499 .{
500 .name = "static",
501 .ident = "static",
502 },
495};503};
496504
497const blacklisted_options = [_][]const u8{};505const blacklisted_options = [_][]const u8{};
...@@ -798,7 +806,7 @@ fn objSyntax(obj: *json.ObjectMap) ?Syntax {...@@ -798,7 +806,7 @@ fn objSyntax(obj: *json.ObjectMap) ?Syntax {
798 } else if (std.mem.eql(u8, superclass, "CLRemainingArgsJoined")) {806 } else if (std.mem.eql(u8, superclass, "CLRemainingArgsJoined")) {
799 return .remaining_args_joined;807 return .remaining_args_joined;
800 } else if (std.mem.eql(u8, superclass, "MultiArg")) {808 } else if (std.mem.eql(u8, superclass, "MultiArg")) {
801 return .{ .multi_arg = num_args };809 return Syntax{ .multi_arg = num_args };
802 }810 }
803 }811 }
804 const name = obj.get("Name").?.String;812 const name = obj.get("Name").?.String;