Commit 6b6e336e07

Alex Rønne Petersen <alex@alexrp.com>
2025-06-30 12:18:35
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.
1 parent b64fe53
Changed files (1)
lib
std
Build
lib/std/Build/Step/CheckObject.zig
@@ -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()) {