reloc_howto_type *howto = reloc_entry->howto;
asection *output_section;
bool relocatable = (output_bfd != NULL);
- bfd_size_type limit = bfd_get_section_limit_octets (abfd, input_section);
- if (addr - 2 > limit || limit - (addr - 2) < 2)
+ if (!bfd_reloc_offset_in_range (howto, abfd, input_section, addr - 2))
return bfd_reloc_outofrange;
if (bfd_is_und_section (symbol->section)
reloc_howto_type *howto = reloc_entry->howto;
asection *output_section;
bool relocatable = (output_bfd != NULL);
- bfd_size_type limit = bfd_get_section_limit_octets (abfd, input_section);
/* Is the address of the relocation really within the section? */
- if (reloc_addr > limit || limit - reloc_addr < 2)
+ if (!bfd_reloc_offset_in_range (howto, abfd, input_section, reloc_addr))
return bfd_reloc_outofrange;
if (bfd_is_und_section (symbol->section)
bfd_vma output_base = 0;
asection *output_section;
bool relocatable = (output_bfd != NULL);
- bfd_size_type limit = bfd_get_section_limit_octets (abfd, input_section);
/* Is the address of the relocation really within the section? */
- if (addr > limit || limit - addr < 4)
+ if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd, input_section,
+ addr))
return bfd_reloc_outofrange;
if (bfd_is_und_section (symbol->section)
reloc_howto_type *howto = reloc_entry->howto;
asection *output_section;
bool relocatable = (output_bfd != NULL);
- bfd_size_type limit = bfd_get_section_limit_octets (abfd, input_section);
/* Is the address of the relocation really within the section? */
- if (addr > limit || limit - addr < howto->size + 1u)
+ if (!bfd_reloc_offset_in_range (howto, abfd, input_section, addr))
return bfd_reloc_outofrange;
if (bfd_is_und_section (symbol->section)
{
bfd_reloc_status_type r = bfd_reloc_ok;
bfd_vma x;
- bfd_size_type limit = bfd_get_section_limit_octets (input_bfd,
- input_section);
- if (address - 2 > limit || limit - (address - 2) < 4)
- return bfd_reloc_outofrange;
+ if (!bfd_reloc_offset_in_range (howto, input_bfd, input_section,
+ address - 2))
+ return bfd_reloc_outofrange;
value += addend;