elf: create .got.plt unconditionally

This commit is contained in:
Jakub Konka
2023-11-15 19:07:09 +01:00
parent 6f3bbd5eaa
commit d771c0a7a1

View File

@@ -3394,6 +3394,14 @@ fn initSections(self: *Elf) !void {
});
}
self.got_plt_section_index = try self.addSection(.{
.name = ".got.plt",
.type = elf.SHT_PROGBITS,
.flags = elf.SHF_ALLOC | elf.SHF_WRITE,
.addralign = @alignOf(u64),
.offset = std.math.maxInt(u64),
});
const needs_rela_dyn = blk: {
if (self.got.flags.needs_rela or self.got.flags.needs_tlsld or
self.zig_got.flags.needs_rela or self.copy_rel.symbols.items.len > 0) break :blk true;
@@ -3424,13 +3432,6 @@ fn initSections(self: *Elf) !void {
.addralign = 16,
.offset = std.math.maxInt(u64),
});
self.got_plt_section_index = try self.addSection(.{
.name = ".got.plt",
.type = elf.SHT_PROGBITS,
.flags = elf.SHF_ALLOC | elf.SHF_WRITE,
.addralign = @alignOf(u64),
.offset = std.math.maxInt(u64),
});
self.rela_plt_section_index = try self.addSection(.{
.name = ".rela.plt",
.type = elf.SHT_RELA,