diff options
author | Alan Modra <amodra@gmail.com> | 2004-06-29 13:46:34 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2004-06-29 13:46:34 +0000 |
commit | 075154045b3a1c940a448846723be16e3c7e0930 (patch) | |
tree | 6f652dcc932a68d189593be11ae2da1fe7d0a4eb /bfd/elf32-m32r.c | |
parent | 950ad202a518f7deb8e4ef1b2a3b63e2e3d7450d (diff) | |
download | gdb-075154045b3a1c940a448846723be16e3c7e0930.zip gdb-075154045b3a1c940a448846723be16e3c7e0930.tar.gz gdb-075154045b3a1c940a448846723be16e3c7e0930.tar.bz2 |
* 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.
Diffstat (limited to 'bfd/elf32-m32r.c')
-rw-r--r-- | bfd/elf32-m32r.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index c6bc2be..6776a62 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -901,13 +901,11 @@ m32r_elf_do_10_pcrel_reloc (abfd, howto, input_section, data, offset, 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; @@ -972,7 +970,6 @@ m32r_elf_hi16_reloc (abfd, reloc_entry, symbol, data, { bfd_reloc_status_type ret; bfd_vma relocation; - bfd_size_type sz; struct m32r_hi16 *n; /* This part is from bfd_elf_generic_reloc. @@ -987,8 +984,7 @@ m32r_elf_hi16_reloc (abfd, reloc_entry, symbol, data, } /* 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; @@ -1141,7 +1137,6 @@ m32r_elf_generic_reloc (input_bfd, reloc_entry, symbol, data, { bfd_reloc_status_type ret; bfd_vma relocation; - bfd_size_type sz; bfd_byte *inplace_address; /* This part is from bfd_elf_generic_reloc. @@ -1162,8 +1157,7 @@ m32r_elf_generic_reloc (input_bfd, reloc_entry, symbol, data, 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; @@ -2578,6 +2572,7 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, 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); @@ -2695,7 +2690,6 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, else { bfd_vma relocation; - bfd_size_type sz; /* This is a final link. */ sym = NULL; @@ -2830,10 +2824,7 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, } /* 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; |