diff options
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r-- | bfd/elflink.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index 5051364..7d63383 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -1880,10 +1880,6 @@ elf_link_read_relocs_from_section (bfd *abfd, Elf_Internal_Shdr *symtab_hdr; size_t nsyms; - /* If there aren't any relocations, that's OK. */ - if (!shdr) - return TRUE; - /* Position ourselves at the start of the section. */ if (bfd_seek (abfd, shdr->sh_offset, SEEK_SET) != 0) return FALSE; @@ -1909,7 +1905,7 @@ elf_link_read_relocs_from_section (bfd *abfd, } erela = external_relocs; - erelaend = erela + NUM_SHDR_ENTRIES (shdr) * shdr->sh_entsize; + erelaend = erela + shdr->sh_size; irela = internal_relocs; while (erela < erelaend) { @@ -1995,12 +1991,13 @@ _bfd_elf_link_read_relocs (bfd *abfd, external_relocs, internal_relocs)) goto error_return; - if (!elf_link_read_relocs_from_section - (abfd, o, - elf_section_data (o)->rel_hdr2, - ((bfd_byte *) external_relocs) + rel_hdr->sh_size, - internal_relocs + (NUM_SHDR_ENTRIES (rel_hdr) - * bed->s->int_rels_per_ext_rel))) + if (elf_section_data (o)->rel_hdr2 + && (!elf_link_read_relocs_from_section + (abfd, o, + elf_section_data (o)->rel_hdr2, + ((bfd_byte *) external_relocs) + rel_hdr->sh_size, + internal_relocs + (NUM_SHDR_ENTRIES (rel_hdr) + * bed->s->int_rels_per_ext_rel)))) goto error_return; /* Cache the results for next time, if we can. */ |