| author | |
| committer | |
| log | bb3e1bcf31bdf9306030e797ed673021c7766d58 |
| tree | 9f69c650687742302e1a7a4760018439ad27680a |
| parent | 41533fa6a1fa5e9e9b38a59403930501fd61a259 |
| parent | c2c1998269f8a92e39c14dabb68b253c012d56ef |
| signature |
macho: weak libraries and frameworks fixes4 files changed, 42 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 | }, |
| 4869 | flagpd1("w"), | 4869 | flagpd1("w"), |
| 4870 | sepd1("weak_framework"), | 4870 | .{ |
| 4871 | sepd1("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 | }, | ||
| 4872 | sepd1("weak_reference_mismatches"), | 4886 | sepd1("weak_reference_mismatches"), |
| 4873 | flagpd1("whatsloaded"), | 4887 | flagpd1("whatsloaded"), |
| 4874 | flagpd1("why_load"), | 4888 | flagpd1("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 | }, |
| 6203 | joinpd1("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/link.zig+2| ... | @@ -19,6 +19,7 @@ const Package = @import("Package.zig"); | ... | @@ -19,6 +19,7 @@ const Package = @import("Package.zig"); |
| 19 | const Type = @import("type.zig").Type; | 19 | const Type = @import("type.zig").Type; |
| 20 | const TypedValue = @import("TypedValue.zig"); | 20 | const TypedValue = @import("TypedValue.zig"); |
| 21 | 21 | ||
| 22 | /// When adding a new field, remember to update `hashAddSystemLibs`. | ||
| 22 | pub const SystemLib = struct { | 23 | pub const SystemLib = struct { |
| 23 | needed: bool = false, | 24 | needed: bool = false, |
| 24 | weak: bool = false, | 25 | weak: bool = false, |
| ... | @@ -35,6 +36,7 @@ pub fn hashAddSystemLibs( | ... | @@ -35,6 +36,7 @@ pub fn hashAddSystemLibs( |
| 35 | hh.addListOfBytes(keys); | 36 | hh.addListOfBytes(keys); |
| 36 | for (hm.values()) |value| { | 37 | for (hm.values()) |value| { |
| 37 | hh.add(value.needed); | 38 | hh.add(value.needed); |
| 39 | hh.add(value.weak); | ||
| 38 | } | 40 | } |
| 39 | } | 41 | } |
| 40 | 42 |
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 | }; |
| 4581 | 4585 | ||
| 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 | }; |
| 436 | 448 | ||
| 437 | const blacklisted_options = [_][]const u8{}; | 449 | const blacklisted_options = [_][]const u8{}; |