| author | |
| committer | |
| log | 66ff56c58f3ef71f5cc3b8392632b3ec8abec43f |
| tree | 1fa2f35826f3ede01b2355d052951c50689798ee |
| parent | 96bb81b6ef0896d0b63c54bfd5d1ac0fa267d68a |
2 files changed, 31 insertions(+), 3 deletions(-)
src/link/MachO/Object.zig+13-3| ... | ... | @@ -388,9 +388,19 @@ pub fn parseSymbols(self: *Object) !void { |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | if (sym.n_value != 0) { |
| 391 | const comm_size = sym.n_value; | |
| 392 | const comm_align = (sym.n_desc >> 8) & 0x0f; | |
| 393 | log.err("Common symbol {s} in {s}: size 0x{x}, align 0x{x}", .{ sym_name, self.name.?, comm_size, comm_align }); | |
| 391 | const tentative = try self.allocator.create(Symbol.Tentative); | |
| 392 | errdefer self.allocator.destroy(tentative); | |
| 393 | tentative.* = .{ | |
| 394 | .base = .{ | |
| 395 | .@"type" = .tentative, | |
| 396 | .name = name, | |
| 397 | }, | |
| 398 | .size = sym.n_value, | |
| 399 | .alignment = (sym.n_desc >> 8) & 0x0f, | |
| 400 | .file = self, | |
| 401 | }; | |
| 402 | ||
| 403 | log.err("Common symbol {s} in {s}: {}", .{ sym_name, self.name.?, tentative }); | |
| 394 | 404 | return error.UnhandledSymbolType; |
| 395 | 405 | } |
| 396 | 406 |
src/link/MachO/Symbol.zig+18| ... | ... | @@ -12,6 +12,7 @@ pub const Type = enum { |
| 12 | 12 | regular, |
| 13 | 13 | proxy, |
| 14 | 14 | unresolved, |
| 15 | tentative, | |
| 15 | 16 | }; |
| 16 | 17 | |
| 17 | 18 | /// Symbol type. |
| ... | ... | @@ -94,6 +95,23 @@ pub const Unresolved = struct { |
| 94 | 95 | pub const base_type: Symbol.Type = .unresolved; |
| 95 | 96 | }; |
| 96 | 97 | |
| 98 | pub const Tentative = struct { | |
| 99 | base: Symbol, | |
| 100 | ||
| 101 | /// Symbol size. | |
| 102 | size: u64, | |
| 103 | ||
| 104 | /// Symbol alignment as power of two. | |
| 105 | alignment: u16, | |
| 106 | ||
| 107 | /// File where this symbol was referenced. | |
| 108 | file: *Object, | |
| 109 | ||
| 110 | // TODO debug info? | |
| 111 | ||
| 112 | pub const base_type: Symbol.Type = .tentative; | |
| 113 | }; | |
| 114 | ||
| 97 | 115 | pub fn deinit(base: *Symbol, allocator: *Allocator) void { |
| 98 | 116 | allocator.free(base.name); |
| 99 | 117 | } |