bfd *output_bfd ATTRIBUTE_UNUSED,
char **error_message ATTRIBUTE_UNUSED)
{
+ if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd, input_section,
+ reloc_entry->address))
+ return bfd_reloc_outofrange;
+
score_elf_section_data (input_section)->hi16_rel_addr
= (bfd_byte *) data + reloc_entry->address;
return bfd_reloc_ok;
unsigned long hi16_offset, hi16_value, uvalue;
bfd_byte *hi16_rel_addr;
+ if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd, input_section,
+ reloc_entry->address))
+ return bfd_reloc_outofrange;
+
hi16_rel_addr = score_elf_section_data (input_section)->hi16_rel_addr;
hi16_value = hi16_rel_addr ? score_bfd_get_32 (abfd, hi16_rel_addr) : 0;
hi16_offset = ((((hi16_value >> 16) & 0x3) << 15) | (hi16_value & 0x7fff)) >> 1;
addend = score_bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
offset = ((((addend >> 16) & 0x3) << 15) | (addend & 0x7fff)) >> 1;
val = reloc_entry->addend;
- if (reloc_entry->address > input_section->size)
- return bfd_reloc_outofrange;
uvalue = ((hi16_offset << 16) | (offset & 0xffff)) + val;
if (hi16_rel_addr)
{
score_elf_final_gp (bfd *output_bfd,
asymbol *symbol,
bool relocatable,
- char **error_message,
+ char **error_message,
bfd_vma *pgp)
{
if (bfd_is_und_section (symbol->section)
arelent *reloc_entry,
asection *input_section,
bool relocateable,
- void * data,
+ void *data,
bfd_vma gp ATTRIBUTE_UNUSED)
{
unsigned long insn;
- if (reloc_entry->address > input_section->size)
+ if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd, input_section,
+ reloc_entry->address))
return bfd_reloc_outofrange;
insn = score_bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
bfd_vma relocation;
bfd_vma val;
+ if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd, input_section,
+ reloc_entry->address))
+ return bfd_reloc_outofrange;
+
if (bfd_is_com_section (symbol->section))
relocation = 0;
else
relocation += symbol->section->output_section->vma;
relocation += symbol->section->output_offset;
- if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
- return bfd_reloc_outofrange;
-
/* Set val to the offset into the section or symbol. */
val = reloc_entry->addend;
score_elf_gprel15_reloc (bfd *abfd,
arelent *reloc_entry,
asymbol *symbol,
- void * data,
+ void *data,
asection *input_section,
bfd *output_bfd,
char **error_message)
score_elf_got_lo16_reloc (bfd *abfd,
arelent *reloc_entry,
asymbol *symbol ATTRIBUTE_UNUSED,
- void * data,
+ void *data,
asection *input_section,
bfd *output_bfd ATTRIBUTE_UNUSED,
char **error_message ATTRIBUTE_UNUSED)
signed long hi16_offset, hi16_value, uvalue;
bfd_byte *hi16_rel_addr;
+ if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd, input_section,
+ reloc_entry->address))
+ return bfd_reloc_outofrange;
+
hi16_rel_addr = score_elf_section_data (input_section)->hi16_rel_addr;
hi16_value = hi16_rel_addr ? score_bfd_get_32 (abfd, hi16_rel_addr) : 0;
hi16_offset = ((((hi16_value >> 16) & 0x3) << 15) | (hi16_value & 0x7fff)) >> 1;
addend = score_bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
offset = ((((addend >> 16) & 0x3) << 15) | (addend & 0x7fff)) >> 1;
val = reloc_entry->addend;
- if (reloc_entry->address > input_section->size)
- return bfd_reloc_outofrange;
uvalue = ((hi16_offset << 16) | (offset & 0xffff)) + val;
if (hi16_rel_addr)
{
score_elf_hi16_reloc (bfd *abfd ATTRIBUTE_UNUSED,
arelent *reloc_entry,
asymbol *symbol ATTRIBUTE_UNUSED,
- void * data,
- asection *input_section ATTRIBUTE_UNUSED,
+ void *data,
+ asection *input_section,
bfd *output_bfd ATTRIBUTE_UNUSED,
char **error_message ATTRIBUTE_UNUSED)
{
+ if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd, input_section,
+ reloc_entry->address))
+ return bfd_reloc_outofrange;
+
score_elf_section_data (input_section)->hi16_rel_addr
= (bfd_byte *) data + reloc_entry->address;
return bfd_reloc_ok;
score_elf_lo16_reloc (bfd *abfd,
arelent *reloc_entry,
asymbol *symbol ATTRIBUTE_UNUSED,
- void * data,
+ void *data,
asection *input_section,
bfd *output_bfd ATTRIBUTE_UNUSED,
char **error_message ATTRIBUTE_UNUSED)
unsigned long hi16_offset, hi16_value, uvalue;
bfd_byte *hi16_rel_addr;
+ if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd, input_section,
+ reloc_entry->address))
+ return bfd_reloc_outofrange;
+
hi16_rel_addr = score_elf_section_data (input_section)->hi16_rel_addr;
hi16_value = hi16_rel_addr ? bfd_get_32 (abfd, hi16_rel_addr) : 0;
hi16_offset = ((((hi16_value >> 16) & 0x3) << 15) | (hi16_value & 0x7fff)) >> 1;
addend = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
offset = ((((addend >> 16) & 0x3) << 15) | (addend & 0x7fff)) >> 1;
val = reloc_entry->addend;
- if (reloc_entry->address > input_section->size)
- return bfd_reloc_outofrange;
uvalue = ((hi16_offset << 16) | (offset & 0xffff)) + val;
if (hi16_rel_addr)
{
arelent *reloc_entry,
asection *input_section,
bool relocateable,
- void * data,
+ void *data,
bfd_vma gp ATTRIBUTE_UNUSED)
{
unsigned long insn;
- if (reloc_entry->address > input_section->size)
+ if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd, input_section,
+ reloc_entry->address))
return bfd_reloc_outofrange;
insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
bfd_vma relocation;
bfd_vma val;
+ if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd, input_section,
+ reloc_entry->address))
+ return bfd_reloc_outofrange;
+
if (bfd_is_com_section (symbol->section))
relocation = 0;
else
relocation += symbol->section->output_section->vma;
relocation += symbol->section->output_offset;
- if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
- return bfd_reloc_outofrange;
-
/* Set val to the offset into the section or symbol. */
val = reloc_entry->addend;
score_elf_gprel15_reloc (bfd *abfd,
arelent *reloc_entry,
asymbol *symbol,
- void * data,
+ void *data,
asection *input_section,
bfd *output_bfd,
char **error_message)
score_elf_got_lo16_reloc (bfd *abfd,
arelent *reloc_entry,
asymbol *symbol ATTRIBUTE_UNUSED,
- void * data,
+ void *data,
asection *input_section,
bfd *output_bfd ATTRIBUTE_UNUSED,
char **error_message ATTRIBUTE_UNUSED)
signed long hi16_offset, hi16_value, uvalue;
bfd_byte *hi16_rel_addr;
+ if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd, input_section,
+ reloc_entry->address))
+ return bfd_reloc_outofrange;
+
hi16_rel_addr = score_elf_section_data (input_section)->hi16_rel_addr;
hi16_value = hi16_rel_addr ? bfd_get_32 (abfd, hi16_rel_addr) : 0;
hi16_offset = ((((hi16_value >> 16) & 0x3) << 15) | (hi16_value & 0x7fff)) >> 1;