&& output_bfd == NULL)
flag = bfd_reloc_undefined;
- /* Is the address of the relocation really within the section? */
- if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
+ if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd,
+ input_section, reloc_entry->address))
return bfd_reloc_outofrange;
/* Work out which section the relocation is targeted at and the
&& output_bfd == NULL)
flag = bfd_reloc_undefined;
- /* Is the address of the relocation really within the section? */
- if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
+ if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd,
+ input_section, reloc_entry->address))
return bfd_reloc_outofrange;
/* Work out which section the relocation is targeted at and the
bfd_size_type octets = (reloc_entry->address
* OCTETS_PER_BYTE (abfd, input_section));
+ if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd,
+ input_section, octets))
+ return bfd_reloc_outofrange;
bfd_vma result = bfd_get_24 (abfd, (unsigned char *) data + octets);
bfd_vma val = bfd_asymbol_value (symbol);
return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message);
- if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
- return bfd_reloc_outofrange;
octets = reloc_entry->address * OCTETS_PER_BYTE (abfd, input_section);
+ if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd,
+ input_section, octets))
+ return bfd_reloc_outofrange;
/* Get symbol value. */
val = 0;
It sets instruction parity to even. This cannot be done by a howto. */
static bfd_reloc_status_type
-visium_elf_howto_parity_reloc (bfd * input_bfd, arelent *reloc_entry,
+visium_elf_howto_parity_reloc (bfd *input_bfd, arelent *reloc_entry,
asymbol *symbol, void *data,
asection *input_section, bfd *output_bfd,
char **error_message ATTRIBUTE_UNUSED)
/* This part is from bfd_elf_generic_reloc.
If we're relocating, and this an external symbol, we don't want
to change anything. */
- if (output_bfd != (bfd *) NULL && (symbol->flags & BSF_SECTION_SYM) == 0)
+ if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0)
{
reloc_entry->address += input_section->output_offset;
return bfd_reloc_ok;
/* Now do the reloc in the usual way. */
- /* Sanity check the address (offset in section). */
- if (reloc_entry->address > bfd_get_section_limit (input_bfd, input_section))
+ if (!bfd_reloc_offset_in_range (reloc_entry->howto, input_bfd,
+ input_section, reloc_entry->address))
return bfd_reloc_outofrange;
ret = bfd_reloc_ok;
- if (bfd_is_und_section (symbol->section) && output_bfd == (bfd *) NULL)
+ if (bfd_is_und_section (symbol->section) && output_bfd == NULL)
ret = bfd_reloc_undefined;
- if (bfd_is_com_section (symbol->section) || output_bfd != (bfd *) NULL)
+ if (bfd_is_com_section (symbol->section) || output_bfd != NULL)
relocation = 0;
else
relocation = symbol->value;
/* Only do this for a final link. */
- if (output_bfd == (bfd *) NULL)
+ if (output_bfd == NULL)
{
relocation += symbol->section->output_section->vma;
relocation += symbol->section->output_offset;
insn |= visium_parity_bit (insn);
bfd_put_32 (input_bfd, insn, inplace_address);
- if (output_bfd != (bfd *) NULL)
+ if (output_bfd != NULL)
reloc_entry->address += input_section->output_offset;
return ret;
return bfd_reloc_ok;
}
- if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
+ 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))
0xff, /* dst_mask */
false), /* pcrel_offset */
- /* A register plus an index, corresponding to the relocation expression.
- The sizes must correspond to the valid range of the expression, while
- the bitmasks correspond to what we store in the image. */
+ /* A register plus an index, corresponding to the relocation expression. */
HOWTO (R_MMIX_BASE_PLUS_OFFSET, /* type */
0, /* rightshift */
- 8, /* size */
- 64, /* bitsize */
+ 2, /* size */
+ 16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_dont, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_BASE_PLUS_OFFSET", /* name */
false, /* partial_inplace */
bfd_vma relocation;
bfd_reloc_status_type r;
asection *reloc_target_output_section;
- bfd_reloc_status_type flag = bfd_reloc_ok;
- bfd_vma output_base = 0;
+ bfd_vma output_base;
r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message);
if (bfd_is_und_section (symbol->section)
&& (symbol->flags & BSF_WEAK) == 0
- && output_bfd == (bfd *) NULL)
+ && output_bfd == NULL)
return bfd_reloc_undefined;
- /* Is the address of the relocation really within the section? */
- if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
- return bfd_reloc_outofrange;
-
/* Work out which section the relocation is targeted at and the
initial relocation command value. */
relocation += output_base + symbol->section->output_offset;
- if (output_bfd != (bfd *) NULL)
+ if (output_bfd != NULL)
{
/* Add in supplied addend. */
relocation += reloc_entry->addend;
Modify the reloc inplace to reflect what we now know. */
reloc_entry->addend = relocation;
reloc_entry->address += input_section->output_offset;
- return flag;
+ return bfd_reloc_ok;
}
+ if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd,
+ input_section, reloc_entry->address))
+ return bfd_reloc_outofrange;
+
return mmix_final_link_relocate (reloc_entry->howto, input_section,
data, reloc_entry->address,
reloc_entry->addend, relocation,
bfd_vma relocation;
bfd_vma insn;
- if (output_bfd != (bfd *) NULL
+ if (output_bfd != NULL
&& (symbol->flags & BSF_SECTION_SYM) == 0
&& (! howto->partial_inplace
|| reloc_entry->addend == 0))
if (output_bfd != NULL)
return bfd_reloc_continue;
- if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
+ if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd,
+ input_section, reloc_entry->address))
return bfd_reloc_outofrange;
relocation = (symbol->value
bfd_vma relocation;
reloc_howto_type *howto = reloc_entry->howto;
- if (output_bfd != (bfd *) NULL
+ if (output_bfd != NULL
&& (symbol->flags & BSF_SECTION_SYM) == 0
&& (! howto->partial_inplace
|| reloc_entry->addend == 0))
if (output_bfd != NULL)
return bfd_reloc_continue;
- if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
+ if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd,
+ input_section, reloc_entry->address))
return bfd_reloc_outofrange;
relocation = (symbol->value