commit 17215bd2c8debedea2b98d78b0c09cd5fe8d386a (tree)
parent 2d757c65d84337d3b0a6dbdc06074966138084a0
Author: Jakub Konka <kubkon@jakubkonka.com>
Date: Sun, 28 Jan 2024 10:02:28 +0100
macho: insert global symbol name into the correct strtab
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/link/MachO/ZigObject.zig b/src/link/MachO/ZigObject.zig
@@ -1268,7 +1268,8 @@ pub fn getGlobalSymbol(self: *ZigObject, macho_file: *MachO, name: []const u8, l
nlist.n_strx = off;
nlist.n_type = macho.N_EXT;
lookup_gop.value_ptr.* = nlist_index;
- const gop = try macho_file.getOrCreateGlobal(off);
+ const global_name_off = try macho_file.strings.insert(gpa, sym_name);
+ const gop = try macho_file.getOrCreateGlobal(global_name_off);
try self.symbols.append(gpa, gop.index);
}
return lookup_gop.value_ptr.*;