std.Build.Step.CheckObject: Truncate st_other before interpreting it

Tools are free to use the upper bits of this field for whatever; thus, tools
that want to interpret the visibility type should truncate to 2 bits.
This commit is contained in:
Alex Rønne Petersen
2025-06-30 12:18:35 +02:00
parent b64fe53ad5
commit 6b6e336e07

View File

@@ -2270,7 +2270,7 @@ const ElfDumper = struct {
try writer.print(" {s}", .{sym_bind});
}
const sym_vis = @as(elf.STV, @enumFromInt(sym.st_other));
const sym_vis = @as(elf.STV, @enumFromInt(@as(u2, @truncate(sym.st_other))));
try writer.print(" {s}", .{@tagName(sym_vis)});
const sym_name = switch (sym.st_type()) {