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.

This commit is contained in:
cod1r 2022-09-18 09:47:24 -05:00 committed by Veikka Tuominen
parent d987bf859e
commit 6af0eeb58d
3 changed files with 28 additions and 9 deletions

View file

@ -2480,7 +2480,14 @@ flagpd1("dwarf-ext-refs"),
}, },
sepd1("dylib_file"), sepd1("dylib_file"),
flagpd1("dylinker"), flagpd1("dylinker"),
flagpd1("dynamic"), .{
.name = "dynamic",
.syntax = .flag,
.zig_equivalent = .dynamic,
.pd1 = true,
.pd2 = false,
.psl = false,
},
.{ .{
.name = "dynamiclib", .name = "dynamiclib",
.syntax = .flag, .syntax = .flag,
@ -4028,7 +4035,7 @@ flagpd1("menable-unsafe-fp-math"),
m("menqcmd"), m("menqcmd"),
m("mexception-handling"), m("mexception-handling"),
m("mexecute-only"), m("mexecute-only"),
flagpd1("mextended-const"), m("mextended-const"),
flagpd1("mextern-sdata"), flagpd1("mextern-sdata"),
m("mf16c"), m("mf16c"),
flagpd1("mfancy-math-387"), flagpd1("mfancy-math-387"),
@ -4037,7 +4044,7 @@ flagpd1("mfix4300"),
flagpd1("mfix-and-continue"), flagpd1("mfix-and-continue"),
m("mfix-cmse-cve-2021-35465"), m("mfix-cmse-cve-2021-35465"),
m("mfix-cortex-a53-835769"), m("mfix-cortex-a53-835769"),
flagpd1("mfix-cortex-a57-aes-1742098"), m("mfix-cortex-a57-aes-1742098"),
flagpd1("mfix-cortex-a72-aes-1655431"), flagpd1("mfix-cortex-a72-aes-1655431"),
m("mfloat128"), m("mfloat128"),
sepd1("mfloat-abi"), sepd1("mfloat-abi"),
@ -4188,12 +4195,12 @@ m("mno-enqcmd"),
m("mno-exception-handling"), m("mno-exception-handling"),
flagpd1("mnoexecstack"), flagpd1("mnoexecstack"),
m("mno-execute-only"), m("mno-execute-only"),
flagpd1("mno-extended-const"), m("mno-extended-const"),
flagpd1("mno-extern-sdata"), flagpd1("mno-extern-sdata"),
m("mno-f16c"), m("mno-f16c"),
m("mno-fix-cmse-cve-2021-35465"), m("mno-fix-cmse-cve-2021-35465"),
m("mno-fix-cortex-a53-835769"), m("mno-fix-cortex-a53-835769"),
flagpd1("mno-fix-cortex-a57-aes-1742098"), m("mno-fix-cortex-a57-aes-1742098"),
flagpd1("mno-fix-cortex-a72-aes-1655431"), flagpd1("mno-fix-cortex-a72-aes-1655431"),
m("mno-float128"), m("mno-float128"),
m("mno-fma"), m("mno-fma"),
@ -4272,7 +4279,7 @@ m("mno-prfchw"),
m("mno-ptwrite"), m("mno-ptwrite"),
flagpd1("mno-pure-code"), flagpd1("mno-pure-code"),
m("mno-rdpid"), m("mno-rdpid"),
flagpd1("mno-rdpru"), m("mno-rdpru"),
m("mno-rdrnd"), m("mno-rdrnd"),
m("mno-rdseed"), m("mno-rdseed"),
.{ .{
@ -4382,7 +4389,7 @@ m("mptwrite"),
flagpd1("mpure-code"), flagpd1("mpure-code"),
flagpd1("mqdsp6-compat"), flagpd1("mqdsp6-compat"),
m("mrdpid"), m("mrdpid"),
flagpd1("mrdpru"), m("mrdpru"),
m("mrdrnd"), m("mrdrnd"),
m("mrdseed"), m("mrdseed"),
flagpd1("mreassociate"), flagpd1("mreassociate"),
@ -5034,7 +5041,7 @@ sepd1("stack-usage-file"),
.{ .{
.name = "static", .name = "static",
.syntax = .flag, .syntax = .flag,
.zig_equivalent = .other, .zig_equivalent = .static,
.pd1 = true, .pd1 = true,
.pd2 = true, .pd2 = true,
.psl = false, .psl = false,

View file

@ -1649,6 +1649,8 @@ fn buildOutputType(
}; };
} }
}, },
.dynamic => link_mode = .Dynamic,
.static => link_mode = .Static,
} }
} }
// Parse linker args. // Parse linker args.
@ -4678,6 +4680,8 @@ pub const ClangArgIterator = struct {
weak_framework, weak_framework,
headerpad_max_install_names, headerpad_max_install_names,
compress_debug_sections, compress_debug_sections,
dynamic,
static,
}; };
const Args = struct { const Args = struct {

View file

@ -492,6 +492,14 @@ const known_options = [_]KnownOpt{
.name = "compress-debug-sections=", .name = "compress-debug-sections=",
.ident = "compress_debug_sections", .ident = "compress_debug_sections",
}, },
.{
.name = "dynamic",
.ident = "dynamic",
},
.{
.name = "static",
.ident = "static",
},
}; };
const blacklisted_options = [_][]const u8{}; const blacklisted_options = [_][]const u8{};
@ -798,7 +806,7 @@ fn objSyntax(obj: *json.ObjectMap) ?Syntax {
} else if (std.mem.eql(u8, superclass, "CLRemainingArgsJoined")) { } else if (std.mem.eql(u8, superclass, "CLRemainingArgsJoined")) {
return .remaining_args_joined; return .remaining_args_joined;
} else if (std.mem.eql(u8, superclass, "MultiArg")) { } else if (std.mem.eql(u8, superclass, "MultiArg")) {
return .{ .multi_arg = num_args }; return Syntax{ .multi_arg = num_args };
} }
} }
const name = obj.get("Name").?.String; const name = obj.get("Name").?.String;