+2004-06-29 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd-in.h (bfd_get_section_limit): Define.
+ * reloc.c (bfd_perform_relocation, bfd_install_relocation)
+ (_bfd_final_link_relocate): Use bfd_get_section_limit.
+ * aout-tic30.c (tic30_aout_final_link_relocate): Likewise.
+ * coff-arm.c (coff_arm_relocate_section): Likewise.
+ * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): Likewise.
+ * cpu-ns32k.c (do_ns32k_reloc): Likewise.
+ (bfd_ns32k_final_link_relocate): Likewise.
+ * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): Likwise.
+ * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): Likewise.
+ * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc)
+ (i860_howto_highadj_reloc, i860_howto_splitn_reloc): Likewise.
+ * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc)
+ (m32r_elf_generic_reloc, m32r_elf_relocate_section): Likewise.
+ * elf32-m68hc1x.c (m68hc11_elf_special_reloc): Likewise.
+ * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc): Likewise.
+ * elf32-or32.c (or32_elf_consth_reloc): Likewise.
+ * elf32-ppc.c (ppc_elf_addr16_ha_reloc): Likewise.
+ * elf32-s390.c (s390_elf_ldisp_reloc): Likewise.
+ * elf32-sh.c (sh_elf_reloc_loop): Likewise.
+ * elf32-sparc.c (sparc_elf_wdisp16_reloc): Likewise.
+ (sparc_elf_hix22_reloc, sparc_elf_lox10_reloc): Likwise.
+ * elf32-v850.c (v850_elf_reloc): Likewise.
+ * elf32-xstormy16.c (xstormy16_elf_24_reloc): Likewise.
+ * elf32-xtensa.c (bfd_elf_xtensa_reloc): Likewise.
+ * elf64-alpha.c (elf64_alpha_reloc_gpdisp): Likewise.
+ * elf64-mips.c (mips_elf64_gprel32_reloc)
+ (mips16_gprel_reloc): Likewise.
+ * elf64-mmix.c (mmix_elf_reloc): Likewise.
+ * elf64-s390.c (s390_elf_ldisp_reloc): Likewise.
+ * elf64-sparc.c (init_insn_reloc): Likewise.
+ * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_gprel16_with_gp)
+ (_bfd_mips_elf_hi16_reloc, _bfd_mips_elf_lo16_reloc)
+ (_bfd_mips_elf_generic_reloc): Likewise.
+ * bfd-in2.h: Regenerate.
+
2004-06-28 Alan Modra <amodra@bigpond.net.au>
* bfd-in.h (struct stab_info): Move from stabs.c.
bfd_vma addend;
{
bfd_vma relocation;
- bfd_size_type sz;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (address > sz)
+ if (address > bfd_get_section_limit (input_bfd, input_section))
return bfd_reloc_outofrange;
relocation = value + addend;
#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)
#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE)
#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE)
+/* Find the address one past the end of SEC. */
+#define bfd_get_section_limit(bfd, sec) \
+ (((sec)->rawsize ? (sec)->rawsize : (sec)->size) \
+ / bfd_octets_per_byte (bfd))
typedef struct stat stat_type;
\f
#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)
#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE)
#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE)
+/* Find the address one past the end of SEC. */
+#define bfd_get_section_limit(bfd, sec) \
+ (((sec)->rawsize ? (sec)->rawsize : (sec)->size) \
+ / bfd_octets_per_byte (bfd))
typedef struct stat stat_type;
\f
{
struct internal_reloc * rel;
struct internal_reloc * relend;
+ bfd_vma high_address = bfd_get_section_limit (input_bfd, input_section);
rel = relocs;
relend = rel + input_section->reloc_count;
code. */
bfd_vma address = rel->r_vaddr - input_section->vma;
- bfd_size_type sz;
- sz = (input_section->rawsize
- ? input_section->rawsize
- : input_section->size);
- if (address > sz)
+ if (address > high_address)
rstat = bfd_reloc_outofrange;
else
{
{
bfd_reloc_status_type ret;
bfd_vma relocation;
- bfd_size_type sz;
struct mips_hi *n;
/* If we're relocating, and this an external symbol, we don't want
relocation += symbol->section->output_offset;
relocation += reloc_entry->addend;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
/* Save the information, and let REFLO do the actual relocation. */
bfd_boolean relocatable;
bfd_vma gp;
bfd_vma relocation;
- bfd_size_type sz;
unsigned long val;
unsigned long insn;
relocation += symbol->section->output_section->vma;
relocation += symbol->section->output_offset;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
bfd_vma relocation;
bfd_reloc_status_type flag = bfd_reloc_ok;
bfd_size_type addr = reloc_entry->address;
- bfd_size_type sz;
bfd_vma output_base = 0;
reloc_howto_type *howto = reloc_entry->howto;
asection *reloc_target_output_section;
flag = bfd_reloc_undefined;
/* Is the address of the relocation really within the section? */
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ 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
bfd_vma addend;
{
bfd_vma relocation;
- bfd_size_type sz;
/* Sanity check the address. */
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (address > sz)
+ if (address > bfd_get_section_limit (input_bfd, input_section))
return bfd_reloc_outofrange;
/* This function assumes that we are dealing with a basic relocation
bfd_reloc_status_type r;
asection *reloc_target_output_section;
bfd_size_type addr = reloc_entry->address;
- bfd_size_type sz;
bfd_reloc_status_type flag = bfd_reloc_ok;
bfd_vma output_base = 0;
reloc_howto_type *howto = reloc_entry->howto;
flag = bfd_reloc_undefined;
/* Is the address of the relocation really within the section? */
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ 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
bfd_reloc_status_type r;
asection *reloc_target_output_section;
bfd_size_type addr = reloc_entry->address;
- bfd_size_type sz;
bfd_reloc_status_type flag = bfd_reloc_ok;
bfd_vma output_base = 0;
reloc_howto_type *howto = reloc_entry->howto;
flag = bfd_reloc_undefined;
/* Is the address of the relocation really within the section? */
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ 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
{
bfd_reloc_status_type ret;
bfd_vma relocation;
- bfd_size_type sz;
/* If the skip flag is set then we simply do the generic relocating, this
is more of a hack for dlx gas/gld, so we do not need to do the %hi/%lo
relocation += reloc_entry->addend;
relocation += bfd_get_16 (abfd, (bfd_byte *)data + reloc_entry->address);
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
#if 0
{
bfd_vma insn;
bfd_vma relocation;
- bfd_size_type sz;
bfd_byte *addr;
if (output_bfd != NULL
relocation += symbol->section->output_offset;
relocation += reloc_entry->addend;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
/* Adjust for PC-relative relocation. */
{
bfd_vma insn;
bfd_vma relocation;
- bfd_size_type sz;
bfd_byte *addr;
if (output_bfd != NULL
relocation += symbol->section->output_offset;
relocation += reloc_entry->addend;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
/* Adjust for PC-relative relocation. */
{
bfd_vma insn;
bfd_vma relocation;
- bfd_size_type sz;
bfd_byte *addr;
if (output_bfd != NULL
relocation += reloc_entry->addend;
relocation += 0x8000;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
addr = (bfd_byte *) data + reloc_entry->address;
{
bfd_vma insn;
bfd_vma relocation;
- bfd_size_type sz;
bfd_byte *addr;
if (output_bfd != NULL
relocation += symbol->section->output_offset;
relocation += reloc_entry->addend;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
addr = (bfd_byte *) data + reloc_entry->address;
bfd_vma addend;
{
bfd_signed_vma relocation;
- bfd_size_type sz;
unsigned long x;
bfd_reloc_status_type status;
/* Sanity check the address (offset in section). */
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (offset > sz)
+ if (offset > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
relocation = symbol_value + addend;
{
bfd_reloc_status_type ret;
bfd_vma relocation;
- bfd_size_type sz;
struct m32r_hi16 *n;
/* This part is from bfd_elf_generic_reloc.
}
/* Sanity check the address (offset in section). */
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
ret = bfd_reloc_ok;
{
bfd_reloc_status_type ret;
bfd_vma relocation;
- bfd_size_type sz;
bfd_byte *inplace_address;
/* This part is from bfd_elf_generic_reloc.
a section relative addend which is wrong. */
/* Sanity check the address (offset in section). */
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (input_bfd, input_section))
return bfd_reloc_outofrange;
ret = bfd_reloc_ok;
bfd *dynobj;
bfd_vma *local_got_offsets;
asection *sgot, *splt, *sreloc;
+ bfd_vma high_address = bfd_get_section_limit (input_bfd, input_section);
dynobj = htab->root.dynobj;
local_got_offsets = elf_local_got_offsets (input_bfd);
else
{
bfd_vma relocation;
- bfd_size_type sz;
/* This is a final link. */
sym = NULL;
}
/* Sanity check the address. */
- sz = (input_section->rawsize
- ? input_section->rawsize
- : input_section->size);
- if (offset > input_section->size)
+ if (offset > high_address)
{
r = bfd_reloc_outofrange;
goto check_reloc;
bfd *output_bfd,
char **error_message ATTRIBUTE_UNUSED)
{
- bfd_size_type sz;
-
if (output_bfd != (bfd *) NULL
&& (symbol->flags & BSF_SECTION_SYM) == 0
&& (! reloc_entry->howto->partial_inplace
if (output_bfd != NULL)
return bfd_reloc_continue;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
abort();
{
bfd_vma relocation;
bfd_vma val;
- bfd_size_type sz;
if (bfd_is_com_section (symbol->section))
relocation = 0;
relocation += symbol->section->output_section->vma;
relocation += symbol->section->output_offset;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ 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. */
unsigned short insn = 0;
bfd_signed_vma val;
bfd_vma relocation;
- bfd_size_type sz;
/* If we're relocating, and this is an external symbol, we don't want
to change anything. */
if (ret != bfd_reloc_ok)
return ret;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
if (bfd_is_com_section (symbol->section))
{
bfd_reloc_status_type ret;
bfd_vma relocation;
- bfd_size_type sz;
struct or32_consth *n;
ret = bfd_reloc_ok;
relocation += symbol->section->output_offset;
relocation += reloc_entry->addend;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
/* Save the information, and let LO16 do the actual relocation. */
char **error_message ATTRIBUTE_UNUSED)
{
bfd_vma relocation;
- bfd_size_type sz;
if (output_bfd != NULL)
{
return bfd_reloc_ok;
}
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
if (bfd_is_com_section (symbol->section))
reloc_howto_type *howto = reloc_entry->howto;
bfd_vma relocation;
bfd_vma insn;
- bfd_size_type sz;
if (output_bfd != (bfd *) NULL
&& (symbol->flags & BSF_SECTION_SYM) == 0
if (output_bfd != NULL)
return bfd_reloc_continue;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
relocation = (symbol->value
bfd_byte *start_ptr, *ptr, *last_ptr;
int diff, cum_diff;
bfd_signed_vma x;
- bfd_size_type sz;
int insn;
/* Sanity check the address. */
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (addr > sz)
+ if (addr > bfd_get_section_limit (input_bfd, input_section))
return bfd_reloc_outofrange;
/* We require the start and end relocations to be processed consecutively -
{
bfd_vma relocation;
bfd_vma x;
- bfd_size_type sz;
if (output_bfd != (bfd *) NULL
&& (symbol->flags & BSF_SECTION_SYM) == 0
if (output_bfd != NULL)
return bfd_reloc_continue;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
relocation = (symbol->value
{
bfd_vma relocation;
bfd_vma insn;
- bfd_size_type sz;
if (output_bfd != (bfd *) NULL
&& (symbol->flags & BSF_SECTION_SYM) == 0)
if (output_bfd != NULL)
return bfd_reloc_continue;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
relocation = (symbol->value
{
bfd_vma relocation;
bfd_vma insn;
- bfd_size_type sz;
if (output_bfd != (bfd *) NULL
&& (symbol->flags & BSF_SECTION_SYM) == 0)
if (output_bfd != NULL)
return bfd_reloc_continue;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
relocation = (symbol->value
bfd *obfd;
char **err ATTRIBUTE_UNUSED;
{
- bfd_size_type sz;
long relocation;
/* If there is an output BFD,
/* We handle final linking of some relocs ourselves. */
/* Is the address of the relocation really within the section? */
- sz = isection->rawsize ? isection->rawsize : isection->size;
- if (reloc->address > sz)
+ if (reloc->address > bfd_get_section_limit (abfd, isection))
return bfd_reloc_outofrange;
/* Work out which section the relocation is targeted at and the
char **error_message ATTRIBUTE_UNUSED;
{
bfd_vma relocation, x;
- bfd_size_type sz;
if (output_bfd != NULL)
{
return bfd_reloc_ok;
}
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
if (bfd_is_com_section (symbol->section))
bfd_vma relocation;
bfd_reloc_status_type flag;
bfd_size_type octets = reloc_entry->address * bfd_octets_per_byte (abfd);
- bfd_size_type sz;
bfd_vma output_base = 0;
reloc_howto_type *howto = reloc_entry->howto;
asection *reloc_target_output_section;
}
/* Is the address of the relocation really within the section? */
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz / bfd_octets_per_byte (abfd))
+ 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
{
bfd_reloc_status_type ret;
bfd_vma gp, relocation;
- bfd_size_type sz;
+ bfd_vma high_address;
bfd_byte *p_ldah, *p_lda;
/* Don't do anything if we're not doing a final link. */
return bfd_reloc_ok;
}
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz
- || reloc_entry->address + reloc_entry->addend > sz)
+ high_address = bfd_get_section_limit (abfd, input_section);
+ if (reloc_entry->address > high_address
+ || reloc_entry->address + reloc_entry->addend > high_address)
return bfd_reloc_outofrange;
/* The gp used in the portion of the output object to which this
bfd_vma gp;
bfd_vma relocation;
bfd_vma val;
- bfd_size_type sz;
/* If we're relocating, and this is an external symbol, we don't want
to change anything. */
relocation += symbol->section->output_section->vma;
relocation += symbol->section->output_offset;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ 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. */
unsigned short insn = 0;
bfd_signed_vma val;
bfd_vma relocation;
- bfd_size_type sz;
/* If we're relocating, and this is an external symbol with no
addend, we don't want to change anything. */
if (ret != bfd_reloc_ok)
return ret;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
if (bfd_is_com_section (symbol->section))
bfd_reloc_status_type flag = bfd_reloc_ok;
bfd_vma output_base = 0;
bfd_vma addr;
- bfd_size_type sz;
r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message);
return bfd_reloc_undefined;
/* Is the address of the relocation really within the section? */
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ 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
reloc_howto_type *howto = reloc_entry->howto;
bfd_vma relocation;
bfd_vma insn;
- bfd_size_type sz;
if (output_bfd != (bfd *) NULL
&& (symbol->flags & BSF_SECTION_SYM) == 0
if (output_bfd != NULL)
return bfd_reloc_continue;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
relocation = (symbol->value
bfd_vma *pinsn;
{
bfd_vma relocation;
- bfd_size_type sz;
reloc_howto_type *howto = reloc_entry->howto;
if (output_bfd != (bfd *) NULL
if (output_bfd != NULL)
return bfd_reloc_continue;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
relocation = (symbol->value
void *data, bfd_vma gp)
{
bfd_vma relocation;
- bfd_size_type sz;
unsigned long val;
if (bfd_is_com_section (symbol->section))
relocation += symbol->section->output_section->vma;
relocation += symbol->section->output_offset;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
if (reloc_entry->howto->src_mask == 0)
unsigned short insn = 0;
bfd_signed_vma val;
bfd_vma relocation;
- bfd_size_type sz;
if (output_bfd != NULL)
relocatable = TRUE;
if (ret != bfd_reloc_ok)
return ret;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
if (bfd_is_com_section (symbol->section))
{
bfd_vma relocation;
bfd_signed_vma val;
- bfd_size_type sz;
bfd_reloc_status_type status;
if (bfd_is_com_section (symbol->section))
relocation += symbol->section->output_section->vma;
relocation += symbol->section->output_offset;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ 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. */
char **error_message ATTRIBUTE_UNUSED)
{
struct mips_hi16 *n;
- bfd_size_type sz;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
n = bfd_malloc (sizeof *n);
bfd *output_bfd, char **error_message)
{
bfd_vma vallo;
- bfd_size_type sz;
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
vallo = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
char **error_message ATTRIBUTE_UNUSED)
{
bfd_signed_vma val;
- bfd_size_type sz;
bfd_reloc_status_type status;
bfd_boolean relocatable;
relocatable = (output_bfd != NULL);
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz)
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
/* Build up the field adjustment in VAL. */
{
bfd_vma relocation;
bfd_reloc_status_type flag = bfd_reloc_ok;
- bfd_size_type sz;
bfd_size_type octets = reloc_entry->address * bfd_octets_per_byte (abfd);
bfd_vma output_base = 0;
reloc_howto_type *howto = reloc_entry->howto;
}
/* Is the address of the relocation really within the section? */
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz / bfd_octets_per_byte (abfd))
+ 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
{
bfd_vma relocation;
bfd_reloc_status_type flag = bfd_reloc_ok;
- bfd_size_type sz;
bfd_size_type octets = reloc_entry->address * bfd_octets_per_byte (abfd);
bfd_vma output_base = 0;
reloc_howto_type *howto = reloc_entry->howto;
}
/* Is the address of the relocation really within the section? */
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (reloc_entry->address > sz / bfd_octets_per_byte (abfd))
+ 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
bfd_vma addend)
{
bfd_vma relocation;
- bfd_size_type sz;
/* Sanity check the address. */
- sz = input_section->rawsize ? input_section->rawsize : input_section->size;
- if (address > sz)
+ if (address > bfd_get_section_limit (input_bfd, input_section))
return bfd_reloc_outofrange;
/* This function assumes that we are dealing with a basic relocation