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"),
48674867 .psl = false,
48684868},
48694869flagpd1("w"),
4870sepd1("weak_framework"),
4871sepd1("weak_library"),
4870.{
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},
48724886sepd1("weak_reference_mismatches"),
48734887flagpd1("whatsloaded"),
48744888flagpd1("why_load"),
......@@ -6200,7 +6214,14 @@ jspd1("iquote"),
62006214 .pd2 = true,
62016215 .psl = false,
62026216},
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},
62046225.{
62056226 .name = "Ofast",
62066227 .syntax = .flag,
src/main.zig+4
......@@ -1625,6 +1625,8 @@ fn buildOutputType(
16251625 .entry => {
16261626 entry = it.only_arg;
16271627 },
1628 .weak_library => try system_libs.put(it.only_arg, .{ .weak = true }),
1629 .weak_framework => try frameworks.put(gpa, it.only_arg, .{ .weak = true }),
16281630 }
16291631 }
16301632 // Parse linker args.
......@@ -4577,6 +4579,8 @@ pub const ClangArgIterator = struct {
45774579 emit_llvm,
45784580 sysroot,
45794581 entry,
4582 weak_library,
4583 weak_framework,
45804584 };
45814585
45824586 const Args = struct {
tools/update_clang_options.zig+12
......@@ -432,6 +432,18 @@ const known_options = [_]KnownOpt{
432432 .name = "e",
433433 .ident = "entry",
434434 },
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 },
435447};
436448
437449const blacklisted_options = [_][]const u8{};