| author | |
| committer | |
| log | d95e8bc5f8c48752aed73d077e2f9c87293a6617 |
| tree | c6d9b2ff57a4fedefc2f82b0d588cedff2e0f817 |
| parent | 8afe6210e95dd4608584535e8aed882285dc2078 |
3 files changed, 28 insertions(+), 43 deletions(-)
src/link/MachO/Dylib.zig+18-29| ... | ... | @@ -348,6 +348,8 @@ fn parseFromStubV3(self: *Dylib, allocator: *Allocator, target: std.Target, lib_ |
| 348 | 348 | |
| 349 | 349 | const arch_string = @tagName(target.cpu.arch); |
| 350 | 350 | |
| 351 | log.debug("{s}", .{lib_stub.inner[0].installName()}); | |
| 352 | ||
| 351 | 353 | for (lib_stub.inner) |elem, stub_index| { |
| 352 | 354 | const stub = elem.v3; |
| 353 | 355 | if (!hasArch(stub.archs, arch_string)) continue; |
| ... | ... | @@ -370,41 +372,28 @@ fn parseFromStubV3(self: *Dylib, allocator: *Allocator, target: std.Target, lib_ |
| 370 | 372 | } |
| 371 | 373 | } |
| 372 | 374 | |
| 375 | if (exp.objc_classes) |objc_classes| { | |
| 376 | for (objc_classes) |class_name| { | |
| 377 | try self.addObjCClassSymbols(allocator, class_name); | |
| 378 | } | |
| 379 | } | |
| 380 | ||
| 373 | 381 | if (exp.re_exports) |re_exports| { |
| 374 | for (re_exports) |reexp| { | |
| 375 | if (self.symbols.contains(reexp)) continue; | |
| 376 | try self.symbols.putNoClobber(allocator, try allocator.dupe(u8, reexp), {}); | |
| 382 | for (re_exports) |lib| { | |
| 383 | if (umbrella_libs.contains(lib)) { | |
| 384 | log.debug(" | {s} <= {s}", .{ lib, lib_stub.inner[0].installName() }); | |
| 385 | continue; | |
| 386 | } | |
| 387 | ||
| 388 | log.debug(" | {s}", .{lib}); | |
| 389 | ||
| 390 | const dep_id = try Id.default(allocator, lib); | |
| 391 | try self.dependent_libs.append(allocator, dep_id); | |
| 377 | 392 | } |
| 378 | 393 | } |
| 379 | 394 | } |
| 380 | 395 | } |
| 381 | 396 | } |
| 382 | ||
| 383 | log.debug("{s}", .{lib_stub.inner[0].installName()}); | |
| 384 | ||
| 385 | // // TODO track which libs were already parsed in different steps | |
| 386 | // for (lib_stub.inner) |elem| { | |
| 387 | // const stub = elem.v3; | |
| 388 | // if (!archMatches(stub.archs, arch_string)) continue; | |
| 389 | ||
| 390 | // if (stub.reexported_libraries) |reexports| { | |
| 391 | // for (reexports) |reexp| { | |
| 392 | // if (!matcher.matches(reexp.targets)) continue; | |
| 393 | ||
| 394 | // for (reexp.libraries) |lib| { | |
| 395 | // if (umbrella_libs.contains(lib)) { | |
| 396 | // log.debug(" | {s} <= {s}", .{ lib, umbrella_lib.install_name }); | |
| 397 | // continue; | |
| 398 | // } | |
| 399 | ||
| 400 | // log.debug(" | {s}", .{lib}); | |
| 401 | ||
| 402 | // const dep_id = try Id.default(allocator, lib); | |
| 403 | // try self.dependent_libs.append(allocator, dep_id); | |
| 404 | // } | |
| 405 | // } | |
| 406 | // } | |
| 407 | // } | |
| 408 | 397 | } |
| 409 | 398 | |
| 410 | 399 | fn targetToAppleString(allocator: *Allocator, target: std.Target) ![]const u8 { |
src/link/tapi.zig+9-13| ... | ... | @@ -19,11 +19,12 @@ pub const TbdV3 = struct { |
| 19 | 19 | install_name: []const u8, |
| 20 | 20 | current_version: ?VersionField, |
| 21 | 21 | compatibility_version: ?VersionField, |
| 22 | objc_constraint: []const u8, | |
| 22 | objc_constraint: ?[]const u8, | |
| 23 | 23 | exports: ?[]const struct { |
| 24 | 24 | archs: []const []const u8, |
| 25 | 25 | re_exports: ?[]const []const u8, |
| 26 | 26 | symbols: ?[]const []const u8, |
| 27 | objc_classes: ?[]const []const u8, | |
| 27 | 28 | }, |
| 28 | 29 | }; |
| 29 | 30 | |
| ... | ... | @@ -107,10 +108,8 @@ pub const LibStub = struct { |
| 107 | 108 | // TODO clean this up. |
| 108 | 109 | lib_stub.inner = blk: { |
| 109 | 110 | err: { |
| 110 | const inner = lib_stub.yaml.parse([]TbdV4) catch |err| switch (err) { | |
| 111 | error.TypeMismatch => break :err, | |
| 112 | else => |e| return e, | |
| 113 | }; | |
| 111 | log.debug("trying to parse as []TbdV4", .{}); | |
| 112 | const inner = lib_stub.yaml.parse([]TbdV4) catch break :err; | |
| 114 | 113 | var out = try lib_stub.yaml.arena.allocator.alloc(Tbd, inner.len); |
| 115 | 114 | for (inner) |doc, i| { |
| 116 | 115 | out[i] = .{ .v4 = doc }; |
| ... | ... | @@ -119,25 +118,22 @@ pub const LibStub = struct { |
| 119 | 118 | } |
| 120 | 119 | |
| 121 | 120 | err: { |
| 122 | const inner = lib_stub.yaml.parse(TbdV4) catch |err| switch (err) { | |
| 123 | error.TypeMismatch => break :err, | |
| 124 | else => |e| return e, | |
| 125 | }; | |
| 121 | log.debug("trying to parse as TbdV4", .{}); | |
| 122 | const inner = lib_stub.yaml.parse(TbdV4) catch break :err; | |
| 126 | 123 | var out = try lib_stub.yaml.arena.allocator.alloc(Tbd, 1); |
| 127 | 124 | out[0] = .{ .v4 = inner }; |
| 128 | 125 | break :blk out; |
| 129 | 126 | } |
| 130 | 127 | |
| 131 | 128 | err: { |
| 132 | const inner = lib_stub.yaml.parse(TbdV3) catch |err| switch (err) { | |
| 133 | error.TypeMismatch => break :err, | |
| 134 | else => |e| return e, | |
| 135 | }; | |
| 129 | log.debug("trying to parse as TbdV3", .{}); | |
| 130 | const inner = lib_stub.yaml.parse(TbdV3) catch break :err; | |
| 136 | 131 | var out = try lib_stub.yaml.arena.allocator.alloc(Tbd, 1); |
| 137 | 132 | out[0] = .{ .v3 = inner }; |
| 138 | 133 | break :blk out; |
| 139 | 134 | } |
| 140 | 135 | |
| 136 | // TODO this is clunky. Perhaps an optional would be better here? | |
| 141 | 137 | return error.TypeMismatch; |
| 142 | 138 | }; |
| 143 | 139 |
src/link/tapi/yaml.zig+1-1| ... | ... | @@ -371,7 +371,7 @@ pub const Yaml = struct { |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | const unwrapped = value orelse { |
| 374 | log.err("missing struct field: {s}: {s}", .{ field.name, @typeName(field.field_type) }); | |
| 374 | log.debug("missing struct field: {s}: {s}", .{ field.name, @typeName(field.field_type) }); | |
| 375 | 375 | return error.StructFieldMissing; |
| 376 | 376 | }; |
| 377 | 377 | @field(parsed, field.name) = try self.parseValue(field.field_type, unwrapped); |