mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 00:35:10 +00:00
elf: create link between .rela and output section
This commit is contained in:
parent
e22b3595c1
commit
0211d6bf4f
@ -3904,15 +3904,11 @@ fn sortShdrs(self: *Elf) !void {
|
||||
shdr.sh_info = self.plt_section_index.?;
|
||||
}
|
||||
|
||||
for (&[_]?u16{
|
||||
self.zig_text_rela_section_index,
|
||||
self.zig_data_rel_ro_rela_section_index,
|
||||
self.zig_data_rela_section_index,
|
||||
}) |maybe_index| {
|
||||
const index = maybe_index orelse continue;
|
||||
const shdr = &self.shdrs.items[index];
|
||||
shdr.sh_link = self.symtab_section_index.?;
|
||||
shdr.sh_info = backlinks[shdr.sh_info];
|
||||
for (self.shdrs.items) |*shdr| {
|
||||
if (shdr.sh_type == elf.SHT_RELA and shdr.sh_flags & elf.SHF_INFO_LINK != 0) {
|
||||
shdr.sh_link = self.symtab_section_index.?;
|
||||
shdr.sh_info = backlinks[shdr.sh_info];
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@ -668,6 +668,7 @@ pub fn initRelaSections(self: Object, elf_file: *Elf) !void {
|
||||
const out_shdr = &elf_file.shdrs.items[out_shndx];
|
||||
out_shdr.sh_addralign = @alignOf(elf.Elf64_Rela);
|
||||
out_shdr.sh_entsize = @sizeOf(elf.Elf64_Rela);
|
||||
out_shdr.sh_info = self.initOutputSection(elf_file, atom.inputShdr(elf_file)) catch unreachable;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user