mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 21:08:36 +00:00
macho: gracefully handle uninitialized symtabs in objects
This commit is contained in:
parent
2c2ff4558f
commit
5823f19c5e
@ -515,8 +515,9 @@ pub fn getSourceSymbol(self: Object, index: u32) ?macho.nlist_64 {
|
||||
}
|
||||
|
||||
/// Caller owns memory.
|
||||
pub fn createReverseSymbolLookup(self: Object, gpa: Allocator) ![]u32 {
|
||||
const lookup = try gpa.alloc(u32, self.in_symtab.?.len);
|
||||
pub fn createReverseSymbolLookup(self: Object, arena: Allocator) ![]u32 {
|
||||
const symtab = self.in_symtab orelse return &[0]u32{};
|
||||
const lookup = try arena.alloc(u32, symtab.len);
|
||||
for (self.source_symtab_lookup) |source_id, id| {
|
||||
lookup[source_id] = @intCast(u32, id);
|
||||
}
|
||||
|
||||
@ -3486,6 +3486,7 @@ pub const Zld = struct {
|
||||
scoped_log.debug("locals:", .{});
|
||||
for (self.objects.items) |object, id| {
|
||||
scoped_log.debug(" object({d}): {s}", .{ id, object.name });
|
||||
if (object.in_symtab == null) continue;
|
||||
for (object.symtab) |sym, sym_id| {
|
||||
mem.set(u8, &buf, '_');
|
||||
scoped_log.debug(" %{d}: {s} @{x} in sect({d}), {s}", .{
|
||||
@ -3641,7 +3642,7 @@ pub const Zld = struct {
|
||||
sym.n_sect,
|
||||
});
|
||||
|
||||
if (atom.getFile() != null) {
|
||||
if (atom.getFile() != null) {
|
||||
var it = Atom.getInnerSymbolsIterator(self, atom_index);
|
||||
while (it.next()) |sym_loc| {
|
||||
const inner = self.getSymbol(sym_loc);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user