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

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