diff options
Diffstat (limited to 'bfd/elf32-i860.c')
-rw-r--r-- | bfd/elf32-i860.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/bfd/elf32-i860.c b/bfd/elf32-i860.c index f156bc5..863d7ae 100644 --- a/bfd/elf32-i860.c +++ b/bfd/elf32-i860.c @@ -38,6 +38,7 @@ i860_howto_pc26_reloc (bfd *abfd ATTRIBUTE_UNUSED, { bfd_vma insn; bfd_vma relocation; + bfd_size_type sz; bfd_byte *addr; if (output_bfd != NULL @@ -63,7 +64,8 @@ i860_howto_pc26_reloc (bfd *abfd ATTRIBUTE_UNUSED, relocation += symbol->section->output_offset; relocation += reloc_entry->addend; - if (reloc_entry->address > input_section->_cooked_size) + sz = input_section->rawsize ? input_section->rawsize : input_section->size; + if (reloc_entry->address > sz) return bfd_reloc_outofrange; /* Adjust for PC-relative relocation. */ @@ -101,6 +103,7 @@ i860_howto_pc16_reloc (bfd *abfd, { bfd_vma insn; bfd_vma relocation; + bfd_size_type sz; bfd_byte *addr; if (output_bfd != NULL @@ -126,7 +129,8 @@ i860_howto_pc16_reloc (bfd *abfd, relocation += symbol->section->output_offset; relocation += reloc_entry->addend; - if (reloc_entry->address > input_section->_cooked_size) + sz = input_section->rawsize ? input_section->rawsize : input_section->size; + if (reloc_entry->address > sz) return bfd_reloc_outofrange; /* Adjust for PC-relative relocation. */ @@ -165,6 +169,7 @@ i860_howto_highadj_reloc (bfd *abfd, { bfd_vma insn; bfd_vma relocation; + bfd_size_type sz; bfd_byte *addr; if (output_bfd != NULL @@ -191,7 +196,8 @@ i860_howto_highadj_reloc (bfd *abfd, relocation += reloc_entry->addend; relocation += 0x8000; - if (reloc_entry->address > input_section->_cooked_size) + sz = input_section->rawsize ? input_section->rawsize : input_section->size; + if (reloc_entry->address > sz) return bfd_reloc_outofrange; addr = (bfd_byte *) data + reloc_entry->address; @@ -218,6 +224,7 @@ i860_howto_splitn_reloc (bfd *abfd, { bfd_vma insn; bfd_vma relocation; + bfd_size_type sz; bfd_byte *addr; if (output_bfd != NULL @@ -243,7 +250,8 @@ i860_howto_splitn_reloc (bfd *abfd, relocation += symbol->section->output_offset; relocation += reloc_entry->addend; - if (reloc_entry->address > input_section->_cooked_size) + sz = input_section->rawsize ? input_section->rawsize : input_section->size; + if (reloc_entry->address > sz) return bfd_reloc_outofrange; addr = (bfd_byte *) data + reloc_entry->address; |