From 6b6e336e07308fd23f3061b5be11407956b2a460 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Mon, 30 Jun 2025 12:18:35 +0200 Subject: [PATCH] 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. --- lib/std/Build/Step/CheckObject.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/Build/Step/CheckObject.zig b/lib/std/Build/Step/CheckObject.zig index c2ff85c6f1..3b78258d1c 100644 --- a/lib/std/Build/Step/CheckObject.zig +++ b/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()) {