From 8e52d54c25b1e7a4fd71593299a85493b2262bfe Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Fri, 24 May 2024 22:32:14 +0200 Subject: [PATCH] Step/CheckObject: handle stab entries when dumping MachO symtab --- lib/std/Build/Step/CheckObject.zig | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/std/Build/Step/CheckObject.zig b/lib/std/Build/Step/CheckObject.zig index 08b3d4ae99976404e33b55211db416c561868325..fa0ccc339d3d42c61eeeb99eda7ff261b44131b4 100644 --- a/lib/std/Build/Step/CheckObject.zig +++ b/lib/std/Build/Step/CheckObject.zig @@ -1087,9 +1087,25 @@ const MachODumper = struct { try writer.writeAll(symtab_label ++ "\n"); for (ctx.symtab.items) |sym| { - if (sym.stab()) continue; const sym_name = ctx.getString(sym.n_strx); - if (sym.sect()) { + if (sym.stab()) { + const tt = switch (sym.n_type) { + macho.N_SO => "SO", + macho.N_OSO => "OSO", + macho.N_BNSYM => "BNSYM", + macho.N_ENSYM => "ENSYM", + macho.N_FUN => "FUN", + macho.N_GSYM => "GSYM", + macho.N_STSYM => "STSYM", + else => "UNKNOWN STAB", + }; + try writer.print("{x}", .{sym.n_value}); + if (sym.n_sect > 0) { + const sect = ctx.sections.items[sym.n_sect - 1]; + try writer.print(" ({s},{s})", .{ sect.segName(), sect.sectName() }); + } + try writer.print(" {s} (stab) {s}\n", .{ tt, sym_name }); + } else if (sym.sect()) { const sect = ctx.sections.items[sym.n_sect - 1]; try writer.print("{x} ({s},{s})", .{ sym.n_value, -- 2.54.0