aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfcode.h
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elfcode.h')
-rw-r--r--bfd/elfcode.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 0cd1183..5ef4610 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -959,7 +959,9 @@ elf_write_relocs (bfd *abfd, asection *sec, void *data)
if (sec->orelocation == NULL)
return;
- rela_hdr = &elf_section_data (sec)->rel_hdr;
+ rela_hdr = elf_section_data (sec)->rela.hdr;
+ if (rela_hdr == NULL)
+ rela_hdr = elf_section_data (sec)->rel.hdr;
rela_hdr->sh_size = rela_hdr->sh_entsize * sec->reloc_count;
rela_hdr->contents = (unsigned char *) bfd_alloc (abfd, rela_hdr->sh_size);
@@ -1530,13 +1532,13 @@ elf_slurp_reloc_table (bfd *abfd,
|| asect->reloc_count == 0)
return TRUE;
- rel_hdr = &d->rel_hdr;
- reloc_count = NUM_SHDR_ENTRIES (rel_hdr);
- rel_hdr2 = d->rel_hdr2;
- reloc_count2 = (rel_hdr2 ? NUM_SHDR_ENTRIES (rel_hdr2) : 0);
+ rel_hdr = d->rel.hdr;
+ reloc_count = rel_hdr ? NUM_SHDR_ENTRIES (rel_hdr) : 0;
+ rel_hdr2 = d->rela.hdr;
+ reloc_count2 = rel_hdr2 ? NUM_SHDR_ENTRIES (rel_hdr2) : 0;
BFD_ASSERT (asect->reloc_count == reloc_count + reloc_count2);
- BFD_ASSERT (asect->rel_filepos == rel_hdr->sh_offset
+ BFD_ASSERT ((rel_hdr && asect->rel_filepos == rel_hdr->sh_offset)
|| (rel_hdr2 && asect->rel_filepos == rel_hdr2->sh_offset));
}
@@ -1560,10 +1562,11 @@ elf_slurp_reloc_table (bfd *abfd,
if (relents == NULL)
return FALSE;
- if (!elf_slurp_reloc_table_from_section (abfd, asect,
- rel_hdr, reloc_count,
- relents,
- symbols, dynamic))
+ if (rel_hdr
+ && !elf_slurp_reloc_table_from_section (abfd, asect,
+ rel_hdr, reloc_count,
+ relents,
+ symbols, dynamic))
return FALSE;
if (rel_hdr2