Commit 0299ed5036

Jakub Konka <kubkon@jakubkonka.com>
2023-11-08 18:45:43
elf: fix 32bit build
1 parent 9bcb432
Changed files (1)
src
link
src/link/Elf.zig
@@ -5003,7 +5003,8 @@ fn writeSyntheticSectionsObject(self: *Elf) !void {
 
         const shdr = self.shdrs.items[sec.shndx];
 
-        const num_relocs = @divExact(shdr.sh_size, shdr.sh_entsize);
+        const num_relocs = math.cast(usize, @divExact(shdr.sh_size, shdr.sh_entsize)) orelse
+            return error.Overflow;
         var relocs = try std.ArrayList(elf.Elf64_Rela).initCapacity(gpa, num_relocs);
         defer relocs.deinit();