From 17215bd2c8debedea2b98d78b0c09cd5fe8d386a Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Sun, 28 Jan 2024 10:02:28 +0100 Subject: [PATCH] macho: insert global symbol name into the correct strtab --- src/link/MachO/ZigObject.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/link/MachO/ZigObject.zig b/src/link/MachO/ZigObject.zig index 604322eedf..3b40b52ce3 100644 --- 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.*;