Blame SOURCES/gdb-rhbz1320945-power9-12of38.patch

01917d
commit 6346d5ca43719ba6fc3176c29fd58a83d439f011
01917d
Author: Alan Modra <amodra@gmail.com>
01917d
Date:   Mon Jan 19 10:36:26 2015 +1030
01917d
01917d
    Fallout from recent bfd_reloc_outofrange changes
01917d
    
01917d
    Commit ec93045b and cd21f5da introduced a large number of tic4x and
01917d
    tic54x regressions, due to the new checks being wrong for targets
01917d
    with octets_per_byte != 1.  To fix that I introduced a new
01917d
    bfd_get_section_limit_octets and performed the check on octets rather
01917d
    than byte adresses, reducing the number of bfd_octets_per_byte calls.
01917d
    bfd_octets_per_byte is rather expensive..
01917d
    
01917d
    I then wondered why the same bfd_reloc_outofrange check added to
01917d
    bfd_perform_relocation wasn't also added to bfd_install_relocation.
01917d
    The two functions are virtually identical and ought to remain that
01917d
    way.  However, adding the same check to bfd_install_relocation
01917d
    resulted in ld-elf "FAIL Link eh-group.o to eh-group" on many ELF
01917d
    targets, including x64_64-linux.  The reason being that eh-group.o
01917d
    has NONE relocs at the end of a section, and most targets give NONE
01917d
    relocs a non-zero size.  So if we are to keep the new outofrange
01917d
    check it appears that NONE relocs must have a zero size.
01917d
    
01917d
            * bfd-in.h (bfd_get_section_limit_octets): New define, extracted from..
01917d
            (bfd_get_section_limit): ..here.
01917d
            * reloc.c (bfd_perform_relocation): Correct bfd_reloc_outofrange check.
01917d
            (bfd_install_relocation, _bfd_final_link_relocate): Add same check here.
01917d
            * elf32-sh.c (sh_elf_reloc): Correct bfd_reloc_outofrange check.
01917d
            * elf32-ppc.c (ppc_elf_addr16_ha_reloc): Remove duplicated
01917d
            bfd_reloc_outofrange check.
01917d
            * bfd-in2.h: Regenerate.
01917d
    
01917d
            * cpu-ns32k.c (_bfd_do_ns32k_reloc_contents): Return bfd_reloc_ok
01917d
            on zero size relocs.
01917d
            * ecoff.c (ecoff_reloc_link_order): Likewise.
01917d
            * elf32-nds32.c (nds32_relocate_contents): Likewise.
01917d
            * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
01917d
    
01917d
            * reloc.c (_bfd_relocate_contents): Don't bomb on zero size relocs.
01917d
            (_bfd_clear_contents): Likewise.
01917d
            * elfxx-mips.c (mips_elf_obtain_contents): Likewise.
01917d
            (mips_elf_perform_relocation): Likewise.
01917d
    
01917d
            * aoutx.h (aout_link_reloc_link_order): Allow for NULL return
01917d
            from malloc on zero size alloc.
01917d
            * cofflink.c (_bfd_coff_reloc_link_order): Likewise.
01917d
            * elflink.c (elf_reloc_link_order): Likewise.
01917d
            * linker.c (_bfd_generic_reloc_link_order): Likewise.
01917d
            * pdp11.c (aout_link_reloc_link_order): Likewise.
01917d
            * xcofflink.c (xcoff_reloc_link_order): Likewise.
01917d
    
01917d
            * aoutx.h (howto_table_ext): Ensure NONE relocs have size 3,
01917d
            bitsize 0, and complain_overflow_dont.
01917d
            * coff-sparc.c (coff_sparc_howto_table): Likewise.
01917d
            * elf-hppa.h (elf_hppa_howto_table): Likewise.
01917d
            * elf-m10200.c (elf_mn10200_howto_table): Likewise.
01917d
            * elf-m10300.c (elf_mn10300_howto_table): Likewise.
01917d
            * elf32-arc.c (elf_arc_howto_table): Likewise.
01917d
            * elf32-arm.c (elf32_arm_howto_table_1): Likewise.
01917d
            * elf32-avr.c (elf_avr_howto_table): Likewise.
01917d
            * elf32-bfin.c (bfin_howto_table): Likewise.
01917d
            * elf32-cr16.c (cr16_elf_howto_table): Likewise.
01917d
            * elf32-cris.c (cris_elf_howto_table): Likewise.
01917d
            * elf32-crx.c (crx_elf_howto_table): Likewise.
01917d
            * elf32-d10v.c (elf_d10v_howto_table): Likewise.
01917d
            * elf32-d30v.c (elf_d30v_howto_table): Likewise.
01917d
            * elf32-dlx.c (dlx_elf_howto_table): Likewise.
01917d
            * elf32-epiphany.c (epiphany_elf_howto_table): Likewise.
01917d
            * elf32-fr30.c (fr30_elf_howto_table): Likewise.
01917d
            * elf32-frv.c (elf32_frv_howto_table): Likewise.
01917d
            * elf32-h8300.c (h8_elf_howto_table): Likewise.
01917d
            * elf32-i370.c (i370_elf_howto_raw): Likewise.
01917d
            * elf32-i386.c (elf_howto_table): Likewise.
01917d
            * elf32-i860.c (elf32_i860_howto_table): Likewise.
01917d
            * elf32-i960.c (elf32_i960_relocate): Likewise.
01917d
            * elf32-ip2k.c (ip2k_elf_howto_table): Likewise.
01917d
            * elf32-iq2000.c (iq2000_elf_howto_table): Likewise.
01917d
            * elf32-lm32.c (lm32_elf_howto_table): Likewise.
01917d
            * elf32-m32c.c (m32c_elf_howto_table): Likewise.
01917d
            * elf32-m32r.c (m32r_elf_howto_table): Likewise.
01917d
            * elf32-m68hc11.c (elf_m68hc11_howto_table): Likewise.
01917d
            * elf32-m68hc12.c (elf_m68hc11_howto_table): Likewise.
01917d
            * elf32-m68k.c (howto_table): Likewise.
01917d
            * elf32-mcore.c (mcore_elf_howto_raw): Likewise.
01917d
            * elf32-mep.c (mep_elf_howto_table): Likewise.
01917d
            * elf32-metag.c (elf_metag_howto_table): Likewise.
01917d
            * elf32-microblaze.c (microblaze_elf_howto_raw): Likewise.
01917d
            * elf32-mips.c (elf_mips_howto_table_rel): Likewise.
01917d
            * elf32-moxie.c (moxie_elf_howto_table): Likewise.
01917d
            * elf32-msp430.c (elf_msp430_howto_table): Likewise.
01917d
            * elf32-mt.c (mt_elf_howto_table): Likewise.
01917d
            * elf32-nds32.c (nds32_elf_howto_table): Likewise.
01917d
            * elf32-nios2.c (elf_nios2_howto_table_rel): Likewise.
01917d
            * elf32-or1k.c (or1k_elf_howto_table): Likewise.
01917d
            * elf32-pj.c (pj_elf_howto_table): Likewise.
01917d
            * elf32-ppc.c (ppc_elf_howto_raw): Likewise.
01917d
            * elf32-rl78.c (rl78_elf_howto_table): Likewise.
01917d
            * elf32-rx.c (rx_elf_howto_table): Likewise.
01917d
            * elf32-s390.c (elf_howto_table): Likewise.
01917d
            * elf32-score.c (elf32_score_howto_table): Likewise.
01917d
            * elf32-score7.c (elf32_score_howto_table): Likewise.
01917d
            * elf32-sh-relocs.h (R_SH_NONE): Likewise.
01917d
            * elf32-spu.c (elf_howto_table): Likewise.
01917d
            * elf32-tic6x.c (elf32_tic6x_howto_table): Likewise.
01917d
            * elf32-tilepro.c (tilepro_elf_howto_table): Likewise.
01917d
            * elf32-v850.c (v850_elf_howto_table): Likewise.
01917d
            * elf32-vax.c (howto_table): Likewise.
01917d
            * elf32-visium.c (visium_elf_howto_table): Likewise.
01917d
            * elf32-xc16x.c (xc16x_elf_howto_table): Likewise.
01917d
            * elf32-xgate.c (elf_xgate_howto_table): Likewise.
01917d
            * elf32-xstormy16.c (xstormy16_elf_howto_table): Likewise.
01917d
            * elf32-xtensa.c (elf_howto_table): Likewise.
01917d
            * elf64-alpha.c (elf64_alpha_howto_table): Likewise.
01917d
            * elf64-mips.c (mips_elf64_howto_table_rel): Likewise.
01917d
            * elf64-mmix.c (elf_mmix_howto_table): Likewise.
01917d
            * elf64-ppc.c (ppc64_elf_howto_raw): Likewise.
01917d
            * elf64-s390.c (elf_howto_table): Likewise.
01917d
            * elf64-sh64.c (sh_elf64_howto_table): Likewise.
01917d
            * elf64-x86-64.c (x86_64_elf_howto_table): Likewise.
01917d
            * elfn32-mips.c (elf_mips_howto_table_rel): Likewise.
01917d
            * elfnn-aarch64.c (elfNN_aarch64_howto_table): Likewise.
01917d
            (elfNN_aarch64_howto_none): Likewise.
01917d
            * elfxx-ia64.c (ia64_howto_table): Likewise.
01917d
            * elfxx-sparc.c (_bfd_sparc_elf_howto_table): Likewise.
01917d
            * elfxx-tilegx.c (tilegx_elf_howto_table): Likewise.
01917d
            * nlm32-sparc.c (nlm32_sparc_howto_table): Likewise.
01917d
01917d
### a/bfd/ChangeLog
01917d
### b/bfd/ChangeLog
01917d
## -1,3 +1,109 @@
01917d
+2015-01-19  Alan Modra  <amodra@gmail.com>
01917d
+
01917d
+	* bfd-in.h (bfd_get_section_limit_octets): New define, extracted from..
01917d
+	(bfd_get_section_limit): ..here.
01917d
+	* reloc.c (bfd_perform_relocation): Correct bfd_reloc_outofrange check.
01917d
+	(bfd_install_relocation, _bfd_final_link_relocate): Add same check here.
01917d
+	* elf32-sh.c (sh_elf_reloc): Correct bfd_reloc_outofrange check.
01917d
+	* elf32-ppc.c (ppc_elf_addr16_ha_reloc): Remove duplicated
01917d
+	bfd_reloc_outofrange check.
01917d
+	* bfd-in2.h: Regenerate.
01917d
+
01917d
+	* cpu-ns32k.c (_bfd_do_ns32k_reloc_contents): Return bfd_reloc_ok
01917d
+	on zero size relocs.
01917d
+	* ecoff.c (ecoff_reloc_link_order): Likewise.
01917d
+	* elf32-nds32.c (nds32_relocate_contents): Likewise.
01917d
+	* elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
01917d
+
01917d
+	* reloc.c (_bfd_relocate_contents): Don't bomb on zero size relocs.
01917d
+	(_bfd_clear_contents): Likewise.
01917d
+	* elfxx-mips.c (mips_elf_obtain_contents): Likewise.
01917d
+	(mips_elf_perform_relocation): Likewise.
01917d
+
01917d
+	* aoutx.h (aout_link_reloc_link_order): Allow for NULL return
01917d
+	from malloc on zero size alloc.
01917d
+	* cofflink.c (_bfd_coff_reloc_link_order): Likewise.
01917d
+	* elflink.c (elf_reloc_link_order): Likewise.
01917d
+	* linker.c (_bfd_generic_reloc_link_order): Likewise.
01917d
+	* pdp11.c (aout_link_reloc_link_order): Likewise.
01917d
+	* xcofflink.c (xcoff_reloc_link_order): Likewise.
01917d
+
01917d
+	* aoutx.h (howto_table_ext): Ensure NONE relocs have size 3,
01917d
+	bitsize 0, and complain_overflow_dont.
01917d
+	* coff-sparc.c (coff_sparc_howto_table): Likewise.
01917d
+	* elf-hppa.h (elf_hppa_howto_table): Likewise.
01917d
+	* elf-m10200.c (elf_mn10200_howto_table): Likewise.
01917d
+	* elf-m10300.c (elf_mn10300_howto_table): Likewise.
01917d
+	* elf32-arc.c (elf_arc_howto_table): Likewise.
01917d
+	* elf32-arm.c (elf32_arm_howto_table_1): Likewise.
01917d
+	* elf32-avr.c (elf_avr_howto_table): Likewise.
01917d
+	* elf32-bfin.c (bfin_howto_table): Likewise.
01917d
+	* elf32-cr16.c (cr16_elf_howto_table): Likewise.
01917d
+	* elf32-cris.c (cris_elf_howto_table): Likewise.
01917d
+	* elf32-crx.c (crx_elf_howto_table): Likewise.
01917d
+	* elf32-d10v.c (elf_d10v_howto_table): Likewise.
01917d
+	* elf32-d30v.c (elf_d30v_howto_table): Likewise.
01917d
+	* elf32-dlx.c (dlx_elf_howto_table): Likewise.
01917d
+	* elf32-epiphany.c (epiphany_elf_howto_table): Likewise.
01917d
+	* elf32-fr30.c (fr30_elf_howto_table): Likewise.
01917d
+	* elf32-frv.c (elf32_frv_howto_table): Likewise.
01917d
+	* elf32-h8300.c (h8_elf_howto_table): Likewise.
01917d
+	* elf32-i370.c (i370_elf_howto_raw): Likewise.
01917d
+	* elf32-i386.c (elf_howto_table): Likewise.
01917d
+	* elf32-i860.c (elf32_i860_howto_table): Likewise.
01917d
+	* elf32-i960.c (elf32_i960_relocate): Likewise.
01917d
+	* elf32-ip2k.c (ip2k_elf_howto_table): Likewise.
01917d
+	* elf32-iq2000.c (iq2000_elf_howto_table): Likewise.
01917d
+	* elf32-lm32.c (lm32_elf_howto_table): Likewise.
01917d
+	* elf32-m32c.c (m32c_elf_howto_table): Likewise.
01917d
+	* elf32-m32r.c (m32r_elf_howto_table): Likewise.
01917d
+	* elf32-m68hc11.c (elf_m68hc11_howto_table): Likewise.
01917d
+	* elf32-m68hc12.c (elf_m68hc11_howto_table): Likewise.
01917d
+	* elf32-m68k.c (howto_table): Likewise.
01917d
+	* elf32-mcore.c (mcore_elf_howto_raw): Likewise.
01917d
+	* elf32-mep.c (mep_elf_howto_table): Likewise.
01917d
+	* elf32-metag.c (elf_metag_howto_table): Likewise.
01917d
+	* elf32-microblaze.c (microblaze_elf_howto_raw): Likewise.
01917d
+	* elf32-mips.c (elf_mips_howto_table_rel): Likewise.
01917d
+	* elf32-moxie.c (moxie_elf_howto_table): Likewise.
01917d
+	* elf32-msp430.c (elf_msp430_howto_table): Likewise.
01917d
+	* elf32-mt.c (mt_elf_howto_table): Likewise.
01917d
+	* elf32-nds32.c (nds32_elf_howto_table): Likewise.
01917d
+	* elf32-nios2.c (elf_nios2_howto_table_rel): Likewise.
01917d
+	* elf32-or1k.c (or1k_elf_howto_table): Likewise.
01917d
+	* elf32-pj.c (pj_elf_howto_table): Likewise.
01917d
+	* elf32-ppc.c (ppc_elf_howto_raw): Likewise.
01917d
+	* elf32-rl78.c (rl78_elf_howto_table): Likewise.
01917d
+	* elf32-rx.c (rx_elf_howto_table): Likewise.
01917d
+	* elf32-s390.c (elf_howto_table): Likewise.
01917d
+	* elf32-score.c (elf32_score_howto_table): Likewise.
01917d
+	* elf32-score7.c (elf32_score_howto_table): Likewise.
01917d
+	* elf32-sh-relocs.h (R_SH_NONE): Likewise.
01917d
+	* elf32-spu.c (elf_howto_table): Likewise.
01917d
+	* elf32-tic6x.c (elf32_tic6x_howto_table): Likewise.
01917d
+	* elf32-tilepro.c (tilepro_elf_howto_table): Likewise.
01917d
+	* elf32-v850.c (v850_elf_howto_table): Likewise.
01917d
+	* elf32-vax.c (howto_table): Likewise.
01917d
+	* elf32-visium.c (visium_elf_howto_table): Likewise.
01917d
+	* elf32-xc16x.c (xc16x_elf_howto_table): Likewise.
01917d
+	* elf32-xgate.c (elf_xgate_howto_table): Likewise.
01917d
+	* elf32-xstormy16.c (xstormy16_elf_howto_table): Likewise.
01917d
+	* elf32-xtensa.c (elf_howto_table): Likewise.
01917d
+	* elf64-alpha.c (elf64_alpha_howto_table): Likewise.
01917d
+	* elf64-mips.c (mips_elf64_howto_table_rel): Likewise.
01917d
+	* elf64-mmix.c (elf_mmix_howto_table): Likewise.
01917d
+	* elf64-ppc.c (ppc64_elf_howto_raw): Likewise.
01917d
+	* elf64-s390.c (elf_howto_table): Likewise.
01917d
+	* elf64-sh64.c (sh_elf64_howto_table): Likewise.
01917d
+	* elf64-x86-64.c (x86_64_elf_howto_table): Likewise.
01917d
+	* elfn32-mips.c (elf_mips_howto_table_rel): Likewise.
01917d
+	* elfnn-aarch64.c (elfNN_aarch64_howto_table): Likewise.
01917d
+	(elfNN_aarch64_howto_none): Likewise.
01917d
+	* elfxx-ia64.c (ia64_howto_table): Likewise.
01917d
+	* elfxx-sparc.c (_bfd_sparc_elf_howto_table): Likewise.
01917d
+	* elfxx-tilegx.c (tilegx_elf_howto_table): Likewise.
01917d
+	* nlm32-sparc.c (nlm32_sparc_howto_table): Likewise.
01917d
+
01917d
 2015-01-15  H.J. Lu  <hongjiu.lu@intel.com>
01917d
 
01917d
 	PR ld/17847
01917d
--- a/bfd/aoutx.h
01917d
+++ b/bfd/aoutx.h
01917d
@@ -203,8 +203,8 @@ reloc_howto_type howto_table_ext[] =
01917d
   HOWTO (RELOC_GLOB_DAT,0,  2,	0,  FALSE, 0, complain_overflow_bitfield, 0, "GLOB_DAT",    FALSE, 0, 0x00000000, FALSE),
01917d
   HOWTO (RELOC_JMP_SLOT,0,  2,	0,  FALSE, 0, complain_overflow_bitfield, 0, "JMP_SLOT",    FALSE, 0, 0x00000000, FALSE),
01917d
   HOWTO (RELOC_RELATIVE,0,  2,	0,  FALSE, 0, complain_overflow_bitfield, 0, "RELATIVE",    FALSE, 0, 0x00000000, FALSE),
01917d
-  HOWTO (0,             0,  0,  0,  FALSE, 0, complain_overflow_dont,     0, "R_SPARC_NONE",FALSE, 0, 0x00000000, TRUE),
01917d
-  HOWTO (0,             0,  0,  0,  FALSE, 0, complain_overflow_dont,     0, "R_SPARC_NONE",FALSE, 0, 0x00000000, TRUE),
01917d
+  HOWTO (0,             0,  3,  0,  FALSE, 0, complain_overflow_dont,     0, "R_SPARC_NONE",FALSE, 0, 0x00000000, TRUE),
01917d
+  HOWTO (0,             0,  3,  0,  FALSE, 0, complain_overflow_dont,     0, "R_SPARC_NONE",FALSE, 0, 0x00000000, TRUE),
01917d
 #define RELOC_SPARC_REV32 RELOC_WDISP19
01917d
   HOWTO (RELOC_SPARC_REV32, 0, 2, 32, FALSE, 0, complain_overflow_dont,   0,"R_SPARC_REV32",FALSE, 0, 0xffffffff, FALSE),
01917d
 };
01917d
@@ -3816,7 +3816,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *flaginfo,
01917d
 
01917d
 	  size = bfd_get_reloc_size (howto);
01917d
 	  buf = (bfd_byte *) bfd_zmalloc (size);
01917d
-	  if (buf == NULL)
01917d
+	  if (buf == NULL && size != 0)
01917d
 	    return FALSE;
01917d
 	  r = MY_relocate_contents (howto, flaginfo->output_bfd,
01917d
 				    (bfd_vma) pr->addend, buf);
01917d
--- a/bfd/bfd-in.h
01917d
+++ b/bfd/bfd-in.h
01917d
@@ -292,10 +292,13 @@ typedef struct bfd_section *sec_ptr;
01917d
 
01917d
 #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
01917d
 
01917d
+#define bfd_get_section_limit_octets(bfd, sec)			\
01917d
+  ((bfd)->direction != write_direction && (sec)->rawsize != 0	\
01917d
+   ? (sec)->rawsize : (sec)->size)
01917d
+
01917d
 /* Find the address one past the end of SEC.  */
01917d
 #define bfd_get_section_limit(bfd, sec) \
01917d
-  (((bfd)->direction != write_direction && (sec)->rawsize != 0	\
01917d
-    ? (sec)->rawsize : (sec)->size) / bfd_octets_per_byte (bfd))
01917d
+  (bfd_get_section_limit_octets(bfd, sec) / bfd_octets_per_byte (bfd))
01917d
 
01917d
 /* Return TRUE if input section SEC has been discarded.  */
01917d
 #define discarded_section(sec)				\
01917d
--- a/bfd/bfd-in2.h
01917d
+++ b/bfd/bfd-in2.h
01917d
@@ -299,10 +299,13 @@ typedef struct bfd_section *sec_ptr;
01917d
 
01917d
 #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
01917d
 
01917d
+#define bfd_get_section_limit_octets(bfd, sec)			\
01917d
+  ((bfd)->direction != write_direction && (sec)->rawsize != 0	\
01917d
+   ? (sec)->rawsize : (sec)->size)
01917d
+
01917d
 /* Find the address one past the end of SEC.  */
01917d
 #define bfd_get_section_limit(bfd, sec) \
01917d
-  (((bfd)->direction != write_direction && (sec)->rawsize != 0	\
01917d
-    ? (sec)->rawsize : (sec)->size) / bfd_octets_per_byte (bfd))
01917d
+  (bfd_get_section_limit_octets(bfd, sec) / bfd_octets_per_byte (bfd))
01917d
 
01917d
 /* Return TRUE if input section SEC has been discarded.  */
01917d
 #define discarded_section(sec)				\
01917d
--- a/bfd/coff-sparc.c
01917d
+++ b/bfd/coff-sparc.c
01917d
@@ -74,7 +74,7 @@ bfd_coff_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED,
01917d
 
01917d
 static reloc_howto_type coff_sparc_howto_table[] =
01917d
 {
01917d
-  HOWTO(R_SPARC_NONE,    0,0, 0,FALSE,0,complain_overflow_dont,    bfd_coff_generic_reloc,"R_SPARC_NONE",    FALSE,0,0x00000000,TRUE),
01917d
+  HOWTO(R_SPARC_NONE,    0,3, 0,FALSE,0,complain_overflow_dont,    bfd_coff_generic_reloc,"R_SPARC_NONE",    FALSE,0,0x00000000,TRUE),
01917d
   HOWTO(R_SPARC_8,       0,0, 8,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_8",       FALSE,0,0x000000ff,TRUE),
01917d
   HOWTO(R_SPARC_16,      0,1,16,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_16",      FALSE,0,0x0000ffff,TRUE),
01917d
   HOWTO(R_SPARC_32,      0,2,32,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_32",      FALSE,0,0xffffffff,TRUE),
01917d
--- a/bfd/cofflink.c
01917d
+++ b/bfd/cofflink.c
01917d
@@ -2789,7 +2789,7 @@ _bfd_coff_reloc_link_order (bfd *output_bfd,
01917d
 
01917d
       size = bfd_get_reloc_size (howto);
01917d
       buf = (bfd_byte *) bfd_zmalloc (size);
01917d
-      if (buf == NULL)
01917d
+      if (buf == NULL && size != 0)
01917d
 	return FALSE;
01917d
 
01917d
       rstat = _bfd_relocate_contents (howto, output_bfd,
01917d
--- a/bfd/cpu-ns32k.c
01917d
+++ b/bfd/cpu-ns32k.c
01917d
@@ -585,8 +585,9 @@ _bfd_do_ns32k_reloc_contents (reloc_howto_type *howto,
01917d
   switch (size)
01917d
     {
01917d
     default:
01917d
-    case 0:
01917d
       abort ();
01917d
+    case 0:
01917d
+      return bfd_reloc_ok;
01917d
     case 1:
01917d
     case 2:
01917d
     case 4:
01917d
--- a/bfd/ecoff.c
01917d
+++ b/bfd/ecoff.c
01917d
@@ -3999,7 +3999,7 @@ ecoff_reloc_link_order (bfd *output_bfd,
01917d
 
01917d
       size = bfd_get_reloc_size (rel.howto);
01917d
       buf = (bfd_byte *) bfd_zmalloc (size);
01917d
-      if (buf == NULL)
01917d
+      if (buf == NULL && size != 0)
01917d
 	return FALSE;
01917d
       rstat = _bfd_relocate_contents (rel.howto, output_bfd,
01917d
 				      (bfd_vma) addend, buf);
01917d
--- a/bfd/elf-hppa.h
01917d
+++ b/bfd/elf-hppa.h
01917d
@@ -47,7 +47,7 @@
01917d
 
01917d
 static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
01917d
 {
01917d
-  { R_PARISC_NONE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
01917d
+  { R_PARISC_NONE, 0, 3, 0, FALSE, 0, complain_overflow_dont,
01917d
     bfd_elf_generic_reloc, "R_PARISC_NONE", FALSE, 0, 0, FALSE },
01917d
 
01917d
   /* The values in DIR32 are to placate the check in
01917d
--- a/bfd/elf-m10200.c
01917d
+++ b/bfd/elf-m10200.c
01917d
@@ -46,11 +46,11 @@ static reloc_howto_type elf_mn10200_howto_table[] =
01917d
   /* Dummy relocation.  Does nothing.  */
01917d
   HOWTO (R_MN10200_NONE,
01917d
 	 0,
01917d
-	 2,
01917d
-	 16,
01917d
+	 3,
01917d
+	 0,
01917d
 	 FALSE,
01917d
 	 0,
01917d
-	 complain_overflow_bitfield,
01917d
+	 complain_overflow_dont,
01917d
 	 bfd_elf_generic_reloc,
01917d
 	 "R_MN10200_NONE",
01917d
 	 FALSE,
01917d
--- a/bfd/elf-m10300.c
01917d
+++ b/bfd/elf-m10300.c
01917d
@@ -142,11 +142,11 @@ static reloc_howto_type elf_mn10300_howto_table[] =
01917d
   /* Dummy relocation.  Does nothing.  */
01917d
   HOWTO (R_MN10300_NONE,
01917d
 	 0,
01917d
-	 2,
01917d
-	 16,
01917d
+	 3,
01917d
+	 0,
01917d
 	 FALSE,
01917d
 	 0,
01917d
-	 complain_overflow_bitfield,
01917d
+	 complain_overflow_dont,
01917d
 	 bfd_elf_generic_reloc,
01917d
 	 "R_MN10300_NONE",
01917d
 	 FALSE,
01917d
--- a/bfd/elf32-arc.c
01917d
+++ b/bfd/elf32-arc.c
01917d
@@ -58,8 +58,8 @@ static reloc_howto_type elf_arc_howto_table[] =
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_ARC_NONE,		/* Type.  */
01917d
 	 0,			/* Rightshift.  */
01917d
-	 2,			/* Size (0 = byte, 1 = short, 2 = long).  */
01917d
-	 32,			/* Bitsize.  */
01917d
+	 3,			/* Size (0 = byte, 1 = short, 2 = long).  */
01917d
+	 0,			/* Bitsize.  */
01917d
 	 FALSE,			/* PC_relative.  */
01917d
 	 0,			/* Bitpos.  */
01917d
 	 complain_overflow_bitfield, /* Complain_on_overflow.  */
01917d
--- a/bfd/elf32-arm.c
01917d
+++ b/bfd/elf32-arm.c
01917d
@@ -79,7 +79,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
01917d
   /* No relocation.  */
01917d
   HOWTO (R_ARM_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
 	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
--- a/bfd/elf32-avr.c
01917d
+++ b/bfd/elf32-avr.c
01917d
@@ -121,11 +121,11 @@ static reloc_howto_type elf_avr_howto_table[] =
01917d
 {
01917d
   HOWTO (R_AVR_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_AVR_NONE",		/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
--- a/bfd/elf32-bfin.c
01917d
+++ b/bfd/elf32-bfin.c
01917d
@@ -423,11 +423,11 @@ static reloc_howto_type bfin_howto_table [] =
01917d
   /* This reloc does nothing. .  */
01917d
   HOWTO (R_BFIN_UNUSED0,	/* type.  */
01917d
 	 0,			/* rightshift.  */
01917d
-	 2,			/* size (0 = byte, 1 = short, 2 = long).  */
01917d
-	 32,			/* bitsize.  */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long).  */
01917d
+	 0,			/* bitsize.  */
01917d
 	 FALSE,			/* pc_relative.  */
01917d
 	 0,			/* bitpos.  */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow.  */
01917d
+	 complain_overflow_dont, /* complain_on_overflow.  */
01917d
 	 bfd_elf_generic_reloc,	/* special_function.  */
01917d
 	 "R_BFIN_UNUSED0",	/* name.  */
01917d
 	 FALSE,			/* partial_inplace.  */
01917d
@@ -451,11 +451,11 @@ static reloc_howto_type bfin_howto_table [] =
01917d
 
01917d
   HOWTO (R_BFIN_UNUSED1,	/* type.  */
01917d
 	 0,			/* rightshift.  */
01917d
-	 2,			/* size (0 = byte, 1 = short, 2 = long).  */
01917d
-	 32,			/* bitsize.  */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long).  */
01917d
+	 0,			/* bitsize.  */
01917d
 	 FALSE,			/* pc_relative.  */
01917d
 	 0,			/* bitpos.  */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow.  */
01917d
+	 complain_overflow_dont, /* complain_on_overflow.  */
01917d
 	 bfd_elf_generic_reloc,	/* special_function.  */
01917d
 	 "R_BFIN_UNUSED1",	/* name.  */
01917d
 	 FALSE,			/* partial_inplace.  */
01917d
@@ -581,8 +581,8 @@ static reloc_howto_type bfin_howto_table [] =
01917d
 
01917d
   HOWTO (R_BFIN_UNUSEDB,	/* type.  */
01917d
 	 0,			/* rightshift.  */
01917d
-	 2,			/* size (0 = byte, 1 = short, 2 = long).  */
01917d
-	 32,			/* bitsize.  */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long).  */
01917d
+	 0,			/* bitsize.  */
01917d
 	 FALSE,			/* pc_relative.  */
01917d
 	 0,			/* bitpos.  */
01917d
 	 complain_overflow_dont, /* complain_on_overflow.  */
01917d
@@ -595,8 +595,8 @@ static reloc_howto_type bfin_howto_table [] =
01917d
 
01917d
   HOWTO (R_BFIN_UNUSEDC,	/* type.  */
01917d
 	 0,			/* rightshift.  */
01917d
-	 2,			/* size (0 = byte, 1 = short, 2 = long).  */
01917d
-	 32,			/* bitsize.  */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long).  */
01917d
+	 0,			/* bitsize.  */
01917d
 	 FALSE,			/* pc_relative.  */
01917d
 	 0,			/* bitpos.  */
01917d
 	 complain_overflow_dont, /* complain_on_overflow.  */
01917d
--- a/bfd/elf32-cr16.c
01917d
+++ b/bfd/elf32-cr16.c
01917d
@@ -115,8 +115,8 @@ static reloc_howto_type cr16_elf_howto_table[] =
01917d
 {
01917d
   HOWTO (R_CR16_NONE,              /* type */
01917d
          0,                        /* rightshift */
01917d
-         2,                        /* size */
01917d
-         32,                       /* bitsize */
01917d
+         3,                        /* size */
01917d
+         0,                        /* bitsize */
01917d
          FALSE,                    /* pc_relative */
01917d
          0,                        /* bitpos */
01917d
          complain_overflow_dont,   /* complain_on_overflow */
01917d
--- a/bfd/elf32-cris.c
01917d
+++ b/bfd/elf32-cris.c
01917d
@@ -40,11 +40,11 @@ static reloc_howto_type cris_elf_howto_table [] =
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_CRIS_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_CRIS_NONE",		/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
--- a/bfd/elf32-crx.c
01917d
+++ b/bfd/elf32-crx.c
01917d
@@ -82,8 +82,8 @@ static reloc_howto_type crx_elf_howto_table[] =
01917d
 {
01917d
   HOWTO (R_CRX_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 2,			/* size */
01917d
-	 32,			/* bitsize */
01917d
+	 3,			/* size */
01917d
+	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
 	 complain_overflow_dont,/* complain_on_overflow */
01917d
--- a/bfd/elf32-d10v.c
01917d
+++ b/bfd/elf32-d10v.c
01917d
@@ -33,8 +33,8 @@ static reloc_howto_type elf_d10v_howto_table[] =
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_D10V_NONE,		/* Type.  */
01917d
 	 0,			/* Rightshift.  */
01917d
-	 2,			/* Size (0 = byte, 1 = short, 2 = long).  */
01917d
-	 32,			/* Bitsize.  */
01917d
+	 3,			/* Size (0 = byte, 1 = short, 2 = long).  */
01917d
+	 0,			/* Bitsize.  */
01917d
 	 FALSE,			/* PC_relative.  */
01917d
 	 0,			/* Bitpos.  */
01917d
 	 complain_overflow_dont,/* Complain_on_overflow.  */
01917d
--- a/bfd/elf32-d30v.c
01917d
+++ b/bfd/elf32-d30v.c
01917d
@@ -254,11 +254,11 @@ static reloc_howto_type elf_d30v_howto_table[] =
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_D30V_NONE,		/* Type.  */
01917d
 	 0,			/* Rightshift.  */
01917d
-	 2,			/* Size (0 = byte, 1 = short, 2 = long).  */
01917d
-	 32,			/* Bitsize.  */
01917d
+	 3,			/* Size (0 = byte, 1 = short, 2 = long).  */
01917d
+	 0,			/* Bitsize.  */
01917d
 	 FALSE,			/* PC_relative.  */
01917d
 	 0,			/* Bitpos.  */
01917d
-	 complain_overflow_bitfield, /* Complain_on_overflow.  */
01917d
+	 complain_overflow_dont, /* Complain_on_overflow.  */
01917d
 	 bfd_elf_generic_reloc,	/* Special_function.  */
01917d
 	 "R_D30V_NONE",		/* Name.  */
01917d
 	 FALSE,			/* Partial_inplace.  */
01917d
--- a/bfd/elf32-dlx.c
01917d
+++ b/bfd/elf32-dlx.c
01917d
@@ -237,7 +237,7 @@ static reloc_howto_type dlx_elf_howto_table[]=
01917d
   /* No relocation.  */
01917d
   HOWTO (R_DLX_NONE,            /* Type. */
01917d
 	 0,                     /* Rightshift.  */
01917d
-	 0,                     /* size (0 = byte, 1 = short, 2 = long).  */
01917d
+	 3,                     /* size (0 = byte, 1 = short, 2 = long).  */
01917d
 	 0,                     /* Bitsize.  */
01917d
 	 FALSE,                 /* PC_relative.  */
01917d
 	 0,                     /* Bitpos.  */
01917d
--- a/bfd/elf32-epiphany.c
01917d
+++ b/bfd/elf32-epiphany.c
01917d
@@ -63,7 +63,7 @@ static reloc_howto_type epiphany_elf_howto_table [] =
01917d
 	  pr)                   /* pcrel_offset */
01917d
 
01917d
   /* This reloc does nothing.  */
01917d
-  AHOW (R_EPIPHANY_NONE,    0, 0,32, FALSE, 0, complain_overflow_dont,     "R_EPIPHANY_NONE",        0,          0),
01917d
+  AHOW (R_EPIPHANY_NONE,    0, 3,0, FALSE, 0, complain_overflow_dont,     "R_EPIPHANY_NONE",        0,          0),
01917d
 
01917d
   /* 8 bit absolute (not likely) */
01917d
   AHOW (R_EPIPHANY_8,       0, 0, 8, FALSE, 0, complain_overflow_bitfield, "R_EPIPHANY_8",      0x000000ff, 0x000000ff),
01917d
--- a/bfd/elf32-fr30.c
01917d
+++ b/bfd/elf32-fr30.c
01917d
@@ -37,11 +37,11 @@ static reloc_howto_type fr30_elf_howto_table [] =
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_FR30_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_FR30_NONE",		/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
--- a/bfd/elf32-frv.c
01917d
+++ b/bfd/elf32-frv.c
01917d
@@ -34,11 +34,11 @@ static reloc_howto_type elf32_frv_howto_table [] =
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_FRV_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_FRV_NONE",		/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
--- a/bfd/elf32-h8300.c
01917d
+++ b/bfd/elf32-h8300.c
01917d
@@ -61,7 +61,7 @@ static reloc_howto_type h8_elf_howto_table[] =
01917d
 #define R_H8_NONE_X 0
01917d
   HOWTO (R_H8_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
 	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
--- a/bfd/elf32-i370.c
01917d
+++ b/bfd/elf32-i370.c
01917d
@@ -40,11 +40,11 @@ static reloc_howto_type i370_elf_howto_raw[] =
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_I370_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_I370_NONE",		/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
--- a/bfd/elf32-i386.c
01917d
+++ b/bfd/elf32-i386.c
01917d
@@ -37,7 +37,7 @@
01917d
 
01917d
 static reloc_howto_type elf_howto_table[]=
01917d
 {
01917d
-  HOWTO(R_386_NONE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
01917d
+  HOWTO(R_386_NONE, 0, 3, 0, FALSE, 0, complain_overflow_dont,
01917d
 	bfd_elf_generic_reloc, "R_386_NONE",
01917d
 	TRUE, 0x00000000, 0x00000000, FALSE),
01917d
   HOWTO(R_386_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
01917d
--- a/bfd/elf32-i860.c
01917d
+++ b/bfd/elf32-i860.c
01917d
@@ -264,11 +264,11 @@ static reloc_howto_type elf32_i860_howto_table [] =
01917d
   /* This relocation does nothing.  */
01917d
   HOWTO (R_860_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_860_NONE",		/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
--- a/bfd/elf32-i960.c
01917d
+++ b/bfd/elf32-i960.c
01917d
@@ -83,7 +83,7 @@ elf32_i960_relocate (bfd *abfd ATTRIBUTE_UNUSED,
01917d
 
01917d
 static reloc_howto_type elf_howto_table[]=
01917d
 {
01917d
-  HOWTO (R_960_NONE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
01917d
+  HOWTO (R_960_NONE, 0, 3, 0, FALSE, 0, complain_overflow_dont,
01917d
 	 elf32_i960_relocate, "R_960_NONE", TRUE,
01917d
 	 0x00000000, 0x00000000, FALSE),
01917d
   EMPTY_HOWTO (1),
01917d
--- a/bfd/elf32-ip2k.c
01917d
+++ b/bfd/elf32-ip2k.c
01917d
@@ -141,7 +141,7 @@ static reloc_howto_type ip2k_elf_howto_table [] =
01917d
           pr)                   /* pcrel_offset */
01917d
 
01917d
   /* This reloc does nothing.  */
01917d
-  IP2K_HOWTO (R_IP2K_NONE, 0,2,32, FALSE, 0, "R_IP2K_NONE", 0, 0),
01917d
+  IP2K_HOWTO (R_IP2K_NONE, 0,3,0, FALSE, 0, "R_IP2K_NONE", 0, 0),
01917d
   /* A 16 bit absolute relocation.  */
01917d
   IP2K_HOWTO (R_IP2K_16, 0,1,16, FALSE, 0, "R_IP2K_16", 0, 0xffff),
01917d
   /* A 32 bit absolute relocation.  */
01917d
--- a/bfd/elf32-iq2000.c
01917d
+++ b/bfd/elf32-iq2000.c
01917d
@@ -34,11 +34,11 @@ static reloc_howto_type iq2000_elf_howto_table [] =
01917d
 
01917d
   HOWTO (R_IQ2000_NONE,		     /* type */
01917d
 	 0,			     /* rightshift */
01917d
-	 2,			     /* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			     /* bitsize */
01917d
+	 3,			     /* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 0,			     /* bitsize */
01917d
 	 FALSE,			     /* pc_relative */
01917d
 	 0,			     /* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_dont,     /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	     /* special_function */
01917d
 	 "R_IQ2000_NONE",	     /* name */
01917d
 	 FALSE,			     /* partial_inplace */
01917d
--- a/bfd/elf32-lm32.c
01917d
+++ b/bfd/elf32-lm32.c
01917d
@@ -262,11 +262,11 @@ static reloc_howto_type lm32_elf_howto_table [] =
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_LM32_NONE,               /* type */
01917d
          0,                         /* rightshift */
01917d
-         2,                         /* size (0 = byte, 1 = short, 2 = long) */
01917d
-         32,                        /* bitsize */
01917d
+         3,                         /* size (0 = byte, 1 = short, 2 = long) */
01917d
+         0,                         /* bitsize */
01917d
          FALSE,                     /* pc_relative */
01917d
          0,                         /* bitpos */
01917d
-         complain_overflow_bitfield,/* complain_on_overflow */
01917d
+         complain_overflow_dont,    /* complain_on_overflow */
01917d
          bfd_elf_generic_reloc,     /* special_function */
01917d
          "R_LM32_NONE",             /* name */
01917d
          FALSE,                     /* partial_inplace */
01917d
--- a/bfd/elf32-m32c.c
01917d
+++ b/bfd/elf32-m32c.c
01917d
@@ -47,11 +47,11 @@ static reloc_howto_type m32c_elf_howto_table [] =
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_M32C_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_M32C_NONE",		/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
--- a/bfd/elf32-m32r.c
01917d
+++ b/bfd/elf32-m32r.c
01917d
@@ -474,11 +474,11 @@ static reloc_howto_type m32r_elf_howto_table[] =
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_M32R_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_M32R_NONE",		/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
--- a/bfd/elf32-m68hc11.c
01917d
+++ b/bfd/elf32-m68hc11.c
01917d
@@ -65,8 +65,8 @@ static reloc_howto_type elf_m68hc11_howto_table[] = {
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_M68HC11_NONE,	/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
 	 complain_overflow_dont,/* complain_on_overflow */
01917d
--- a/bfd/elf32-m68hc12.c
01917d
+++ b/bfd/elf32-m68hc12.c
01917d
@@ -107,8 +107,8 @@ static reloc_howto_type elf_m68hc11_howto_table[] = {
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_M68HC11_NONE,	/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
 	 complain_overflow_dont,/* complain_on_overflow */
01917d
--- a/bfd/elf32-m68k.c
01917d
+++ b/bfd/elf32-m68k.c
01917d
@@ -31,7 +31,7 @@ elf_m68k_discard_copies (struct elf_link_hash_entry *, void *);
01917d
 
01917d
 static reloc_howto_type howto_table[] =
01917d
 {
01917d
-  HOWTO(R_68K_NONE,       0, 0, 0, FALSE,0, complain_overflow_dont,     bfd_elf_generic_reloc, "R_68K_NONE",      FALSE, 0, 0x00000000,FALSE),
01917d
+  HOWTO(R_68K_NONE,       0, 3, 0, FALSE,0, complain_overflow_dont,     bfd_elf_generic_reloc, "R_68K_NONE",      FALSE, 0, 0x00000000,FALSE),
01917d
   HOWTO(R_68K_32,         0, 2,32, FALSE,0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_68K_32",        FALSE, 0, 0xffffffff,FALSE),
01917d
   HOWTO(R_68K_16,         0, 1,16, FALSE,0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_68K_16",        FALSE, 0, 0x0000ffff,FALSE),
01917d
   HOWTO(R_68K_8,          0, 0, 8, FALSE,0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_68K_8",         FALSE, 0, 0x000000ff,FALSE),
01917d
--- a/bfd/elf32-mcore.c
01917d
+++ b/bfd/elf32-mcore.c
01917d
@@ -110,11 +110,11 @@ static reloc_howto_type mcore_elf_howto_raw[] =
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_MCORE_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield,  /* complain_on_overflow */
01917d
+	 complain_overflow_dont,  /* complain_on_overflow */
01917d
 	 NULL,                  /* special_function */
01917d
 	 "R_MCORE_NONE",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
--- a/bfd/elf32-mep.c
01917d
+++ b/bfd/elf32-mep.c
01917d
@@ -42,7 +42,7 @@ static bfd_reloc_status_type mep_reloc (bfd *, arelent *, struct bfd_symbol *,
01917d
 static reloc_howto_type mep_elf_howto_table [] =
01917d
 {
01917d
   /* type, size, bits, leftshift, rightshift, pcrel, OD/OS/OU, mask.  */
01917d
-  MEPREL (R_MEP_NONE,     0,  0, 0, 0, 0, N, 0),
01917d
+  MEPREL (R_MEP_NONE,     3,  0, 0, 0, 0, N, 0),
01917d
   MEPREL (R_RELC,         0,  0, 0, 0, 0, N, 0),
01917d
   /* MEPRELOC:HOWTO */
01917d
     /* This section generated from bfd/mep-relocs.pl from include/elf/mep.h.  */
01917d
--- a/bfd/elf32-metag.c
01917d
+++ b/bfd/elf32-metag.c
01917d
@@ -142,7 +142,7 @@ static reloc_howto_type elf_metag_howto_table[] =
01917d
   /* No relocation.  */
01917d
   HOWTO (R_METAG_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
 	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
--- a/bfd/elf32-microblaze.c
01917d
+++ b/bfd/elf32-microblaze.c
01917d
@@ -44,11 +44,11 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
01917d
    /* This reloc does nothing.  */
01917d
    HOWTO (R_MICROBLAZE_NONE,	/* Type.  */
01917d
           0,			/* Rightshift.  */
01917d
-          2,			/* Size (0 = byte, 1 = short, 2 = long).  */
01917d
-          32,			/* Bitsize.  */
01917d
+          3,			/* Size (0 = byte, 1 = short, 2 = long).  */
01917d
+          0,			/* Bitsize.  */
01917d
           FALSE,		/* PC_relative.  */
01917d
           0,			/* Bitpos.  */
01917d
-          complain_overflow_bitfield,  /* Complain on overflow.  */
01917d
+          complain_overflow_dont,  /* Complain on overflow.  */
01917d
           NULL,                  /* Special Function.  */
01917d
           "R_MICROBLAZE_NONE", 	/* Name.  */
01917d
           FALSE,		/* Partial Inplace.  */
01917d
@@ -179,11 +179,11 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
01917d
    /* This reloc does nothing.  Used for relaxation.  */
01917d
    HOWTO (R_MICROBLAZE_64_NONE,	/* Type.  */
01917d
           0,			/* Rightshift.  */
01917d
-          2,			/* Size (0 = byte, 1 = short, 2 = long).  */
01917d
-          32,			/* Bitsize.  */
01917d
+          3,			/* Size (0 = byte, 1 = short, 2 = long).  */
01917d
+          0,			/* Bitsize.  */
01917d
           TRUE,			/* PC_relative.  */
01917d
           0,			/* Bitpos.  */
01917d
-          complain_overflow_bitfield,  /* Complain on overflow.  */
01917d
+          complain_overflow_dont, /* Complain on overflow.  */
01917d
           NULL,                  /* Special Function.  */
01917d
           "R_MICROBLAZE_64_NONE",/* Name.  */
01917d
           FALSE,		/* Partial Inplace.  */
01917d
--- a/bfd/elf32-mips.c
01917d
+++ b/bfd/elf32-mips.c
01917d
@@ -107,7 +107,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] =
01917d
   /* No relocation.  */
01917d
   HOWTO (R_MIPS_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
 	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
--- a/bfd/elf32-moxie.c
01917d
+++ b/bfd/elf32-moxie.c
01917d
@@ -34,11 +34,11 @@ static reloc_howto_type moxie_elf_howto_table [] =
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_MOXIE_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_MOXIE_NONE",		/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
#--- a/bfd/elf32-msp430.c
01917d
#+++ b/bfd/elf32-msp430.c
01917d
#@@ -30,11 +30,11 @@ static reloc_howto_type elf_msp430_howto_table[] =
01917d
# {
01917d
#   HOWTO (R_MSP430_NONE,		/* type */
01917d
# 	 0,			/* rightshift */
01917d
#-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
#-	 32,			/* bitsize */
01917d
#+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
#+	 0,			/* bitsize */
01917d
# 	 FALSE,			/* pc_relative */
01917d
# 	 0,			/* bitpos */
01917d
#-	 complain_overflow_bitfield,/* complain_on_overflow */
01917d
#+	 complain_overflow_dont,/* complain_on_overflow */
01917d
# 	 bfd_elf_generic_reloc,	/* special_function */
01917d
# 	 "R_MSP430_NONE",	/* name */
01917d
# 	 FALSE,			/* partial_inplace */
01917d
#@@ -197,11 +197,11 @@ static reloc_howto_type elf_msp430x_howto_table[] =
01917d
# {
01917d
#   HOWTO (R_MSP430_NONE,		/* type */
01917d
# 	 0,			/* rightshift */
01917d
#-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
#-	 32,			/* bitsize */
01917d
#+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
#+	 0,			/* bitsize */
01917d
# 	 FALSE,			/* pc_relative */
01917d
# 	 0,			/* bitpos */
01917d
#-	 complain_overflow_bitfield,/* complain_on_overflow */
01917d
#+	 complain_overflow_dont,/* complain_on_overflow */
01917d
# 	 bfd_elf_generic_reloc,	/* special_function */
01917d
# 	 "R_MSP430_NONE",	/* name */
01917d
# 	 FALSE,			/* partial_inplace */
01917d
--- a/bfd/elf32-mt.c
01917d
+++ b/bfd/elf32-mt.c
01917d
@@ -48,8 +48,8 @@ static reloc_howto_type mt_elf_howto_table [] =
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_MT_NONE,           /* type */
01917d
           0,                      /* rightshift */
01917d
-          2,                      /* size (0 = byte, 1 = short, 2 = long) */
01917d
-          32,                     /* bitsize */
01917d
+          3,                      /* size (0 = byte, 1 = short, 2 = long) */
01917d
+          0,                      /* bitsize */
01917d
           FALSE,                  /* pc_relative */
01917d
           0,                      /* bitpos */
01917d
           complain_overflow_dont, /* complain_on_overflow */
01917d
#--- a/bfd/elf32-nds32.c
01917d
#+++ b/bfd/elf32-nds32.c
01917d
#@@ -321,11 +321,11 @@ static reloc_howto_type nds32_elf_howto_table[] =
01917d
#   /* This reloc does nothing.  */
01917d
#   HOWTO (R_NDS32_NONE,		/* type */
01917d
# 	 0,			/* rightshift */
01917d
#-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
#-	 32,			/* bitsize */
01917d
#+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
#+	 0,			/* bitsize */
01917d
# 	 FALSE,			/* pc_relative */
01917d
# 	 0,			/* bitpos */
01917d
#-	 complain_overflow_bitfield,	/* complain_on_overflow */
01917d
#+	 complain_overflow_dont,	/* complain_on_overflow */
01917d
# 	 bfd_elf_generic_reloc,	/* special_function */
01917d
# 	 "R_NDS32_NONE",	/* name */
01917d
# 	 FALSE,			/* partial_inplace */
01917d
#@@ -4186,11 +4186,10 @@ nds32_relocate_contents (reloc_howto_type *howto, bfd *input_bfd,
01917d
#   switch (size)
01917d
#     {
01917d
#     default:
01917d
#-    case 0:
01917d
#-    case 1:
01917d
#-    case 8:
01917d
#       abort ();
01917d
#       break;
01917d
#+    case 0:
01917d
#+      return bfd_reloc_ok;
01917d
#     case 2:
01917d
#       x = bfd_getb16 (location);
01917d
#       break;
01917d
--- a/bfd/elf32-nios2.c
01917d
+++ b/bfd/elf32-nios2.c
01917d
@@ -80,7 +80,7 @@ static reloc_howto_type elf_nios2_howto_table_rel[] = {
01917d
   /* No relocation.  */
01917d
   HOWTO (R_NIOS2_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
 	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
#--- a/bfd/elf32-or1k.c
01917d
#+++ b/bfd/elf32-or1k.c
01917d
#@@ -60,8 +60,8 @@ static reloc_howto_type or1k_elf_howto_table[] =
01917d
#   /* This reloc does nothing.  */
01917d
#   HOWTO (R_OR1K_NONE,           /* type */
01917d
#          0,                     /* rightshift */
01917d
#-         2,                     /* size (0 = byte, 1 = short, 2 = long) */
01917d
#-         32,                    /* bitsize */
01917d
#+         3,                     /* size (0 = byte, 1 = short, 2 = long) */
01917d
#+         0,                     /* bitsize */
01917d
#          FALSE,                 /* pc_relative */
01917d
#          0,                     /* bitpos */
01917d
#          complain_overflow_dont, /* complain_on_overflow */
01917d
--- a/bfd/elf32-pj.c
01917d
+++ b/bfd/elf32-pj.c
01917d
@@ -113,7 +113,7 @@ static reloc_howto_type pj_elf_howto_table[] =
01917d
   /* No relocation.  */
01917d
   HOWTO (R_PJ_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
 	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
--- a/bfd/elf32-ppc.c
01917d
+++ b/bfd/elf32-ppc.c
01917d
@@ -187,8 +187,8 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_PPC_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
 	 complain_overflow_dont, /* complain_on_overflow */
01917d
@@ -2066,9 +2066,6 @@ ppc_elf_addr16_ha_reloc (bfd *abfd ATTRIBUTE_UNUSED,
01917d
       return bfd_reloc_ok;
01917d
     }
01917d
 
01917d
-  if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
01917d
-    return bfd_reloc_outofrange;
01917d
-
01917d
   if (bfd_is_com_section (symbol->section))
01917d
     relocation = 0;
01917d
   else
01917d
--- a/bfd/elf32-rl78.c
01917d
+++ b/bfd/elf32-rl78.c
01917d
@@ -37,7 +37,7 @@
01917d
 
01917d
 static reloc_howto_type rl78_elf_howto_table [] =
01917d
 {
01917d
-  RL78REL (NONE,         0,  0, 0, dont,     FALSE),
01917d
+  RL78REL (NONE,         3,  0, 0, dont,     FALSE),
01917d
   RL78REL (DIR32,        2, 32, 0, signed,   FALSE),
01917d
   RL78REL (DIR24S,       2, 24, 0, signed,   FALSE),
01917d
   RL78REL (DIR16,        1, 16, 0, dont,     FALSE),
01917d
--- a/bfd/elf32-rx.c
01917d
+++ b/bfd/elf32-rx.c
01917d
@@ -49,7 +49,7 @@ void rx_dump_symtab (bfd *, void *, void *);
01917d
 
01917d
 static reloc_howto_type rx_elf_howto_table [] =
01917d
 {
01917d
-  RXREL (NONE,         0,  0, 0, dont,     FALSE),
01917d
+  RXREL (NONE,         3,  0, 0, dont,     FALSE),
01917d
   RXREL (DIR32,        2, 32, 0, signed,   FALSE),
01917d
   RXREL (DIR24S,       2, 24, 0, signed,   FALSE),
01917d
   RXREL (DIR16,        1, 16, 0, dont,     FALSE),
01917d
--- a/bfd/elf32-s390.c
01917d
+++ b/bfd/elf32-s390.c
01917d
@@ -39,7 +39,7 @@ static reloc_howto_type elf_howto_table[] =
01917d
 {
01917d
   HOWTO (R_390_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 0,			/* size (0 = byte, 1 = 2 byte, 2 = 4 byte) */
01917d
+	 3,			/* size (0 = byte, 1 = 2 byte, 2 = 4 byte) */
01917d
 	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
--- a/bfd/elf32-score.c
01917d
+++ b/bfd/elf32-score.c
01917d
@@ -645,7 +645,7 @@ static reloc_howto_type elf32_score_howto_table[] =
01917d
   /* No relocation.  */
01917d
   HOWTO (R_SCORE_NONE,          /* type */
01917d
          0,                     /* rightshift */
01917d
-         0,                     /* size (0 = byte, 1 = short, 2 = long) */
01917d
+         3,                     /* size (0 = byte, 1 = short, 2 = long) */
01917d
          0,                     /* bitsize */
01917d
          FALSE,                 /* pc_relative */
01917d
          0,                     /* bitpos */
01917d
--- a/bfd/elf32-score7.c
01917d
+++ b/bfd/elf32-score7.c
01917d
@@ -546,7 +546,7 @@ static reloc_howto_type elf32_score_howto_table[] =
01917d
   /* No relocation.  */
01917d
   HOWTO (R_SCORE_NONE,          /* type */
01917d
          0,                     /* rightshift */
01917d
-         0,                     /* size (0 = byte, 1 = short, 2 = long) */
01917d
+         3,                     /* size (0 = byte, 1 = short, 2 = long) */
01917d
          0,                     /* bitsize */
01917d
          FALSE,                 /* pc_relative */
01917d
          0,                     /* bitpos */
01917d
--- a/bfd/elf32-sh-relocs.h
01917d
+++ b/bfd/elf32-sh-relocs.h
01917d
@@ -20,7 +20,7 @@
01917d
 /* No relocation.  */
01917d
   HOWTO (R_SH_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
 	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
--- a/bfd/elf32-sh.c
01917d
+++ b/bfd/elf32-sh.c
01917d
@@ -256,10 +256,8 @@ sh_elf_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol_in,
01917d
     return bfd_reloc_undefined;
01917d
 
01917d
   /* PR 17512: file: 9891ca98.  */
01917d
-  if (addr > bfd_get_section_limit (abfd, input_section)
01917d
-      - bfd_get_reloc_size (reloc_entry->howto)
01917d
-      || bfd_get_reloc_size (reloc_entry->howto)
01917d
-      > bfd_get_section_limit (abfd, input_section))
01917d
+  if (addr * bfd_octets_per_byte (abfd) + bfd_get_reloc_size (reloc_entry->howto)
01917d
+      > bfd_get_section_limit_octets (abfd, input_section))
01917d
     return bfd_reloc_outofrange;
01917d
 
01917d
   if (bfd_is_com_section (symbol_in->section))
01917d
--- a/bfd/elf32-spu.c
01917d
+++ b/bfd/elf32-spu.c
01917d
@@ -37,7 +37,7 @@ static bfd_reloc_status_type spu_elf_rel9 (bfd *, arelent *, asymbol *,
01917d
    array, so it must be declared in the order of that type.  */
01917d
 
01917d
 static reloc_howto_type elf_howto_table[] = {
01917d
-  HOWTO (R_SPU_NONE,       0, 0,  0, FALSE,  0, complain_overflow_dont,
01917d
+  HOWTO (R_SPU_NONE,       0, 3,  0, FALSE,  0, complain_overflow_dont,
01917d
 	 bfd_elf_generic_reloc, "SPU_NONE",
01917d
 	 FALSE, 0, 0x00000000, FALSE),
01917d
   HOWTO (R_SPU_ADDR10,     4, 2, 10, FALSE, 14, complain_overflow_bitfield,
01917d
--- a/bfd/elf32-tic6x.c
01917d
+++ b/bfd/elf32-tic6x.c
01917d
@@ -152,7 +152,7 @@ static reloc_howto_type elf32_tic6x_howto_table[] =
01917d
 {
01917d
   HOWTO (R_C6000_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
 	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
@@ -820,7 +820,7 @@ static reloc_howto_type elf32_tic6x_howto_table_rel[] =
01917d
 {
01917d
   HOWTO (R_C6000_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
 	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
--- a/bfd/elf32-tilepro.c
01917d
+++ b/bfd/elf32-tilepro.c
01917d
@@ -34,11 +34,11 @@ static reloc_howto_type tilepro_elf_howto_table [] =
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_TILEPRO_NONE,	/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_TILEPRO_NONE",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
--- a/bfd/elf32-v850.c
01917d
+++ b/bfd/elf32-v850.c
01917d
@@ -895,11 +895,11 @@ static reloc_howto_type v850_elf_howto_table[] =
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_V850_NONE,			/* Type.  */
01917d
 	 0,				/* Rightshift.  */
01917d
-	 2,				/* Size (0 = byte, 1 = short, 2 = long).  */
01917d
-	 32,				/* Bitsize.  */
01917d
+	 3,				/* Size (0 = byte, 1 = short, 2 = long).  */
01917d
+	 0,				/* Bitsize.  */
01917d
 	 FALSE,				/* PC_relative.  */
01917d
 	 0,				/* Bitpos.  */
01917d
-	 complain_overflow_bitfield,	/* Complain_on_overflow.  */
01917d
+	 complain_overflow_dont,	/* Complain_on_overflow.  */
01917d
 	 bfd_elf_generic_reloc,		/* Special_function.  */
01917d
 	 "R_V850_NONE",			/* Name.  */
01917d
 	 FALSE,				/* Partial_inplace.  */
01917d
--- a/bfd/elf32-vax.c
01917d
+++ b/bfd/elf32-vax.c
01917d
@@ -56,7 +56,7 @@ static bfd_boolean elf32_vax_print_private_bfd_data (bfd *, void *);
01917d
 static reloc_howto_type howto_table[] = {
01917d
   HOWTO (R_VAX_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
 	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
#--- a/bfd/elf32-visium.c
01917d
#+++ b/bfd/elf32-visium.c
01917d
#@@ -33,11 +33,11 @@ static reloc_howto_type visium_elf_howto_table[] = {
01917d
#   /* This reloc does nothing.  */
01917d
#   HOWTO (R_VISIUM_NONE,		/* type */
01917d
# 	 0,			/* rightshift */
01917d
#-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
#-	 32,			/* bitsize */
01917d
#+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
#+	 0,			/* bitsize */
01917d
# 	 FALSE,			/* pc_relative */
01917d
# 	 0,			/* bitpos */
01917d
#-	 complain_overflow_bitfield,	/* complain_on_overflow */
01917d
#+	 complain_overflow_dont,	/* complain_on_overflow */
01917d
# 	 bfd_elf_generic_reloc,	/* special_function */
01917d
# 	 "R_VISIUM_NONE",	/* name */
01917d
# 	 FALSE,			/* partial_inplace */
01917d
--- a/bfd/elf32-xc16x.c
01917d
+++ b/bfd/elf32-xc16x.c
01917d
@@ -32,11 +32,11 @@ static reloc_howto_type xc16x_elf_howto_table [] =
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_XC16X_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 1,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 16,			/* bitsize */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_XC16X_NONE",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
--- a/bfd/elf32-xgate.c
01917d
+++ b/bfd/elf32-xgate.c
01917d
@@ -52,8 +52,8 @@ static reloc_howto_type elf_xgate_howto_table[] =
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_XGATE_NONE, /* type */
01917d
 	 0, /* rightshift */
01917d
-	 2, /* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32, /* bitsize */
01917d
+	 3, /* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 0, /* bitsize */
01917d
 	 FALSE, /* pc_relative */
01917d
 	 0, /* bitpos */
01917d
 	 complain_overflow_dont,/* complain_on_overflow */
01917d
--- a/bfd/elf32-xstormy16.c
01917d
+++ b/bfd/elf32-xstormy16.c
01917d
@@ -73,11 +73,11 @@ static reloc_howto_type xstormy16_elf_howto_table [] =
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_XSTORMY16_NONE,	/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_XSTORMY16_NONE",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
--- a/bfd/elf32-xtensa.c
01917d
+++ b/bfd/elf32-xtensa.c
01917d
@@ -161,7 +161,7 @@ int elf32xtensa_no_literal_movement = 1;
01917d
 
01917d
 static reloc_howto_type elf_howto_table[] =
01917d
 {
01917d
-  HOWTO (R_XTENSA_NONE, 0, 0, 0, FALSE, 0, complain_overflow_dont,
01917d
+  HOWTO (R_XTENSA_NONE, 0, 3, 0, FALSE, 0, complain_overflow_dont,
01917d
 	 bfd_elf_xtensa_reloc, "R_XTENSA_NONE",
01917d
 	 FALSE, 0, 0, FALSE),
01917d
   HOWTO (R_XTENSA_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
01917d
--- a/bfd/elf64-alpha.c
01917d
+++ b/bfd/elf64-alpha.c
01917d
@@ -486,8 +486,8 @@ static reloc_howto_type elf64_alpha_howto_table[] =
01917d
 {
01917d
   HOWTO (R_ALPHA_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 8,			/* bitsize */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 0,			/* bitsize */
01917d
 	 TRUE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
 	 complain_overflow_dont, /* complain_on_overflow */
01917d
--- a/bfd/elf64-mips.c
01917d
+++ b/bfd/elf64-mips.c
01917d
@@ -145,7 +145,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
01917d
   /* No relocation.  */
01917d
   HOWTO (R_MIPS_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
 	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
@@ -908,7 +908,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
01917d
   /* No relocation.  */
01917d
   HOWTO (R_MIPS_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
 	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
--- a/bfd/elf64-mmix.c
01917d
+++ b/bfd/elf64-mmix.c
01917d
@@ -192,11 +192,11 @@ static reloc_howto_type elf_mmix_howto_table[] =
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_MMIX_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_MMIX_NONE",		/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
--- a/bfd/elf64-ppc.c
01917d
+++ b/bfd/elf64-ppc.c
01917d
@@ -258,8 +258,8 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_PPC64_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
 	 complain_overflow_dont, /* complain_on_overflow */
01917d
--- a/bfd/elf64-s390.c
01917d
+++ b/bfd/elf64-s390.c
01917d
@@ -42,7 +42,7 @@ static reloc_howto_type elf_howto_table[] =
01917d
 {
01917d
   HOWTO (R_390_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 0,			/* size (0 = byte, 1 = 2 byte, 2 = 4 byte) */
01917d
+	 3,			/* size (0 = byte, 1 = 2 byte, 2 = 4 byte) */
01917d
 	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
--- a/bfd/elf64-sh64.c
01917d
+++ b/bfd/elf64-sh64.c
01917d
@@ -105,7 +105,7 @@ static reloc_howto_type sh_elf64_howto_table[] = {
01917d
   /* No relocation.  */
01917d
   HOWTO (R_SH_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
 	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
--- a/bfd/elf64-x86-64.c
01917d
+++ b/bfd/elf64-x86-64.c
01917d
@@ -54,7 +54,7 @@
01917d
    special_function, name, partial_inplace, src_mask, dst_mask, pcrel_offset.  */
01917d
 static reloc_howto_type x86_64_elf_howto_table[] =
01917d
 {
01917d
-  HOWTO(R_X86_64_NONE, 0, 0, 0, FALSE, 0, complain_overflow_dont,
01917d
+  HOWTO(R_X86_64_NONE, 0, 3, 0, FALSE, 0, complain_overflow_dont,
01917d
 	bfd_elf_generic_reloc, "R_X86_64_NONE",	FALSE, 0x00000000, 0x00000000,
01917d
 	FALSE),
01917d
   HOWTO(R_X86_64_64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
01917d
--- a/bfd/elflink.c
01917d
+++ b/bfd/elflink.c
01917d
@@ -10329,7 +10329,7 @@ elf_reloc_link_order (bfd *output_bfd,
01917d
 
01917d
       size = (bfd_size_type) bfd_get_reloc_size (howto);
01917d
       buf = (bfd_byte *) bfd_zmalloc (size);
01917d
-      if (buf == NULL)
01917d
+      if (buf == NULL && size != 0)
01917d
 	return FALSE;
01917d
       rstat = _bfd_relocate_contents (howto, output_bfd, addend, buf);
01917d
       switch (rstat)
01917d
--- a/bfd/elfn32-mips.c
01917d
+++ b/bfd/elfn32-mips.c
01917d
@@ -108,7 +108,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] =
01917d
   /* No relocation.  */
01917d
   HOWTO (R_MIPS_NONE,		/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
 	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
#--- a/bfd/elfnn-aarch64.c
01917d
#+++ b/bfd/elfnn-aarch64.c
01917d
#@@ -296,7 +296,7 @@ static reloc_howto_type elfNN_aarch64_howto_table[] =
01917d
# #if ARCH_SIZE == 64
01917d
#   HOWTO (R_AARCH64_NULL,	/* type */
01917d
# 	 0,			/* rightshift */
01917d
#-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
#+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
# 	 0,			/* bitsize */
01917d
# 	 FALSE,			/* pc_relative */
01917d
# 	 0,			/* bitpos */
01917d
#@@ -310,7 +310,7 @@ static reloc_howto_type elfNN_aarch64_howto_table[] =
01917d
# #else
01917d
#   HOWTO (R_AARCH64_NONE,	/* type */
01917d
# 	 0,			/* rightshift */
01917d
#-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
#+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
# 	 0,			/* bitsize */
01917d
# 	 FALSE,			/* pc_relative */
01917d
# 	 0,			/* bitpos */
01917d
#@@ -1377,7 +1377,7 @@ static reloc_howto_type elfNN_aarch64_howto_table[] =
01917d
# static reloc_howto_type elfNN_aarch64_howto_none =
01917d
#   HOWTO (R_AARCH64_NONE,	/* type */
01917d
# 	 0,			/* rightshift */
01917d
#-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
#+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
# 	 0,			/* bitsize */
01917d
# 	 FALSE,			/* pc_relative */
01917d
# 	 0,			/* bitpos */
01917d
#--- a/bfd/elfxx-aarch64.c
01917d
#+++ b/bfd/elfxx-aarch64.c
01917d
#@@ -187,6 +187,8 @@ _bfd_aarch64_elf_put_addend (bfd *abfd,
01917d
#   size = bfd_get_reloc_size (howto);
01917d
#   switch (size)
01917d
#     {
01917d
#+    case 0:
01917d
#+      return status;
01917d
#     case 2:
01917d
#       contents = bfd_get_16 (abfd, address);
01917d
#       break;
01917d
--- a/bfd/elfxx-ia64.c
01917d
+++ b/bfd/elfxx-ia64.c
01917d
@@ -91,7 +91,7 @@ ia64_elf_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc,
01917d
    TYPE field.  */
01917d
 static reloc_howto_type ia64_howto_table[] =
01917d
   {
01917d
-    IA64_HOWTO (R_IA64_NONE,	    "NONE",	   0, FALSE, TRUE),
01917d
+    IA64_HOWTO (R_IA64_NONE,	    "NONE",	   3, FALSE, TRUE),
01917d
 
01917d
     IA64_HOWTO (R_IA64_IMM14,	    "IMM14",	   0, FALSE, TRUE),
01917d
     IA64_HOWTO (R_IA64_IMM22,	    "IMM22",	   0, FALSE, TRUE),
01917d
--- a/bfd/elfxx-mips.c
01917d
+++ b/bfd/elfxx-mips.c
01917d
@@ -6194,11 +6194,13 @@ mips_elf_obtain_contents (reloc_howto_type *howto,
01917d
 			  const Elf_Internal_Rela *relocation,
01917d
 			  bfd *input_bfd, bfd_byte *contents)
01917d
 {
01917d
-  bfd_vma x;
01917d
+  bfd_vma x = 0;
01917d
   bfd_byte *location = contents + relocation->r_offset;
01917d
+  unsigned int size = bfd_get_reloc_size (howto);
01917d
 
01917d
   /* Obtain the bytes.  */
01917d
-  x = bfd_get ((8 * bfd_get_reloc_size (howto)), input_bfd, location);
01917d
+  if (size != 0)
01917d
+    x = bfd_get (8 * size, input_bfd, location);
01917d
 
01917d
   return x;
01917d
 }
01917d
@@ -6223,6 +6225,7 @@ mips_elf_perform_relocation (struct bfd_link_info *info,
01917d
   bfd_vma x;
01917d
   bfd_byte *location;
01917d
   int r_type = ELF_R_TYPE (input_bfd, relocation->r_info);
01917d
+  unsigned int size;
01917d
 
01917d
   /* Figure out where the relocation is occurring.  */
01917d
   location = contents + relocation->r_offset;
01917d
@@ -6316,7 +6319,9 @@ mips_elf_perform_relocation (struct bfd_link_info *info,
01917d
     }
01917d
 
01917d
   /* Put the value into the output.  */
01917d
-  bfd_put (8 * bfd_get_reloc_size (howto), input_bfd, x, location);
01917d
+  size = bfd_get_reloc_size (howto);
01917d
+  if (size != 0)
01917d
+    bfd_put (8 * size, input_bfd, x, location);
01917d
 
01917d
   _bfd_mips_elf_reloc_shuffle (input_bfd, r_type, !info->relocatable,
01917d
 			       location);
01917d
--- a/bfd/elfxx-sparc.c
01917d
+++ b/bfd/elfxx-sparc.c
01917d
@@ -209,7 +209,7 @@ sparc_elf_lox10_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
01917d
 
01917d
 static reloc_howto_type _bfd_sparc_elf_howto_table[] =
01917d
 {
01917d
-  HOWTO(R_SPARC_NONE,      0,0, 0,FALSE,0,complain_overflow_dont,    bfd_elf_generic_reloc,  "R_SPARC_NONE",    FALSE,0,0x00000000,TRUE),
01917d
+  HOWTO(R_SPARC_NONE,      0,3, 0,FALSE,0,complain_overflow_dont,    bfd_elf_generic_reloc,  "R_SPARC_NONE",    FALSE,0,0x00000000,TRUE),
01917d
   HOWTO(R_SPARC_8,         0,0, 8,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc,  "R_SPARC_8",       FALSE,0,0x000000ff,TRUE),
01917d
   HOWTO(R_SPARC_16,        0,1,16,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc,  "R_SPARC_16",      FALSE,0,0x0000ffff,TRUE),
01917d
   HOWTO(R_SPARC_32,        0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc,  "R_SPARC_32",      FALSE,0,0xffffffff,TRUE),
01917d
--- a/bfd/elfxx-tilegx.c
01917d
+++ b/bfd/elfxx-tilegx.c
01917d
@@ -72,11 +72,11 @@ static reloc_howto_type tilegx_elf_howto_table [] =
01917d
   /* This reloc does nothing.  */
01917d
   HOWTO (R_TILEGX_NONE,	/* type */
01917d
 	 0,			/* rightshift */
01917d
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 3,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
+	 0,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_TILEGX_NONE",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
--- a/bfd/linker.c
01917d
+++ b/bfd/linker.c
01917d
@@ -2434,7 +2434,7 @@ _bfd_generic_reloc_link_order (bfd *abfd,
01917d
 
01917d
       size = bfd_get_reloc_size (r->howto);
01917d
       buf = (bfd_byte *) bfd_zmalloc (size);
01917d
-      if (buf == NULL)
01917d
+      if (buf == NULL && size != 0)
01917d
 	return FALSE;
01917d
       rstat = _bfd_relocate_contents (r->howto, abfd,
01917d
 				      (bfd_vma) link_order->u.reloc.p->addend,
01917d
--- a/bfd/nlm32-sparc.c
01917d
+++ b/bfd/nlm32-sparc.c
01917d
@@ -49,7 +49,7 @@ enum reloc_type
01917d
 
01917d
 static reloc_howto_type nlm32_sparc_howto_table[] =
01917d
 {
01917d
-  HOWTO (R_SPARC_NONE,    0,0, 0,FALSE,0,complain_overflow_dont,    0,"R_SPARC_NONE",    FALSE,0,0x00000000,TRUE),
01917d
+  HOWTO (R_SPARC_NONE,    0,3, 0,FALSE,0,complain_overflow_dont,    0,"R_SPARC_NONE",    FALSE,0,0x00000000,TRUE),
01917d
   HOWTO (R_SPARC_8,       0,0, 8,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_8",       FALSE,0,0x000000ff,TRUE),
01917d
   HOWTO (R_SPARC_16,      0,1,16,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_16",      FALSE,0,0x0000ffff,TRUE),
01917d
   HOWTO (R_SPARC_32,      0,2,32,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_32",      FALSE,0,0xffffffff,TRUE),
01917d
--- a/bfd/pdp11.c
01917d
+++ b/bfd/pdp11.c
01917d
@@ -3152,7 +3152,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *flaginfo,
01917d
 
01917d
       size = bfd_get_reloc_size (howto);
01917d
       buf = bfd_zmalloc (size);
01917d
-      if (buf == NULL)
01917d
+      if (buf == NULL && size != 0)
01917d
 	return FALSE;
01917d
       r = MY_relocate_contents (howto, flaginfo->output_bfd,
01917d
 				pr->addend, buf);
01917d
--- a/bfd/reloc.c
01917d
+++ b/bfd/reloc.c
01917d
@@ -579,7 +579,7 @@ bfd_perform_relocation (bfd *abfd,
01917d
 {
01917d
   bfd_vma relocation;
01917d
   bfd_reloc_status_type flag = bfd_reloc_ok;
01917d
-  bfd_size_type octets = reloc_entry->address * bfd_octets_per_byte (abfd);
01917d
+  bfd_size_type octets;
01917d
   bfd_vma output_base = 0;
01917d
   reloc_howto_type *howto = reloc_entry->howto;
01917d
   asection *reloc_target_output_section;
01917d
@@ -618,15 +618,12 @@ bfd_perform_relocation (bfd *abfd,
01917d
 	return cont;
01917d
     }
01917d
 
01917d
-  /* Is the address of the relocation really within the section?  */
01917d
-  if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)
01917d
-      /* PR 17512: file: c146ab8b.
01917d
-	 PR 17512: file: 46dff27f.
01917d
-	 Include the size of the reloc in the test for out of range addresses.  */
01917d
-      - bfd_get_reloc_size (howto)
01917d
-      /* PR 17512: file: 38e53ebf
01917d
-	 Add make sure that there is enough room for the relocation to be applied.  */
01917d
-      || bfd_get_reloc_size (howto) > bfd_get_section_limit (abfd, input_section))
01917d
+  /* Is the address of the relocation really within the section?
01917d
+     Include the size of the reloc in the test for out of range addresses.
01917d
+     PR 17512: file: c146ab8b, 46dff27f, 38e53ebf.  */
01917d
+  octets = reloc_entry->address * bfd_octets_per_byte (abfd);
01917d
+  if (octets + bfd_get_reloc_size (howto)
01917d
+      > bfd_get_section_limit_octets (abfd, input_section))
01917d
     return bfd_reloc_outofrange;
01917d
 
01917d
   /* Work out which section the relocation is targeted at and the
01917d
@@ -976,7 +973,7 @@ bfd_install_relocation (bfd *abfd,
01917d
 {
01917d
   bfd_vma relocation;
01917d
   bfd_reloc_status_type flag = bfd_reloc_ok;
01917d
-  bfd_size_type octets = reloc_entry->address * bfd_octets_per_byte (abfd);
01917d
+  bfd_size_type octets;
01917d
   bfd_vma output_base = 0;
01917d
   reloc_howto_type *howto = reloc_entry->howto;
01917d
   asection *reloc_target_output_section;
01917d
@@ -1009,7 +1006,9 @@ bfd_install_relocation (bfd *abfd,
01917d
     }
01917d
 
01917d
   /* Is the address of the relocation really within the section?  */
01917d
-  if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
01917d
+  octets = reloc_entry->address * bfd_octets_per_byte (abfd);
01917d
+  if (octets + bfd_get_reloc_size (howto)
01917d
+      > bfd_get_section_limit_octets (abfd, input_section))
01917d
     return bfd_reloc_outofrange;
01917d
 
01917d
   /* Work out which section the relocation is targeted at and the
01917d
@@ -1344,9 +1343,11 @@ _bfd_final_link_relocate (reloc_howto_type *howto,
01917d
 			  bfd_vma addend)
01917d
 {
01917d
   bfd_vma relocation;
01917d
+  bfd_size_type octets = address * bfd_octets_per_byte (input_bfd);
01917d
 
01917d
   /* Sanity check the address.  */
01917d
-  if (address > bfd_get_section_limit (input_bfd, input_section))
01917d
+  if (octets + bfd_get_reloc_size (howto)
01917d
+      > bfd_get_section_limit_octets (input_bfd, input_section))
01917d
     return bfd_reloc_outofrange;
01917d
 
01917d
   /* This function assumes that we are dealing with a basic relocation
01917d
@@ -1401,8 +1402,9 @@ _bfd_relocate_contents (reloc_howto_type *howto,
01917d
   switch (size)
01917d
     {
01917d
     default:
01917d
-    case 0:
01917d
       abort ();
01917d
+    case 0:
01917d
+      return bfd_reloc_ok;
01917d
     case 1:
01917d
       x = bfd_get_8 (input_bfd, location);
01917d
       break;
01917d
@@ -1569,8 +1571,9 @@ _bfd_clear_contents (reloc_howto_type *howto,
01917d
   switch (size)
01917d
     {
01917d
     default:
01917d
-    case 0:
01917d
       abort ();
01917d
+    case 0:
01917d
+      return;
01917d
     case 1:
01917d
       x = bfd_get_8 (input_bfd, location);
01917d
       break;
01917d
--- a/bfd/xcofflink.c
01917d
+++ b/bfd/xcofflink.c
01917d
@@ -5738,7 +5738,7 @@ xcoff_reloc_link_order (bfd *output_bfd,
01917d
 
01917d
       size = bfd_get_reloc_size (howto);
01917d
       buf = bfd_zmalloc (size);
01917d
-      if (buf == NULL)
01917d
+      if (buf == NULL && size != 0)
01917d
 	return FALSE;
01917d
 
01917d
       rstat = _bfd_relocate_contents (howto, output_bfd, addend, buf);