diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2025-09-04 00:52:11 +0200 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2025-09-04 01:16:27 +0200 |
| commit | 210b764c03b736a6fe025b5fac030eec0350f0df (patch) | |
| tree | f514d611bd432431fd1f06f84c33f62b061df33a /src/link/Elf/Object.zig | |
| parent | a82f446d91c9e764719d34188de5d794ee24dda8 (diff) | |
| download | zig-210b764c03b736a6fe025b5fac030eec0350f0df.tar.gz zig-210b764c03b736a6fe025b5fac030eec0350f0df.zip | |
link.Elf: truncate st_other to u3 before converting to std.elf.STV
See 6b6e336e07308fd23f3061b5be11407956b2a460 for context, but note that in
gABI 4.3, 3 bits are reserved for the visibility, up from the previous 2.
Diffstat (limited to 'src/link/Elf/Object.zig')
| -rw-r--r-- | src/link/Elf/Object.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/link/Elf/Object.zig b/src/link/Elf/Object.zig index eddb5c90dd..9e1bd022ba 100644 --- a/src/link/Elf/Object.zig +++ b/src/link/Elf/Object.zig @@ -634,7 +634,7 @@ pub fn claimUnresolved(self: *Object, elf_file: *Elf) void { const is_import = blk: { if (!elf_file.isEffectivelyDynLib()) break :blk false; - const vis = @as(elf.STV, @enumFromInt(esym.st_other)); + const vis: elf.STV = @enumFromInt(@as(u3, @truncate(esym.st_other))); if (vis == .HIDDEN) break :blk false; break :blk true; }; @@ -707,7 +707,7 @@ pub fn markImportsExports(self: *Object, elf_file: *Elf) void { const file = sym.file(elf_file).?; // https://github.com/ziglang/zig/issues/21678 if (@as(u16, @bitCast(sym.version_index)) == @as(u16, @bitCast(elf.Versym.LOCAL))) continue; - const vis: elf.STV = @enumFromInt(sym.elfSym(elf_file).st_other); + const vis: elf.STV = @enumFromInt(@as(u3, @truncate(sym.elfSym(elf_file).st_other))); if (vis == .HIDDEN) continue; if (file == .shared_object and !sym.isAbs(elf_file)) { sym.flags.import = true; |
