mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 21:08:36 +00:00
macho: ensure we only ever put named symbols in the symtab
This commit is contained in:
parent
3f2a0c3de4
commit
421b105d85
@ -550,6 +550,8 @@ pub fn calcSymtabSize(self: *ZigObject, macho_file: *MachO) void {
|
||||
const file = ref.getFile(macho_file) orelse continue;
|
||||
if (file.getIndex() != self.index) continue;
|
||||
if (sym.getAtom(macho_file)) |atom| if (!atom.isAlive()) continue;
|
||||
const name = sym.getName(macho_file);
|
||||
assert(name.len > 0);
|
||||
sym.flags.output_symtab = true;
|
||||
if (sym.isLocal()) {
|
||||
sym.addExtra(.{ .symtab = self.output_symtab_ctx.nlocals }, macho_file);
|
||||
@ -562,7 +564,7 @@ pub fn calcSymtabSize(self: *ZigObject, macho_file: *MachO) void {
|
||||
sym.addExtra(.{ .symtab = self.output_symtab_ctx.nimports }, macho_file);
|
||||
self.output_symtab_ctx.nimports += 1;
|
||||
}
|
||||
self.output_symtab_ctx.strsize += @as(u32, @intCast(sym.getName(macho_file).len + 1));
|
||||
self.output_symtab_ctx.strsize += @as(u32, @intCast(name.len + 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user