Skip to content

Commit

Permalink
elf: unconditionally generate .got.plt section
Browse files Browse the repository at this point in the history
  • Loading branch information
kubkon committed Nov 15, 2023
1 parent ec52b52 commit 5314f9f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Elf.zig
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,13 @@ fn initSyntheticSections(self: *Elf) !void {
});
}

self.got_plt_sect_index = try self.addSection(.{
.name = ".got.plt",
.type = elf.SHT_PROGBITS,
.flags = elf.SHF_ALLOC | elf.SHF_WRITE,
.addralign = @alignOf(u64),
});

const needs_rela_dyn = blk: {
if (self.got.flags.needs_rela or self.got.flags.needs_tlsld or
self.copy_rel.symbols.items.len > 0) break :blk true;
Expand All @@ -543,12 +550,6 @@ fn initSyntheticSections(self: *Elf) !void {
.flags = elf.SHF_ALLOC | elf.SHF_EXECINSTR,
.addralign = 16,
});
self.got_plt_sect_index = try self.addSection(.{
.name = ".got.plt",
.type = elf.SHT_PROGBITS,
.flags = elf.SHF_ALLOC | elf.SHF_WRITE,
.addralign = @alignOf(u64),
});
self.rela_plt_sect_index = try self.addSection(.{
.name = ".rela.plt",
.type = elf.SHT_RELA,
Expand Down

0 comments on commit 5314f9f

Please sign in to comment.