Commit 3b7c9dd6bd
Changed files (2)
src
link
MachO
src/link/MachO/Object.zig
@@ -399,8 +399,13 @@ pub fn parseDebugInfo(self: *Object) !void {
}
} else null;
- // TODO How do we work out static, global, local?
- const tag: Stab.Tag = if (size == null) .global else .function;
+ const tag: Stab.Tag = tag: {
+ if (size != null) break :tag .function;
+ switch (sym.tag) {
+ .weak, .strong => break :tag .global,
+ else => break :tag .static,
+ }
+ };
try self.stabs.append(self.allocator, .{
.tag = tag,
.size = size,
src/link/MachO/Zld.zig
@@ -2519,7 +2519,16 @@ fn writeDebugInfo(self: *Zld) !void {
.n_value = stab.size.?,
});
},
- else => {
+ .global => {
+ try stabs.append(.{
+ .n_strx = sym.inner.n_strx,
+ .n_type = macho.N_GSYM,
+ .n_sect = 0,
+ .n_desc = 0,
+ .n_value = 0,
+ });
+ },
+ .static => {
try stabs.append(.{
.n_strx = sym.inner.n_strx,
.n_type = macho.N_STSYM,