diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2024-02-13 17:24:46 +0100 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2024-02-13 20:33:08 +0100 |
| commit | 216a5594f62aca7524012e0a2bbf226c4064fae4 (patch) | |
| tree | db3497aaf292af43f3dffbabfa124a678c176363 /src/link/Elf/Object.zig | |
| parent | e401930fa862e3b9b3eedc8eb405c501fbf3de30 (diff) | |
| download | zig-216a5594f62aca7524012e0a2bbf226c4064fae4.tar.gz zig-216a5594f62aca7524012e0a2bbf226c4064fae4.zip | |
elf: use u32 for all section indexes
Diffstat (limited to 'src/link/Elf/Object.zig')
| -rw-r--r-- | src/link/Elf/Object.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/link/Elf/Object.zig b/src/link/Elf/Object.zig index 246fd9a155..395e6680a1 100644 --- a/src/link/Elf/Object.zig +++ b/src/link/Elf/Object.zig @@ -126,7 +126,7 @@ fn parseCommon(self: *Object, allocator: Allocator, handle: std.fs.File, elf_fil try self.strtab.appendSlice(allocator, shstrtab); const symtab_index = for (self.shdrs.items, 0..) |shdr, i| switch (shdr.sh_type) { - elf.SHT_SYMTAB => break @as(u16, @intCast(i)), + elf.SHT_SYMTAB => break @as(u32, @intCast(i)), else => {}, } else null; @@ -223,7 +223,7 @@ fn initAtoms(self: *Object, allocator: Allocator, handle: std.fs.File, elf_file: => {}, else => { - const shndx = @as(u16, @intCast(i)); + const shndx = @as(u32, @intCast(i)); if (self.skipShdr(shndx, elf_file)) continue; try self.addAtom(allocator, handle, shdr, shndx, elf_file); }, @@ -268,7 +268,7 @@ fn addAtom(self: *Object, allocator: Allocator, handle: std.fs.File, shdr: elf.E } } -fn initOutputSection(self: Object, elf_file: *Elf, shdr: elf.Elf64_Shdr) error{OutOfMemory}!u16 { +fn initOutputSection(self: Object, elf_file: *Elf, shdr: elf.Elf64_Shdr) error{OutOfMemory}!u32 { const name = blk: { const name = self.getString(shdr.sh_name); if (elf_file.base.isRelocatable()) break :blk name; @@ -316,7 +316,7 @@ fn initOutputSection(self: Object, elf_file: *Elf, shdr: elf.Elf64_Shdr) error{O return out_shndx; } -fn skipShdr(self: *Object, index: u16, elf_file: *Elf) bool { +fn skipShdr(self: *Object, index: u32, elf_file: *Elf) bool { const comp = elf_file.base.comp; const shdr = self.shdrs.items[index]; const name = self.getString(shdr.sh_name); @@ -673,7 +673,7 @@ pub fn convertCommonSymbols(self: *Object, elf_file: *Elf) !void { var sh_flags: u32 = elf.SHF_ALLOC | elf.SHF_WRITE; if (is_tls) sh_flags |= elf.SHF_TLS; - const shndx = @as(u16, @intCast(self.shdrs.items.len)); + const shndx = @as(u32, @intCast(self.shdrs.items.len)); const shdr = try self.shdrs.addOne(gpa); const sh_size = math.cast(usize, this_sym.st_size) orelse return error.Overflow; shdr.* = .{ |
