authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-11-15 19:07:09+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-11-15 19:07:09+01:00
logd771c0a7a19a4d39e1541afa0bf69935daa5222e
tree07231ef69618a74c0884d2198269afb966474cc4
parent6f3bbd5eaa61a93f96245bfec8d9429f4ea9f88e

elf: create .got.plt unconditionally


1 files changed, 8 insertions(+), 7 deletions(-)

src/link/Elf.zig+8-7
...@@ -3394,6 +3394,14 @@ fn initSections(self: *Elf) !void {...@@ -3394,6 +3394,14 @@ fn initSections(self: *Elf) !void {
3394 });3394 });
3395 }3395 }
33963396
3397 self.got_plt_section_index = try self.addSection(.{
3398 .name = ".got.plt",
3399 .type = elf.SHT_PROGBITS,
3400 .flags = elf.SHF_ALLOC | elf.SHF_WRITE,
3401 .addralign = @alignOf(u64),
3402 .offset = std.math.maxInt(u64),
3403 });
3404
3397 const needs_rela_dyn = blk: {3405 const needs_rela_dyn = blk: {
3398 if (self.got.flags.needs_rela or self.got.flags.needs_tlsld or3406 if (self.got.flags.needs_rela or self.got.flags.needs_tlsld or
3399 self.zig_got.flags.needs_rela or self.copy_rel.symbols.items.len > 0) break :blk true;3407 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 {...@@ -3424,13 +3432,6 @@ fn initSections(self: *Elf) !void {
3424 .addralign = 16,3432 .addralign = 16,
3425 .offset = std.math.maxInt(u64),3433 .offset = std.math.maxInt(u64),
3426 });3434 });
3427 self.got_plt_section_index = try self.addSection(.{
3428 .name = ".got.plt",
3429 .type = elf.SHT_PROGBITS,
3430 .flags = elf.SHF_ALLOC | elf.SHF_WRITE,
3431 .addralign = @alignOf(u64),
3432 .offset = std.math.maxInt(u64),
3433 });
3434 self.rela_plt_section_index = try self.addSection(.{3435 self.rela_plt_section_index = try self.addSection(.{
3435 .name = ".rela.plt",3436 .name = ".rela.plt",
3436 .type = elf.SHT_RELA,3437 .type = elf.SHT_RELA,