mirror of
https://github.com/ziglang/zig.git
synced 2025-12-31 18:43:18 +00:00
elf: fix typo in initial section offsets
This commit is contained in:
parent
aa0fbbcb39
commit
b48baeeebb
@ -4531,7 +4531,10 @@ fn allocateAllocSectionsObject(self: *Elf) !void {
|
||||
for (self.shdrs.items) |*shdr| {
|
||||
if (shdr.sh_type == elf.SHT_NULL) continue;
|
||||
if (shdr.sh_flags & elf.SHF_ALLOC == 0) continue;
|
||||
if (shdr.sh_type == elf.SHT_NOBITS) continue;
|
||||
if (shdr.sh_type == elf.SHT_NOBITS) {
|
||||
shdr.sh_offset = 0;
|
||||
continue;
|
||||
}
|
||||
const needed_size = shdr.sh_size;
|
||||
if (needed_size > self.allocatedSize(shdr.sh_offset)) {
|
||||
shdr.sh_size = 0;
|
||||
|
||||
@ -251,7 +251,7 @@ fn initOutputSection(self: Object, elf_file: *Elf, shdr: ElfShdr) error{OutOfMem
|
||||
.type = @"type",
|
||||
.flags = flags,
|
||||
.name = name,
|
||||
.offset = std.math.maxInt(u32),
|
||||
.offset = std.math.maxInt(u64),
|
||||
});
|
||||
return out_shndx;
|
||||
}
|
||||
|
||||
@ -749,14 +749,14 @@ fn getDeclShdrIndex(
|
||||
.type = elf.SHT_NOBITS,
|
||||
.flags = elf.SHF_ALLOC | elf.SHF_WRITE | elf.SHF_TLS,
|
||||
.name = ".tbss",
|
||||
.offset = std.math.maxInt(u32),
|
||||
.offset = std.math.maxInt(u64),
|
||||
});
|
||||
|
||||
break :blk elf_file.sectionByName(".tdata") orelse try elf_file.addSection(.{
|
||||
.type = elf.SHT_PROGBITS,
|
||||
.flags = elf.SHF_ALLOC | elf.SHF_WRITE | elf.SHF_TLS,
|
||||
.name = ".tdata",
|
||||
.offset = std.math.maxInt(u32),
|
||||
.offset = std.math.maxInt(u64),
|
||||
});
|
||||
}
|
||||
if (variable.is_const) break :blk elf_file.zig_data_rel_ro_section_index.?;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user