elf: clear dynamic relocs before repopulating
This commit is contained in:
committed by
Andrew Kelley
parent
bc7e0342b5
commit
bae3dbffdf
@@ -4269,6 +4269,8 @@ fn writeSyntheticSections(self: *Elf) !void {
|
||||
}
|
||||
|
||||
if (self.rela_dyn_section_index) |shndx| {
|
||||
// TODO: would state tracking be more appropriate here? perhaps even custom relocation type?
|
||||
self.rela_dyn.clearRetainingCapacity();
|
||||
const shdr = slice.items(.shdr)[shndx];
|
||||
try self.got.addRela(self);
|
||||
try self.copy_rel.addRela(self);
|
||||
@@ -4301,6 +4303,8 @@ fn writeSyntheticSections(self: *Elf) !void {
|
||||
}
|
||||
|
||||
if (self.rela_plt_section_index) |shndx| {
|
||||
// TODO: would state tracking be more appropriate here? perhaps even custom relocation type?
|
||||
self.rela_plt.clearRetainingCapacity();
|
||||
const shdr = slice.items(.shdr)[shndx];
|
||||
try self.plt.addRela(self);
|
||||
try self.base.file.?.pwriteAll(mem.sliceAsBytes(self.rela_plt.items), shdr.sh_offset);
|
||||
|
||||
Reference in New Issue
Block a user