mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
lib/std/Build/CheckObject: dump Mach-O symbol attributes
This commit is contained in:
parent
36981d46a3
commit
eb70c8801e
@ -923,9 +923,18 @@ const MachODumper = struct {
|
|||||||
sect.segName(),
|
sect.segName(),
|
||||||
sect.sectName(),
|
sect.sectName(),
|
||||||
});
|
});
|
||||||
|
if (sym.n_desc & macho.REFERENCED_DYNAMICALLY != 0) try writer.writeAll(" [referenced dynamically]");
|
||||||
|
if (sym.weakDef()) try writer.writeAll(" weak");
|
||||||
|
if (sym.weakRef()) try writer.writeAll(" weakref");
|
||||||
if (sym.ext()) {
|
if (sym.ext()) {
|
||||||
|
if (sym.pext()) try writer.writeAll(" private");
|
||||||
try writer.writeAll(" external");
|
try writer.writeAll(" external");
|
||||||
}
|
} else if (sym.pext()) try writer.writeAll(" (was private external)");
|
||||||
|
try writer.print(" {s}\n", .{sym_name});
|
||||||
|
} else if (sym.tentative()) {
|
||||||
|
const alignment = (sym.n_desc >> 8) & 0x0F;
|
||||||
|
try writer.print(" 0x{x:0>16} (common) (alignment 2^{d})", .{ sym.n_value, alignment });
|
||||||
|
if (sym.ext()) try writer.writeAll(" external");
|
||||||
try writer.print(" {s}\n", .{sym_name});
|
try writer.print(" {s}\n", .{sym_name});
|
||||||
} else if (sym.undf()) {
|
} else if (sym.undf()) {
|
||||||
const ordinal = @divTrunc(@as(i16, @bitCast(sym.n_desc)), macho.N_SYMBOL_RESOLVER);
|
const ordinal = @divTrunc(@as(i16, @bitCast(sym.n_desc)), macho.N_SYMBOL_RESOLVER);
|
||||||
@ -946,17 +955,13 @@ const MachODumper = struct {
|
|||||||
break :blk basename[0..ext];
|
break :blk basename[0..ext];
|
||||||
};
|
};
|
||||||
try writer.writeAll("(undefined)");
|
try writer.writeAll("(undefined)");
|
||||||
if (sym.weakRef()) {
|
if (sym.weakRef()) try writer.writeAll(" weakref");
|
||||||
try writer.writeAll(" weak");
|
if (sym.ext()) try writer.writeAll(" external");
|
||||||
}
|
|
||||||
if (sym.ext()) {
|
|
||||||
try writer.writeAll(" external");
|
|
||||||
}
|
|
||||||
try writer.print(" {s} (from {s})\n", .{
|
try writer.print(" {s} (from {s})\n", .{
|
||||||
sym_name,
|
sym_name,
|
||||||
import_name,
|
import_name,
|
||||||
});
|
});
|
||||||
} else unreachable;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -46,7 +46,7 @@ fn testUnwindInfo(
|
|||||||
}
|
}
|
||||||
|
|
||||||
check.checkInSymtab();
|
check.checkInSymtab();
|
||||||
check.checkContains("(__TEXT,__text) external ___gxx_personality_v0");
|
check.checkContains("(__TEXT,__text) private external ___gxx_personality_v0");
|
||||||
test_step.dependOn(&check.step);
|
test_step.dependOn(&check.step);
|
||||||
|
|
||||||
const run = b.addRunArtifact(exe);
|
const run = b.addRunArtifact(exe);
|
||||||
|
|||||||
@ -42,10 +42,10 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
|
|||||||
check.checkExact("name @rpath/liba.dylib");
|
check.checkExact("name @rpath/liba.dylib");
|
||||||
|
|
||||||
check.checkInSymtab();
|
check.checkInSymtab();
|
||||||
check.checkExact("(undefined) weak external _a (from liba)");
|
check.checkExact("(undefined) weakref external _a (from liba)");
|
||||||
|
|
||||||
check.checkInSymtab();
|
check.checkInSymtab();
|
||||||
check.checkExact("(undefined) weak external _asStr (from liba)");
|
check.checkExact("(undefined) weakref external _asStr (from liba)");
|
||||||
test_step.dependOn(&check.step);
|
test_step.dependOn(&check.step);
|
||||||
|
|
||||||
const run = b.addRunArtifact(exe);
|
const run = b.addRunArtifact(exe);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user