From c2c1998269f8a92e39c14dabb68b253c012d56ef Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Tue, 28 Jun 2022 21:16:19 +0200 Subject: clang: update cmdline options to include weak libs and frameworks Clang accepts `-weak-lx`, `-weak_library x` and `-weak_framework x`. --- src/clang_options_data.zig | 27 ++++++++++++++++++++++++--- src/main.zig | 4 ++++ 2 files changed, 28 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/clang_options_data.zig b/src/clang_options_data.zig index 25cdd04f82..b4bef06c9e 100644 --- a/src/clang_options_data.zig +++ b/src/clang_options_data.zig @@ -4867,8 +4867,22 @@ flagpd1("version"), .psl = false, }, flagpd1("w"), -sepd1("weak_framework"), -sepd1("weak_library"), +.{ + .name = "weak_framework", + .syntax = .separate, + .zig_equivalent = .weak_framework, + .pd1 = true, + .pd2 = false, + .psl = false, +}, +.{ + .name = "weak_library", + .syntax = .separate, + .zig_equivalent = .weak_library, + .pd1 = true, + .pd2 = false, + .psl = false, +}, sepd1("weak_reference_mismatches"), flagpd1("whatsloaded"), flagpd1("why_load"), @@ -6200,7 +6214,14 @@ jspd1("iquote"), .pd2 = true, .psl = false, }, -joinpd1("weak-l"), +.{ + .name = "weak-l", + .syntax = .joined, + .zig_equivalent = .weak_library, + .pd1 = true, + .pd2 = false, + .psl = false, +}, .{ .name = "Ofast", .syntax = .flag, diff --git a/src/main.zig b/src/main.zig index ae1b95a4aa..f13fe342ca 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1625,6 +1625,8 @@ fn buildOutputType( .entry => { entry = it.only_arg; }, + .weak_library => try system_libs.put(it.only_arg, .{ .weak = true }), + .weak_framework => try frameworks.put(gpa, it.only_arg, .{ .weak = true }), } } // Parse linker args. @@ -4577,6 +4579,8 @@ pub const ClangArgIterator = struct { emit_llvm, sysroot, entry, + weak_library, + weak_framework, }; const Args = struct { -- cgit v1.2.3