bfd_byte *where;
/* Sanity check that the address is in range. */
+ bfd_size_type end = bfd_get_section_limit_octets (abfd, input_section);
+ bfd_size_type reloc_size;
if (reloc_entry->howto->type == R_BPF_INSN_64)
- {
- bfd_size_type end = bfd_get_section_limit_octets (abfd, input_section);
- if (reloc_entry->address > end
- || end - reloc_entry->address < 16)
- return bfd_reloc_outofrange;
- }
- else if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd, input_section,
- reloc_entry->address))
+ reloc_size = 16;
+ else
+ reloc_size = (reloc_entry->howto->bitsize
+ + reloc_entry->howto->bitpos) / 8;
+
+ if (reloc_entry->address > end
+ || end - reloc_entry->address < reloc_size)
return bfd_reloc_outofrange;
/* Get the symbol value. */