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

01917d
commit 86c9573369616e7437481b6e5533aef3a435cdcf
01917d
Author: Alan Modra <amodra@gmail.com>
01917d
Date:   Sat Mar 8 13:05:06 2014 +1030
01917d
01917d
    Better overflow checking for powerpc32 relocations
01917d
    
01917d
    Similar to the powerpc64 patch, this improves overflow checking in
01917d
    elf32-ppc.c.  Many reloc "howto" entries needed fixes, some just
01917d
    cosmetic.
01917d
    
01917d
    The patch also fixes the R_PPC_VLE_SDA21 reloc application code, which
01917d
    was horribly broken.  In fact, it may still be broken since Power ISA
01917d
    2.07 says e_li behaves as
01917d
       RT <- EXTS(li20 1:4 || li20 5:8 || li20 0 || li20 9:19)
01917d
    where li20 is a field taken from bits 17..20, 11..15, 21..31 of the
01917d
    instruction.  Freescale VLEPEM says differently, and I assume
01917d
    correctly, that
01917d
       RT <- EXTS(li20 0:3 || li20 4:8 || li20 9:19)
01917d
    The VLE_SDA21 relocation description matches this too.
01917d
    
01917d
    Now the VLE_SDA21 relocation specifies in the case where e_addi16 is
01917d
    converted to e_li for symbols in .PPC.EMB.sdata0 or .PPC.EMB.sbss0
01917d
    (no base register), that the field is restricted to 16 bits, with the
01917d
    sign bit being propagated to the top 4 bits.  I don't see the sense in
01917d
    restricting the value like this, so have allowed the full 20 bit
01917d
    signed value.  This of course is compatible with the reloc description
01917d
    in that values in the 16 bit signed range will result in exactly the
01917d
    same insn field as when the reloc description is followed to the
01917d
    letter.
01917d
    
01917d
            * elf32-ppc.c (ppc_elf_howto_raw): Correct overflow check for
01917d
            many relocations.  Correct bitsize and rightshift too for a number
01917d
            of VLE relocs.  Describe R_PPC_VLE_SDA21 and R_PPC_VLE_SDA21_LO.
01917d
            Correct dst_mask on R_PPC_VLE_SDA21_LO.
01917d
            (ppc_elf_vle_split16): Tidy, delete unnecessary prototype.
01917d
            (ppc_elf_relocate_section): Modify overflow test for 16-bit
01917d
            fields in instructions to signed/unsigned according to whether
01917d
            the field takes a signed or unsigned value.  Tidy vle split16 code.
01917d
            Correct R_PPC_VLE_SDA21 and R_PPC_VLE_SDA21_LO handling.
01917d
01917d
### a/bfd/ChangeLog
01917d
### b/bfd/ChangeLog
01917d
## -1,5 +1,17 @@
01917d
 2014-03-08  Alan Modra  <amodra@gmail.com>
01917d
 
01917d
+	* elf32-ppc.c (ppc_elf_howto_raw): Correct overflow check for
01917d
+	many relocations.  Correct bitsize and rightshift too for a number
01917d
+	of VLE relocs.  Describe R_PPC_VLE_SDA21 and R_PPC_VLE_SDA21_LO.
01917d
+	Correct dst_mask on R_PPC_VLE_SDA21_LO.
01917d
+	(ppc_elf_vle_split16): Tidy, delete unnecessary prototype.
01917d
+	(ppc_elf_relocate_section): Modify overflow test for 16-bit
01917d
+	fields in instructions to signed/unsigned according to whether
01917d
+	the field takes a signed or unsigned value.  Tidy vle split16 code.
01917d
+	Correct R_PPC_VLE_SDA21 and R_PPC_VLE_SDA21_LO handling.
01917d
+
01917d
+2014-03-08  Alan Modra  <amodra@gmail.com>
01917d
+
01917d
 	* elf64-ppc.c (ppc64_elf_howto_raw): Use complain_overflow_signed
01917d
 	for R_PPC64_ADDR14, R_PPC64_ADDR14_BRTAKEN, R_PPC64_ADDR14_BRNTAKEN,
01917d
 	R_PPC64_SECTOFF, R_PPC64_ADDR16_DS, R_PPC64_SECTOFF_DS,
01917d
--- a/bfd/elf32-ppc.c
01917d
+++ b/bfd/elf32-ppc.c
01917d
@@ -50,8 +50,6 @@ static bfd_reloc_status_type ppc_elf_addr16_ha_reloc
01917d
   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
01917d
 static bfd_reloc_status_type ppc_elf_unhandled_reloc
01917d
   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
01917d
-static void ppc_elf_vle_split16
01917d
-  (bfd *, bfd_byte *, bfd_vma, bfd_vma, split16_format_type);
01917d
 
01917d
 /* Branch prediction bit for branch taken relocs.  */
01917d
 #define BRANCH_PREDICT_BIT 0x200000
01917d
@@ -192,7 +190,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 32,			/* 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_PPC_NONE",		/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -207,7 +205,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 32,			/* 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_PPC_ADDR32",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -223,7 +221,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 26,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_PPC_ADDR24",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -300,7 +298,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_PPC_ADDR14",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -317,7 +315,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_PPC_ADDR14_BRTAKEN",/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -334,7 +332,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_PPC_ADDR14_BRNTAKEN",/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -446,7 +444,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 16,			/* 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_PPC_GOT16_HI",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -462,7 +460,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
 	 ppc_elf_addr16_ha_reloc, /* special_function */
01917d
 	 "R_PPC_GOT16_HA",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -497,7 +495,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 32,			/* 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_PPC_COPY",		/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -513,7 +511,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 32,			/* 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_PPC_GLOB_DAT",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -528,7 +526,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 32,			/* 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_PPC_JMP_SLOT",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -545,7 +543,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 32,			/* 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_PPC_RELATIVE",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -577,7 +575,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 32,			/* 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_PPC_UADDR32",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -607,7 +605,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 32,			/* bitsize */
01917d
 	 TRUE,			/* 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_PPC_REL32",		/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -623,7 +621,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 32,			/* 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_PPC_PLT32",		/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -639,7 +637,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 32,			/* bitsize */
01917d
 	 TRUE,			/* 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_PPC_PLTREL32",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -671,7 +669,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 16,			/* 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_PPC_PLT16_HI",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -687,7 +685,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
 	 ppc_elf_addr16_ha_reloc, /* special_function */
01917d
 	 "R_PPC_PLT16_HA",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -718,7 +716,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_PPC_SECTOFF",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -748,7 +746,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 16,			/* 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_PPC_SECTOFF_HI",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -763,7 +761,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_dont, /* complain_on_overflow */
01917d
 	 ppc_elf_addr16_ha_reloc, /* special_function */
01917d
 	 "R_PPC_SECTOFF_HA",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1239,7 +1237,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 32,			/* 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_PPC_EMB_NADDR32",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1254,7 +1252,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_PPC_EMB_NADDR16",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1449,10 +1447,10 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
   HOWTO (R_PPC_VLE_LO16A,	/* type */
01917d
 	 0,			/* rightshift */
01917d
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 16,			/* 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_PPC_VLE_LO16A",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1464,10 +1462,10 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
   HOWTO (R_PPC_VLE_LO16D,	/* type */
01917d
 	 0,			/* rightshift */
01917d
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 16,			/* 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_PPC_VLE_LO16D",		/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1477,12 +1475,12 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 
01917d
   /* Bits 16-31 split16a format.  */
01917d
   HOWTO (R_PPC_VLE_HI16A,	/* type */
01917d
-	 0,			/* rightshift */
01917d
+	 16,			/* rightshift */
01917d
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 16,			/* 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_PPC_VLE_HI16A",		/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1492,12 +1490,12 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 
01917d
   /* Bits 16-31 split16d format.  */
01917d
   HOWTO (R_PPC_VLE_HI16D,	/* type */
01917d
-	 0,			/* rightshift */
01917d
+	 16,			/* rightshift */
01917d
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 16,			/* 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_PPC_VLE_HI16D",		/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1507,12 +1505,12 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 
01917d
   /* Bits 16-31 (High Adjusted) in split16a format.  */
01917d
   HOWTO (R_PPC_VLE_HA16A,	/* type */
01917d
-	 0,			/* rightshift */
01917d
+	 16,			/* rightshift */
01917d
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 16,			/* 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_PPC_VLE_HA16A",		/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1522,12 +1520,12 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 
01917d
   /* Bits 16-31 (High Adjusted) in split16d format.  */
01917d
   HOWTO (R_PPC_VLE_HA16D,	/* type */
01917d
-	 0,			/* rightshift */
01917d
+	 16,			/* rightshift */
01917d
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 16,			/* 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_PPC_VLE_HA16D",		/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1535,14 +1533,16 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 0x1f07ff,		/* dst_mask */
01917d
 	 FALSE),		/* pcrel_offset */
01917d
 
01917d
-  /* This reloc does nothing.  */
01917d
-  HOWTO (R_PPC_VLE_SDA21,		/* type */
01917d
+  /* This reloc is like R_PPC_EMB_SDA21 but only applies to e_add16i
01917d
+     instructions.  If the register base is 0 then the linker changes
01917d
+     the e_add16i to an e_li instruction.  */
01917d
+  HOWTO (R_PPC_VLE_SDA21,	/* type */
01917d
 	 0,			/* rightshift */
01917d
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 16,			/* bitsize */
01917d
 	 FALSE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_PPC_VLE_SDA21",		/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1550,29 +1550,29 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 0xffff,		/* dst_mask */
01917d
 	 FALSE),		/* pcrel_offset */
01917d
 
01917d
-  /* This reloc does nothing.  */
01917d
+  /* Like R_PPC_VLE_SDA21 but ignore overflow.  */
01917d
   HOWTO (R_PPC_VLE_SDA21_LO,	/* type */
01917d
 	 0,			/* rightshift */
01917d
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 16,			/* 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_PPC_VLE_SDA21_LO",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
 	 0,			/* src_mask */
01917d
-	 0,			/* dst_mask */
01917d
+	 0xffff,		/* dst_mask */
01917d
 	 FALSE),		/* pcrel_offset */
01917d
 
01917d
   /* The 16 LSBS relative to _SDA_BASE_ in split16a format.  */
01917d
   HOWTO (R_PPC_VLE_SDAREL_LO16A,/* type */
01917d
 	 0,			/* rightshift */
01917d
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 16,			/* 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_PPC_VLE_SDAREL_LO16A",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1581,14 +1581,13 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 FALSE),		/* pcrel_offset */
01917d
 
01917d
   /* The 16 LSBS relative to _SDA_BASE_ in split16d format.  */
01917d
-  /* This reloc does nothing.  */
01917d
   HOWTO (R_PPC_VLE_SDAREL_LO16D, /* type */
01917d
 	 0,			/* rightshift */
01917d
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 16,			/* 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_PPC_VLE_SDAREL_LO16D",		/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1598,12 +1597,12 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 
01917d
   /* Bits 16-31 relative to _SDA_BASE_ in split16a format.  */
01917d
   HOWTO (R_PPC_VLE_SDAREL_HI16A,	/* type */
01917d
-	 0,			/* rightshift */
01917d
+	 16,			/* rightshift */
01917d
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 16,			/* 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_PPC_VLE_SDAREL_HI16A",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1613,12 +1612,12 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 
01917d
   /* Bits 16-31 relative to _SDA_BASE_ in split16d format.  */
01917d
   HOWTO (R_PPC_VLE_SDAREL_HI16D,	/* type */
01917d
-	 0,			/* rightshift */
01917d
+	 16,			/* rightshift */
01917d
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 16,			/* 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_PPC_VLE_SDAREL_HI16D",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1628,12 +1627,12 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 
01917d
   /* Bits 16-31 (HA) relative to _SDA_BASE split16a format.  */
01917d
   HOWTO (R_PPC_VLE_SDAREL_HA16A,	/* type */
01917d
-	 0,			/* rightshift */
01917d
+	 16,			/* rightshift */
01917d
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 16,			/* 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_PPC_VLE_SDAREL_HA16A",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1643,12 +1642,12 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 
01917d
   /* Bits 16-31 (HA) relative to _SDA_BASE split16d format.  */
01917d
   HOWTO (R_PPC_VLE_SDAREL_HA16D,	/* type */
01917d
-	 0,			/* rightshift */
01917d
+	 16,			/* rightshift */
01917d
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
01917d
-	 32,			/* bitsize */
01917d
+	 16,			/* 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_PPC_VLE_SDAREL_HA16D",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1662,7 +1661,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 32,			/* 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_PPC_IRELATIVE",	/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -1677,7 +1676,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
01917d
 	 16,			/* bitsize */
01917d
 	 TRUE,			/* pc_relative */
01917d
 	 0,			/* bitpos */
01917d
-	 complain_overflow_bitfield, /* complain_on_overflow */
01917d
+	 complain_overflow_signed, /* complain_on_overflow */
01917d
 	 bfd_elf_generic_reloc,	/* special_function */
01917d
 	 "R_PPC_REL16",		/* name */
01917d
 	 FALSE,			/* partial_inplace */
01917d
@@ -4790,20 +4789,19 @@ ppc_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
01917d
 }
01917d
 
01917d
 static void
01917d
-ppc_elf_vle_split16 (bfd *output_bfd, bfd_byte *contents,
01917d
-                 bfd_vma offset, bfd_vma relocation,
01917d
-		 split16_format_type split16_format)
01917d
+ppc_elf_vle_split16 (bfd *output_bfd, bfd_byte *loc,
01917d
+		     bfd_vma value,
01917d
+		     split16_format_type split16_format)
01917d
 
01917d
 {
01917d
-  bfd_vma insn, top5, bottom11;
01917d
+  unsigned int insn, top5;
01917d
 
01917d
-  insn = bfd_get_32 (output_bfd, contents + offset);
01917d
-  top5 = relocation >> 11;
01917d
-  top5 = top5 << (split16_format == split16a_type ? 20 : 16);
01917d
-  bottom11 = relocation & 0x7ff;
01917d
+  insn = bfd_get_32 (output_bfd, loc);
01917d
+  top5 = value & 0xf800;
01917d
+  top5 = top5 << (split16_format == split16a_type ? 9 : 5);
01917d
   insn |= top5;
01917d
-  insn |= bottom11;
01917d
-  bfd_put_32 (output_bfd, insn, contents + offset);
01917d
+  insn |= value & 0x7ff;
01917d
+  bfd_put_32 (output_bfd, insn, loc);
01917d
 }
01917d
 
01917d
 
01917d
@@ -7570,6 +7568,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
01917d
       bfd_boolean warned;
01917d
       unsigned int tls_type, tls_mask, tls_gd;
01917d
       struct plt_entry **ifunc;
01917d
+      struct reloc_howto_struct alt_howto;
01917d
 
01917d
       r_type = ELF32_R_TYPE (rel->r_info);
01917d
       sym = NULL;
01917d
@@ -8252,9 +8251,9 @@ ppc_elf_relocate_section (bfd *output_bfd,
01917d
 		 howto->name,
01917d
 		 sym_name);
01917d
 	  }
01917d
-	break;
01917d
+	  break;
01917d
 
01917d
-	/* Relocations that need no special processing.  */
01917d
+	  /* Relocations that need no special processing.  */
01917d
 	case R_PPC_LOCAL24PC:
01917d
 	  /* It makes no sense to point a local relocation
01917d
 	     at a symbol not in this object.  */
01917d
@@ -8743,45 +8742,39 @@ ppc_elf_relocate_section (bfd *output_bfd,
01917d
 	  break;
01917d
 
01917d
 	case R_PPC_VLE_LO16A:
01917d
-	  relocation = (relocation + addend) & 0xffff;
01917d
-	  ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset,
01917d
-                               relocation, split16a_type);
01917d
+	  relocation = relocation + addend;
01917d
+	  ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
01917d
+			       relocation, split16a_type);
01917d
 	  continue;
01917d
 
01917d
 	case R_PPC_VLE_LO16D:
01917d
-	  relocation = (relocation + addend) & 0xffff;
01917d
-	  ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset,
01917d
-                               relocation, split16d_type);
01917d
+	  relocation = relocation + addend;
01917d
+	  ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
01917d
+			       relocation, split16d_type);
01917d
 	  continue;
01917d
 
01917d
 	case R_PPC_VLE_HI16A:
01917d
-	  relocation = ((relocation + addend) >> 16) & 0xffff;
01917d
-	  ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset,
01917d
-                               relocation, split16a_type);
01917d
+	  relocation = (relocation + addend) >> 16;
01917d
+	  ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
01917d
+			       relocation, split16a_type);
01917d
 	  continue;
01917d
 
01917d
 	case R_PPC_VLE_HI16D:
01917d
-	  relocation = ((relocation + addend) >> 16) & 0xffff;
01917d
-	  ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset,
01917d
-                               relocation, split16d_type);
01917d
+	  relocation = (relocation + addend) >> 16;
01917d
+	  ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
01917d
+			       relocation, split16d_type);
01917d
 	  continue;
01917d
 
01917d
 	case R_PPC_VLE_HA16A:
01917d
-	  {
01917d
-	    bfd_vma value = relocation + addend;
01917d
-	    value = (((value >> 16) + ((value & 0x8000) ? 1 : 0)) & 0xffff);
01917d
-	    ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset,
01917d
-                                 value, split16a_type);
01917d
-	  }
01917d
+	  relocation = (relocation + addend + 0x8000) >> 16;
01917d
+	  ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
01917d
+			       relocation, split16a_type);
01917d
 	  continue;
01917d
 
01917d
 	case R_PPC_VLE_HA16D:
01917d
-	  {
01917d
-	    bfd_vma value = relocation + addend;
01917d
-	    value = (((value >> 16) + ((value & 0x8000) ? 1 : 0)) & 0xffff);
01917d
-	    ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset,
01917d
-                                 value, split16d_type);
01917d
-	  }
01917d
+	  relocation = (relocation + addend + 0x8000) >> 16;
01917d
+	  ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
01917d
+			       relocation, split16d_type);
01917d
 	  continue;
01917d
 
01917d
 	  /* Relocate against either _SDA_BASE_, _SDA2_BASE_, or 0.  */
01917d
@@ -8792,6 +8785,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
01917d
 	  {
01917d
 	    const char *name;
01917d
 	    int reg;
01917d
+	    unsigned int insn;
01917d
 	    struct elf_link_hash_entry *sda = NULL;
01917d
 
01917d
 	    if (sec == NULL || sec->output_section == NULL)
01917d
@@ -8845,32 +8839,40 @@ ppc_elf_relocate_section (bfd *output_bfd,
01917d
 		addend -= SYM_VAL (sda);
01917d
 	      }
01917d
 
01917d
+	    insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
01917d
 	    if (reg == 0
01917d
 		&& (r_type == R_PPC_VLE_SDA21
01917d
 		    || r_type == R_PPC_VLE_SDA21_LO))
01917d
 	      {
01917d
-		/* Use the split20 format.  */
01917d
-		bfd_vma insn, bits12to15, bits21to31;
01917d
-		bfd_vma value  = (relocation + rel->r_offset) & 0xffff;
01917d
-		/* Propagate sign bit, if necessary.  */
01917d
-		insn = (value & 0x8000) ? 0x70107800 : 0x70000000;
01917d
-		bits12to15 = value & 0x700;
01917d
-		bits21to31 = value & 0x7ff;
01917d
-		insn |= bits12to15;
01917d
-		insn |= bits21to31;
01917d
-  		bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
01917d
-		continue;
01917d
+		relocation = relocation + addend;
01917d
+		addend = 0;
01917d
+
01917d
+		/* Force e_li insn, keeping RT from original insn.  */
01917d
+		insn &= 0x1f << 21;
01917d
+		insn |= 28u << 26;
01917d
+
01917d
+		/* We have an li20 field, bits 17..20, 11..15, 21..31.  */
01917d
+		/* Top 4 bits of value to 17..20.  */
01917d
+		insn |= (relocation & 0xf0000) >> 5;
01917d
+		/* Next 5 bits of the value to 11..15.  */
01917d
+		insn |= (relocation & 0xf800) << 5;
01917d
+		/* And the final 11 bits of the value to bits 21 to 31.  */
01917d
+		insn |= relocation & 0x7ff;
01917d
+
01917d
+		/* Use _bfd_final_link_relocate to report overflow,
01917d
+		   but do so with a value that won't modify the insn.  */
01917d
+		if (relocation + 0x80000 > 0x100000)
01917d
+		  addend = 0x100000;
01917d
+		relocation = 0;
01917d
 	      }
01917d
 	    else if (r_type == R_PPC_EMB_SDA21
01917d
 		     || r_type == R_PPC_VLE_SDA21
01917d
 		     || r_type == R_PPC_VLE_SDA21_LO)
01917d
 	      {
01917d
-		bfd_vma insn;  /* Fill in register field.  */
01917d
-
01917d
-		insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
01917d
+		/* Fill in register field.  */
01917d
 		insn = (insn & ~RA_REGISTER_MASK) | (reg << RA_REGISTER_SHIFT);
01917d
-		bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
01917d
 	      }
01917d
+	    bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
01917d
 	  }
01917d
 	  break;
01917d
 
01917d
@@ -8931,46 +8933,39 @@ ppc_elf_relocate_section (bfd *output_bfd,
01917d
 		  }
01917d
 	      }
01917d
 
01917d
-	   value = sda->root.u.def.section->output_section->vma
01917d
-   		   + sda->root.u.def.section->output_offset;
01917d
-
01917d
-	   if (r_type == R_PPC_VLE_SDAREL_LO16A)
01917d
-	      {
01917d
-		value = (value + addend) & 0xffff;
01917d
-	        ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset,
01917d
-                                     value, split16a_type);
01917d
-	      }
01917d
-	   else if (r_type == R_PPC_VLE_SDAREL_LO16D)
01917d
-	      {
01917d
-		value = (value + addend) & 0xffff;
01917d
-	        ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset,
01917d
-                                     value, split16d_type);
01917d
-	      }
01917d
-	   else if (r_type == R_PPC_VLE_SDAREL_HI16A)
01917d
+	    value = (sda->root.u.def.section->output_section->vma
01917d
+		     + sda->root.u.def.section->output_offset
01917d
+		     + addend);
01917d
+
01917d
+	    if (r_type == R_PPC_VLE_SDAREL_LO16A)
01917d
+	      ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
01917d
+				   value, split16a_type);
01917d
+	    else if (r_type == R_PPC_VLE_SDAREL_LO16D)
01917d
+	      ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
01917d
+				   value, split16d_type);
01917d
+	    else if (r_type == R_PPC_VLE_SDAREL_HI16A)
01917d
 	      {
01917d
-		value = ((value + addend) >> 16) & 0xffff;
01917d
-	        ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset,
01917d
-                                     value, split16a_type);
01917d
+		value = value >> 16;
01917d
+		ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
01917d
+				     value, split16a_type);
01917d
 	      }
01917d
-	   else if (r_type == R_PPC_VLE_SDAREL_HI16D)
01917d
+	    else if (r_type == R_PPC_VLE_SDAREL_HI16D)
01917d
 	      {
01917d
-		value = ((value + addend) >> 16) & 0xffff;
01917d
-	        ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset,
01917d
-                                     value, split16d_type);
01917d
+		value = value >> 16;
01917d
+		ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
01917d
+				     value, split16d_type);
01917d
 	      }
01917d
-	   else if (r_type == R_PPC_VLE_SDAREL_HA16A)
01917d
+	    else if (r_type == R_PPC_VLE_SDAREL_HA16A)
01917d
 	      {
01917d
-		value += addend;
01917d
-		value = (((value >> 16) + ((value & 0x8000) ? 1 : 0)) & 0xffff);
01917d
-	        ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset,
01917d
-                                     value, split16a_type);
01917d
+		value = (value + 0x8000) >> 16;
01917d
+		ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
01917d
+				     value, split16a_type);
01917d
 	      }
01917d
-	   else if (r_type == R_PPC_VLE_SDAREL_HA16D)
01917d
+	    else if (r_type == R_PPC_VLE_SDAREL_HA16D)
01917d
 	      {
01917d
-		value += addend;
01917d
-		value = (((value >> 16) + ((value & 0x8000) ? 1 : 0)) & 0xffff);
01917d
-	        ppc_elf_vle_split16 (output_bfd, contents, rel->r_offset,
01917d
-                                     value, split16d_type);
01917d
+		value = (value + 0x8000) >> 16;
01917d
+		ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
01917d
+				     value, split16d_type);
01917d
 	      }
01917d
 	  }
01917d
 	  continue;
01917d
@@ -9130,13 +9125,36 @@ ppc_elf_relocate_section (bfd *output_bfd,
01917d
 	  ret = FALSE;
01917d
 	}
01917d
 
01917d
-      r = _bfd_final_link_relocate (howto,
01917d
-				    input_bfd,
01917d
-				    input_section,
01917d
-				    contents,
01917d
-				    rel->r_offset,
01917d
-				    relocation,
01917d
-				    addend);
01917d
+      /* 16-bit fields in insns mostly have signed values, but a
01917d
+	 few insns have 16-bit unsigned values.  Really, we should
01917d
+	 have different reloc types.  */
01917d
+      if (howto->complain_on_overflow != complain_overflow_dont
01917d
+	  && howto->dst_mask == 0xffff
01917d
+	  && (input_section->flags & SEC_CODE) != 0)
01917d
+	{
01917d
+	  enum complain_overflow complain = complain_overflow_signed;
01917d
+
01917d
+	  if ((elf_section_flags (input_section) & SHF_PPC_VLE) == 0)
01917d
+	    {
01917d
+	      unsigned int insn;
01917d
+
01917d
+	      insn = bfd_get_32 (input_bfd, contents + (rel->r_offset & ~3));
01917d
+	      if ((insn & (0x3f << 26)) == 28u << 26 /* andi */
01917d
+		  || (insn & (0x3f << 26)) == 24u << 26 /* ori */
01917d
+		  || (insn & (0x3f << 26)) == 26u << 26 /* xori */
01917d
+		  || (insn & (0x3f << 26)) == 10u << 26 /* cmpli */)
01917d
+		complain = complain_overflow_unsigned;
01917d
+	    }
01917d
+	  if (howto->complain_on_overflow != complain)
01917d
+	    {
01917d
+	      alt_howto = *howto;
01917d
+	      alt_howto.complain_on_overflow = complain;
01917d
+	      howto = &alt_howto;
01917d
+	    }
01917d
+	}
01917d
+
01917d
+      r = _bfd_final_link_relocate (howto, input_bfd, input_section, contents,
01917d
+				    rel->r_offset, relocation, addend);
01917d
 
01917d
       if (r != bfd_reloc_ok)
01917d
 	{