authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-06-28 21:16:19+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-06-28 21:16:23+02:00
logc2c1998269f8a92e39c14dabb68b253c012d56ef
tree5eefcb02f0fbfbfc1ef96048e844414807622f31
parentc02dc17618637139a5fc704c5c42723984398665

clang: update cmdline options to include weak libs and frameworks

Clang accepts `-weak-lx`, `-weak_library x` and `-weak_framework x`.

3 files changed, 40 insertions(+), 3 deletions(-)

src/clang_options_data.zig+24-3
...@@ -4867,8 +4867,22 @@ flagpd1("version"),...@@ -4867,8 +4867,22 @@ flagpd1("version"),
4867 .psl = false,4867 .psl = false,
4868},4868},
4869flagpd1("w"),4869flagpd1("w"),
4870sepd1("weak_framework"),4870.{
4871sepd1("weak_library"),4871 .name = "weak_framework",
4872 .syntax = .separate,
4873 .zig_equivalent = .weak_framework,
4874 .pd1 = true,
4875 .pd2 = false,
4876 .psl = false,
4877},
4878.{
4879 .name = "weak_library",
4880 .syntax = .separate,
4881 .zig_equivalent = .weak_library,
4882 .pd1 = true,
4883 .pd2 = false,
4884 .psl = false,
4885},
4872sepd1("weak_reference_mismatches"),4886sepd1("weak_reference_mismatches"),
4873flagpd1("whatsloaded"),4887flagpd1("whatsloaded"),
4874flagpd1("why_load"),4888flagpd1("why_load"),
...@@ -6200,7 +6214,14 @@ jspd1("iquote"),...@@ -6200,7 +6214,14 @@ jspd1("iquote"),
6200 .pd2 = true,6214 .pd2 = true,
6201 .psl = false,6215 .psl = false,
6202},6216},
6203joinpd1("weak-l"),6217.{
6218 .name = "weak-l",
6219 .syntax = .joined,
6220 .zig_equivalent = .weak_library,
6221 .pd1 = true,
6222 .pd2 = false,
6223 .psl = false,
6224},
6204.{6225.{
6205 .name = "Ofast",6226 .name = "Ofast",
6206 .syntax = .flag,6227 .syntax = .flag,
src/main.zig+4
...@@ -1625,6 +1625,8 @@ fn buildOutputType(...@@ -1625,6 +1625,8 @@ fn buildOutputType(
1625 .entry => {1625 .entry => {
1626 entry = it.only_arg;1626 entry = it.only_arg;
1627 },1627 },
1628 .weak_library => try system_libs.put(it.only_arg, .{ .weak = true }),
1629 .weak_framework => try frameworks.put(gpa, it.only_arg, .{ .weak = true }),
1628 }1630 }
1629 }1631 }
1630 // Parse linker args.1632 // Parse linker args.
...@@ -4577,6 +4579,8 @@ pub const ClangArgIterator = struct {...@@ -4577,6 +4579,8 @@ pub const ClangArgIterator = struct {
4577 emit_llvm,4579 emit_llvm,
4578 sysroot,4580 sysroot,
4579 entry,4581 entry,
4582 weak_library,
4583 weak_framework,
4580 };4584 };
45814585
4582 const Args = struct {4586 const Args = struct {
tools/update_clang_options.zig+12
...@@ -432,6 +432,18 @@ const known_options = [_]KnownOpt{...@@ -432,6 +432,18 @@ const known_options = [_]KnownOpt{
432 .name = "e",432 .name = "e",
433 .ident = "entry",433 .ident = "entry",
434 },434 },
435 .{
436 .name = "weak-l",
437 .ident = "weak_library",
438 },
439 .{
440 .name = "weak_library",
441 .ident = "weak_library",
442 },
443 .{
444 .name = "weak_framework",
445 .ident = "weak_framework",
446 },
435};447};
436448
437const blacklisted_options = [_][]const u8{};449const blacklisted_options = [_][]const u8{};