From 48d37ee61f3bb08851f5947309a232fa91f290f2 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Mon, 1 Jan 2024 20:23:21 +0100 Subject: [PATCH] macho: unconditionally emit ALL local symbols in -r mode --- src/MachO/Object.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/MachO/Object.zig b/src/MachO/Object.zig index 5dbacb2f..636d4cf7 100644 --- a/src/MachO/Object.zig +++ b/src/MachO/Object.zig @@ -1024,7 +1024,9 @@ pub fn calcSymtabSize(self: *Object, macho_file: *MachO) !void { if (sym.getAtom(macho_file)) |atom| if (!atom.flags.alive) continue; if (sym.getNlist(macho_file).stab()) continue; const name = sym.getName(macho_file); - if (name.len > 0 and (name[0] == 'L' or name[0] == 'l')) continue; + // TODO in -r mode, we actually want to merge symbol names and emit only one + // work it out when emitting relocs + if (name.len > 0 and (name[0] == 'L' or name[0] == 'l') and !macho_file.options.relocatable) continue; sym.flags.output_symtab = true; if (sym.isLocal()) { try sym.addExtra(.{ .symtab = self.output_symtab_ctx.nlocals }, macho_file);