Commit 66ff56c58f
Changed files (2)
src
link
MachO
src/link/MachO/Object.zig
@@ -388,9 +388,19 @@ pub fn parseSymbols(self: *Object) !void {
}
if (sym.n_value != 0) {
- const comm_size = sym.n_value;
- const comm_align = (sym.n_desc >> 8) & 0x0f;
- log.err("Common symbol {s} in {s}: size 0x{x}, align 0x{x}", .{ sym_name, self.name.?, comm_size, comm_align });
+ const tentative = try self.allocator.create(Symbol.Tentative);
+ errdefer self.allocator.destroy(tentative);
+ tentative.* = .{
+ .base = .{
+ .@"type" = .tentative,
+ .name = name,
+ },
+ .size = sym.n_value,
+ .alignment = (sym.n_desc >> 8) & 0x0f,
+ .file = self,
+ };
+
+ log.err("Common symbol {s} in {s}: {}", .{ sym_name, self.name.?, tentative });
return error.UnhandledSymbolType;
}
src/link/MachO/Symbol.zig
@@ -12,6 +12,7 @@ pub const Type = enum {
regular,
proxy,
unresolved,
+ tentative,
};
/// Symbol type.
@@ -94,6 +95,23 @@ pub const Unresolved = struct {
pub const base_type: Symbol.Type = .unresolved;
};
+pub const Tentative = struct {
+ base: Symbol,
+
+ /// Symbol size.
+ size: u64,
+
+ /// Symbol alignment as power of two.
+ alignment: u16,
+
+ /// File where this symbol was referenced.
+ file: *Object,
+
+ // TODO debug info?
+
+ pub const base_type: Symbol.Type = .tentative;
+};
+
pub fn deinit(base: *Symbol, allocator: *Allocator) void {
allocator.free(base.name);
}