mirror of
https://github.com/ziglang/zig.git
synced 2026-01-01 02:53:23 +00:00
zld: add Symbol.Tentative to denote common symbol
This commit is contained in:
parent
96bb81b6ef
commit
66ff56c58f
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user