Blame SOURCES/binutils-ppc64le-3.patch

881b8e
2014-03-12  Aldy Hernandez  <aldyh@redhat.com>
881b8e
881b8e
    Copy the following files from upsbinutils-2.24:
881b8e
881b8e
    gas/config/tc-ppc.c
881b8e
    gas/testsuite/gas/ppc/vsx2.d
881b8e
    ld/testsuite/ld-powerpc/relbrlt.d
881b8e
    ld/testsuite/ld-powerpc/symtocbase.d
881b8e
    ld/testsuite/ld-powerpc/tls.d
881b8e
    ld/testsuite/ld-powerpc/tls.t
881b8e
    ld/testsuite/ld-powerpc/tlstoc.d
881b8e
    ld/testsuite/ld-powerpc/tlstoc.t
881b8e
    ld/testsuite/ld-powerpc/tocopt.d
881b8e
    ld/testsuite/ld-powerpc/tocopt2.d
881b8e
    ld/testsuite/ld-powerpc/tocopt3.d
881b8e
    ld/testsuite/ld-powerpc/tocopt4.d
881b8e
    ld/testsuite/ld-powerpc/tocopt5.d
881b8e
881b8e
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
881b8e
index 99e893d..7c99e43 100644
881b8e
--- a/gas/config/tc-ppc.c
881b8e
+++ b/gas/config/tc-ppc.c
881b8e
@@ -65,40 +65,14 @@ static int set_target_endian = 0;
881b8e
 /* #lo(value) denotes the least significant 16 bits of the indicated.  */
881b8e
 #define PPC_LO(v) ((v) & 0xffff)
881b8e
 
881b8e
-/* Split the indicated value with the msbs in bits 11-15
881b8e
-   and the lsbs in bits 21-31.  */
881b8e
-#define PPC_VLE_SPLIT16A(v) ((v & 0xf800) << 11) | (v & 0x7ff)
881b8e
-
881b8e
-/* Split the indicated value with the msbs in bits 6-10
881b8e
-   and the lsbs in bits 21-31.  */
881b8e
-#define PPC_VLE_SPLIT16D(v) ((v & 0xf800) << 5) | (v & 0x7ff)
881b8e
-
881b8e
-/* #lo(value) denotes the lsb 16 bits in split16a format.  */
881b8e
-#define PPC_VLE_LO16A(v) PPC_VLE_SPLIT16A(PPC_LO(v))
881b8e
-
881b8e
-/* #lo(value) denotes the lsb 16 bits in split16d format.  */
881b8e
-#define PPC_VLE_LO16D(v) PPC_VLE_SPLIT16D(PPC_LO(v))
881b8e
-
881b8e
 /* #hi(value) denotes bits 16 through 31 of the indicated value.  */
881b8e
 #define PPC_HI(v) (((v) >> 16) & 0xffff)
881b8e
 
881b8e
-/* #lo(value) denotes the msb 16 bits in split16a format.  */
881b8e
-#define PPC_VLE_HI16A(v) PPC_VLE_SPLIT16A(PPC_HI(v))
881b8e
-
881b8e
-/* #lo(value) denotes the msb 16 bits in split16d format.  */
881b8e
-#define PPC_VLE_HI16D(v) PPC_VLE_SPLIT16D(PPC_HI(v))
881b8e
-
881b8e
 /* #ha(value) denotes the high adjusted value: bits 16 through 31 of
881b8e
   the indicated value, compensating for #lo() being treated as a
881b8e
   signed number.  */
881b8e
 #define PPC_HA(v) PPC_HI ((v) + 0x8000)
881b8e
 
881b8e
-/* #ha(value) denotes the high adjusted value in split16a format.  */
881b8e
-#define PPC_VLE_HA16A(v) PPC_VLE_SPLIT16A(PPC_HA(v))
881b8e
-
881b8e
-/* #ha(value) denotes the high adjusted value in split16d format.  */
881b8e
-#define PPC_VLE_HA16D(v) PPC_VLE_SPLIT16D(PPC_HA(v))
881b8e
-
881b8e
 /* #higher(value) denotes bits 32 through 47 of the indicated value.  */
881b8e
 #define PPC_HIGHER(v) (((v) >> 16 >> 16) & 0xffff)
881b8e
 
881b8e
@@ -2094,8 +2068,7 @@ ppc_elf_cons (int nbytes /* 1=.byte, 2=.word, 4=.long, 8=.llong */)
881b8e
   do
881b8e
     {
881b8e
       expression (&exp);
881b8e
-      if (exp.X_op == O_symbol
881b8e
-	  && *input_line_pointer == '@'
881b8e
+      if (*input_line_pointer == '@'
881b8e
 	  && (reloc = ppc_elf_suffix (&input_line_pointer,
881b8e
 				      &exp)) != BFD_RELOC_UNUSED)
881b8e
 	{
881b8e
@@ -2240,7 +2213,7 @@ ppc_elf_lcomm (int xxx ATTRIBUTE_UNUSED)
881b8e
     align2 = 0;
881b8e
 
881b8e
   record_alignment (bss_section, align2);
881b8e
-  subseg_set (bss_section, 0);
881b8e
+  subseg_set (bss_section, 1);
881b8e
   if (align2)
881b8e
     frag_align (align2, 0, 0);
881b8e
   if (S_GET_SEGMENT (symbolP) == bss_section)
881b8e
@@ -2296,7 +2269,7 @@ ppc_elf_localentry (int ignore ATTRIBUTE_UNUSED)
881b8e
     {
881b8e
       unsigned char encoded = PPC64_SET_LOCAL_ENTRY_OFFSET (exp.X_add_number);
881b8e
 
881b8e
-      if (exp.X_add_number != PPC64_LOCAL_ENTRY_OFFSET (encoded))
881b8e
+      if (exp.X_add_number != (offsetT) PPC64_LOCAL_ENTRY_OFFSET (encoded))
881b8e
         as_bad (_(".localentry expression for `%s' "
881b8e
 		  "is not a valid power of 2"), S_GET_NAME (sym));
881b8e
       else
881b8e
@@ -2457,8 +2430,6 @@ ppc_elf_adjust_symtab (void)
881b8e
 	  asymbol *bsym = symbol_get_bfdsym (symp);
881b8e
 	  if ((bsym->flags & BSF_KEEP) == 0)
881b8e
 	    symbol_remove (symp, &symbol_rootP, &symbol_lastP);
881b8e
-	  else
881b8e
-	    S_SET_WEAK (symp);
881b8e
 	}
881b8e
     }
881b8e
 }
881b8e
@@ -2567,7 +2538,8 @@ static int
881b8e
 ppc_is_toc_sym (symbolS *sym)
881b8e
 {
881b8e
 #ifdef OBJ_XCOFF
881b8e
-  return symbol_get_tc (sym)->symbol_class == XMC_TC;
881b8e
+  return (symbol_get_tc (sym)->symbol_class == XMC_TC
881b8e
+	  || symbol_get_tc (sym)->symbol_class == XMC_TC0);
881b8e
 #endif
881b8e
 #ifdef OBJ_ELF
881b8e
   const char *sname = segment_name (S_GET_SEGMENT (sym));
881b8e
@@ -3308,6 +3280,7 @@ md_assemble (char *str)
881b8e
 		   && (operand->bitm & 0xfff0) == 0xfff0
881b8e
 		   && operand->shift == 0)
881b8e
 	    {
881b8e
+	      /* Note: the symbol may be not yet defined.  */
881b8e
 	      if (ppc_is_toc_sym (ex.X_add_symbol))
881b8e
 		{
881b8e
 		  reloc = BFD_RELOC_PPC_TOC16;
881b8e
@@ -3687,11 +3660,6 @@ ppc_comm (int lcomm)
881b8e
       char *lcomm_name;
881b8e
       char lcomm_endc;
881b8e
 
881b8e
-      if (size <= 4)
881b8e
-	align = 2;
881b8e
-      else
881b8e
-	align = 3;
881b8e
-
881b8e
       /* The third argument to .lcomm appears to be the real local
881b8e
 	 common symbol to create.  References to the symbol named in
881b8e
 	 the first argument are turned into references to the third
881b8e
@@ -3710,6 +3678,25 @@ ppc_comm (int lcomm)
881b8e
       lcomm_sym = symbol_find_or_make (lcomm_name);
881b8e
 
881b8e
       *input_line_pointer = lcomm_endc;
881b8e
+
881b8e
+      /* The fourth argument to .lcomm is the alignment.  */
881b8e
+      if (*input_line_pointer != ',')
881b8e
+	{
881b8e
+	  if (size <= 4)
881b8e
+	    align = 2;
881b8e
+	  else
881b8e
+	    align = 3;
881b8e
+	}
881b8e
+      else
881b8e
+	{
881b8e
+	  ++input_line_pointer;
881b8e
+	  align = get_absolute_expression ();
881b8e
+	  if (align <= 0)
881b8e
+	    {
881b8e
+	      as_warn (_("ignoring bad alignment"));
881b8e
+	      align = 2;
881b8e
+	    }
881b8e
+	}
881b8e
     }
881b8e
 
881b8e
   *end_name = '\0';
881b8e
@@ -6488,6 +6475,8 @@ void
881b8e
 md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
881b8e
 {
881b8e
   valueT value = * valP;
881b8e
+  offsetT fieldval;
881b8e
+  const struct powerpc_operand *operand;
881b8e
 
881b8e
 #ifdef OBJ_ELF
881b8e
   if (fixP->fx_addsy != NULL)
881b8e
@@ -6526,16 +6515,13 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
881b8e
       as_bad_where (fixP->fx_file, fixP->fx_line, _("expression too complex"));
881b8e
     }
881b8e
 
881b8e
+  operand = NULL;
881b8e
   if (fixP->fx_pcrel_adjust != 0)
881b8e
     {
881b8e
-      /* Handle relocs in an insn.  */
881b8e
-
881b8e
+      /* This is a fixup on an instruction.  */
881b8e
       int opindex = fixP->fx_pcrel_adjust & 0xff;
881b8e
-      const struct powerpc_operand *operand = &powerpc_operands[opindex];
881b8e
-      char *where;
881b8e
-      unsigned long insn;
881b8e
-      offsetT fieldval;
881b8e
 
881b8e
+      operand = &powerpc_operands[opindex];
881b8e
 #ifdef OBJ_XCOFF
881b8e
       /* An instruction like `lwz 9,sym(30)' when `sym' is not a TOC symbol
881b8e
 	 does not generate a reloc.  It uses the offset of `sym' within its
881b8e
@@ -6554,65 +6540,111 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
881b8e
 	  value = fixP->fx_offset;
881b8e
 	  fixP->fx_done = 1;
881b8e
 	}
881b8e
+
881b8e
+       /* During parsing of instructions, a TOC16 reloc is generated for
881b8e
+          instructions such as 'lwz RT,SYM(RB)' if SYM is a symbol defined
881b8e
+          in the toc.  But at parse time, SYM may be not yet defined, so
881b8e
+          check again here.  */
881b8e
+       if (fixP->fx_r_type == BFD_RELOC_16
881b8e
+           && fixP->fx_addsy != NULL
881b8e
+           && ppc_is_toc_sym (fixP->fx_addsy))
881b8e
+         fixP->fx_r_type = BFD_RELOC_PPC_TOC16;
881b8e
 #endif
881b8e
-      fieldval = value;
881b8e
-      switch (fixP->fx_r_type)
881b8e
-	{
881b8e
+    }
881b8e
+
881b8e
+  /* Calculate value to be stored in field.  */
881b8e
+  fieldval = value;
881b8e
+  switch (fixP->fx_r_type)
881b8e
+    {
881b8e
 #ifdef OBJ_ELF
881b8e
-	case BFD_RELOC_PPC64_ADDR16_LO_DS:
881b8e
-	  if (fixP->fx_pcrel)
881b8e
-	    goto bad_pcrel;
881b8e
-	  /* fall through */
881b8e
+    case BFD_RELOC_PPC64_ADDR16_LO_DS:
881b8e
+    case BFD_RELOC_PPC_VLE_LO16A:
881b8e
+    case BFD_RELOC_PPC_VLE_LO16D:
881b8e
 #endif
881b8e
-	case BFD_RELOC_LO16:
881b8e
-	  if (fixP->fx_pcrel)
881b8e
-	    fixP->fx_r_type = BFD_RELOC_LO16_PCREL;
881b8e
-	  /* fall through */
881b8e
-	case BFD_RELOC_LO16_PCREL:
881b8e
-	  fieldval = SEX16 (value);
881b8e
-	  break;
881b8e
+    case BFD_RELOC_LO16:
881b8e
+    case BFD_RELOC_LO16_PCREL:
881b8e
+      fieldval = value & 0xffff;
881b8e
+    sign_extend_16:
881b8e
+      if (operand != NULL && (operand->flags & PPC_OPERAND_SIGNED) != 0)
881b8e
+	fieldval = SEX16 (fieldval);
881b8e
+      fixP->fx_no_overflow = 1;
881b8e
+      break;
881b8e
 
881b8e
-	case BFD_RELOC_HI16:
881b8e
-	  if (fixP->fx_pcrel)
881b8e
-	    fixP->fx_r_type = BFD_RELOC_HI16_PCREL;
881b8e
-	  /* fall through */
881b8e
-	case BFD_RELOC_HI16_PCREL:
881b8e
-	  fieldval = SEX16 (PPC_HI (value));
881b8e
+    case BFD_RELOC_HI16:
881b8e
+    case BFD_RELOC_HI16_PCREL:
881b8e
+#ifdef OBJ_ELF
881b8e
+      if (REPORT_OVERFLOW_HI && ppc_obj64)
881b8e
+	{
881b8e
+	  fieldval = value >> 16;
881b8e
+	  if (operand != NULL && (operand->flags & PPC_OPERAND_SIGNED) != 0)
881b8e
+	    {
881b8e
+	      valueT sign = (((valueT) -1 >> 16) + 1) >> 1;
881b8e
+	      fieldval = ((valueT) fieldval ^ sign) - sign;
881b8e
+	    }
881b8e
 	  break;
881b8e
+	}
881b8e
+      /* Fall thru */
881b8e
 
881b8e
-	case BFD_RELOC_HI16_S:
881b8e
-	  if (fixP->fx_pcrel)
881b8e
-	    fixP->fx_r_type = BFD_RELOC_HI16_S_PCREL;
881b8e
-	  /* fall through */
881b8e
-	case BFD_RELOC_HI16_S_PCREL:
881b8e
-	  fieldval = SEX16 (PPC_HA (value));
881b8e
-	  break;
881b8e
+    case BFD_RELOC_PPC_VLE_HI16A:
881b8e
+    case BFD_RELOC_PPC_VLE_HI16D:
881b8e
+    case BFD_RELOC_PPC64_ADDR16_HIGH:
881b8e
+#endif
881b8e
+      fieldval = PPC_HI (value);
881b8e
+      goto sign_extend_16;
881b8e
 
881b8e
+    case BFD_RELOC_HI16_S:
881b8e
+    case BFD_RELOC_HI16_S_PCREL:
881b8e
 #ifdef OBJ_ELF
881b8e
-	case BFD_RELOC_PPC64_HIGHER:
881b8e
-	  if (fixP->fx_pcrel)
881b8e
-	    goto bad_pcrel;
881b8e
-	  fieldval = SEX16 (PPC_HIGHER (value));
881b8e
+      if (REPORT_OVERFLOW_HI && ppc_obj64)
881b8e
+	{
881b8e
+	  fieldval = (value + 0x8000) >> 16;
881b8e
+	  if (operand != NULL && (operand->flags & PPC_OPERAND_SIGNED) != 0)
881b8e
+	    {
881b8e
+	      valueT sign = (((valueT) -1 >> 16) + 1) >> 1;
881b8e
+	      fieldval = ((valueT) fieldval ^ sign) - sign;
881b8e
+	    }
881b8e
 	  break;
881b8e
+	}
881b8e
+      /* Fall thru */
881b8e
 
881b8e
-	case BFD_RELOC_PPC64_HIGHER_S:
881b8e
-	  if (fixP->fx_pcrel)
881b8e
-	    goto bad_pcrel;
881b8e
-	  fieldval = SEX16 (PPC_HIGHERA (value));
881b8e
-	  break;
881b8e
+    case BFD_RELOC_PPC_VLE_HA16A:
881b8e
+    case BFD_RELOC_PPC_VLE_HA16D:
881b8e
+    case BFD_RELOC_PPC64_ADDR16_HIGHA:
881b8e
+#endif
881b8e
+      fieldval = PPC_HA (value);
881b8e
+      goto sign_extend_16;
881b8e
 
881b8e
-	case BFD_RELOC_PPC64_HIGHEST:
881b8e
-	  if (fixP->fx_pcrel)
881b8e
-	    goto bad_pcrel;
881b8e
-	  fieldval = SEX16 (PPC_HIGHEST (value));
881b8e
-	  break;
881b8e
+#ifdef OBJ_ELF
881b8e
+    case BFD_RELOC_PPC64_HIGHER:
881b8e
+      fieldval = PPC_HIGHER (value);
881b8e
+      goto sign_extend_16;
881b8e
 
881b8e
-	case BFD_RELOC_PPC64_HIGHEST_S:
881b8e
-	  if (fixP->fx_pcrel)
881b8e
-	    goto bad_pcrel;
881b8e
-	  fieldval = SEX16 (PPC_HIGHESTA (value));
881b8e
-	  break;
881b8e
+    case BFD_RELOC_PPC64_HIGHER_S:
881b8e
+      fieldval = PPC_HIGHERA (value);
881b8e
+      goto sign_extend_16;
881b8e
+
881b8e
+    case BFD_RELOC_PPC64_HIGHEST:
881b8e
+      fieldval = PPC_HIGHEST (value);
881b8e
+      goto sign_extend_16;
881b8e
+
881b8e
+    case BFD_RELOC_PPC64_HIGHEST_S:
881b8e
+      fieldval = PPC_HIGHESTA (value);
881b8e
+      goto sign_extend_16;
881b8e
+#endif
881b8e
 
881b8e
+    default:
881b8e
+      break;
881b8e
+    }
881b8e
+
881b8e
+  if (operand != NULL)
881b8e
+    {
881b8e
+      /* Handle relocs in an insn.  */
881b8e
+      char *where;
881b8e
+      unsigned long insn;
881b8e
+
881b8e
+      switch (fixP->fx_r_type)
881b8e
+	{
881b8e
+#ifdef OBJ_ELF
881b8e
 	  /* The following relocs can't be calculated by the assembler.
881b8e
 	     Leave the field zero.  */
881b8e
 	case BFD_RELOC_PPC_TPREL16:
881b8e
@@ -6658,8 +6690,6 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
881b8e
 	  gas_assert (fixP->fx_addsy != NULL);
881b8e
 	  S_SET_THREAD_LOCAL (fixP->fx_addsy);
881b8e
 	  fieldval = 0;
881b8e
-	  if (fixP->fx_pcrel)
881b8e
-	    goto bad_pcrel;
881b8e
 	  break;
881b8e
 
881b8e
 	  /* These also should leave the field zero for the same
881b8e
@@ -6726,8 +6756,13 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
881b8e
 	case BFD_RELOC_PPC_TLSGD:
881b8e
 	case BFD_RELOC_PPC_TLSLD:
881b8e
 	  fieldval = 0;
881b8e
-	  if (fixP->fx_pcrel)
881b8e
-	    goto bad_pcrel;
881b8e
+	  break;
881b8e
+#endif
881b8e
+
881b8e
+#ifdef OBJ_XCOFF
881b8e
+	case BFD_RELOC_PPC_B16:
881b8e
+	  /* Adjust the offset to the instruction boundary.  */
881b8e
+	  fieldval += 2;
881b8e
 	  break;
881b8e
 #endif
881b8e
 
881b8e
@@ -6805,79 +6840,9 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
881b8e
     }
881b8e
   else
881b8e
     {
881b8e
-      int size = 0;
881b8e
-      offsetT fieldval = value;
881b8e
-
881b8e
       /* Handle relocs in data.  */
881b8e
       switch (fixP->fx_r_type)
881b8e
 	{
881b8e
-	case BFD_RELOC_CTOR:
881b8e
-	  if (ppc_obj64)
881b8e
-	    goto ctor64;
881b8e
-	  /* fall through */
881b8e
-
881b8e
-	case BFD_RELOC_32:
881b8e
-	  if (fixP->fx_pcrel)
881b8e
-	    fixP->fx_r_type = BFD_RELOC_32_PCREL;
881b8e
-	  /* fall through */
881b8e
-
881b8e
-	case BFD_RELOC_32_PCREL:
881b8e
-	case BFD_RELOC_RVA:
881b8e
-	  size = 4;
881b8e
-	  break;
881b8e
-
881b8e
-	case BFD_RELOC_64:
881b8e
-	ctor64:
881b8e
-	  if (fixP->fx_pcrel)
881b8e
-	    fixP->fx_r_type = BFD_RELOC_64_PCREL;
881b8e
-	  /* fall through */
881b8e
-
881b8e
-	case BFD_RELOC_64_PCREL:
881b8e
-	  size = 8;
881b8e
-	  break;
881b8e
-
881b8e
-	case BFD_RELOC_16:
881b8e
-	  if (fixP->fx_pcrel)
881b8e
-	    fixP->fx_r_type = BFD_RELOC_16_PCREL;
881b8e
-	  /* fall through */
881b8e
-
881b8e
-	case BFD_RELOC_16_PCREL:
881b8e
-	  size = 2;
881b8e
-	  break;
881b8e
-
881b8e
-	case BFD_RELOC_8:
881b8e
-	  if (fixP->fx_pcrel)
881b8e
-	    {
881b8e
-#ifdef OBJ_ELF
881b8e
-	    bad_pcrel:
881b8e
-#endif
881b8e
-	      if (fixP->fx_addsy)
881b8e
-		{
881b8e
-		  char *sfile;
881b8e
-		  unsigned int sline;
881b8e
-
881b8e
-		  /* Use expr_symbol_where to see if this is an
881b8e
-		     expression symbol.  */
881b8e
-		  if (expr_symbol_where (fixP->fx_addsy, &sfile, &sline))
881b8e
-		    as_bad_where (fixP->fx_file, fixP->fx_line,
881b8e
-				  _("unresolved expression that must"
881b8e
-				    " be resolved"));
881b8e
-		  else
881b8e
-		    as_bad_where (fixP->fx_file, fixP->fx_line,
881b8e
-				  _("cannot emit PC relative %s relocation"
881b8e
-				    " against %s"),
881b8e
-				  bfd_get_reloc_code_name (fixP->fx_r_type),
881b8e
-				  S_GET_NAME (fixP->fx_addsy));
881b8e
-		}
881b8e
-	      else
881b8e
-		as_bad_where (fixP->fx_file, fixP->fx_line,
881b8e
-			      _("unable to resolve expression"));
881b8e
-	      fixP->fx_done = 1;
881b8e
-	    }
881b8e
-	  else
881b8e
-	    size = 1;
881b8e
-	  break;
881b8e
-
881b8e
 	case BFD_RELOC_VTABLE_INHERIT:
881b8e
 	  if (fixP->fx_addsy
881b8e
 	      && !S_IS_DEFINED (fixP->fx_addsy)
881b8e
@@ -6892,54 +6857,17 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
881b8e
 #ifdef OBJ_ELF
881b8e
 	  /* These can appear with @l etc. in data.  */
881b8e
 	case BFD_RELOC_LO16:
881b8e
-	  if (fixP->fx_pcrel)
881b8e
-	    fixP->fx_r_type = BFD_RELOC_LO16_PCREL;
881b8e
 	case BFD_RELOC_LO16_PCREL:
881b8e
-	  size = 2;
881b8e
-	  break;
881b8e
-
881b8e
 	case BFD_RELOC_HI16:
881b8e
-	  if (fixP->fx_pcrel)
881b8e
-	    fixP->fx_r_type = BFD_RELOC_HI16_PCREL;
881b8e
 	case BFD_RELOC_HI16_PCREL:
881b8e
-	  size = 2;
881b8e
-	  fieldval = PPC_HI (value);
881b8e
-	  break;
881b8e
-
881b8e
 	case BFD_RELOC_HI16_S:
881b8e
-	  if (fixP->fx_pcrel)
881b8e
-	    fixP->fx_r_type = BFD_RELOC_HI16_S_PCREL;
881b8e
 	case BFD_RELOC_HI16_S_PCREL:
881b8e
-	  size = 2;
881b8e
-	  fieldval = PPC_HA (value);
881b8e
-	  break;
881b8e
-
881b8e
 	case BFD_RELOC_PPC64_HIGHER:
881b8e
-	  if (fixP->fx_pcrel)
881b8e
-	    goto bad_pcrel;
881b8e
-	  size = 2;
881b8e
-	  fieldval = PPC_HIGHER (value);
881b8e
-	  break;
881b8e
-
881b8e
 	case BFD_RELOC_PPC64_HIGHER_S:
881b8e
-	  if (fixP->fx_pcrel)
881b8e
-	    goto bad_pcrel;
881b8e
-	  size = 2;
881b8e
-	  fieldval = PPC_HIGHERA (value);
881b8e
-	  break;
881b8e
-
881b8e
 	case BFD_RELOC_PPC64_HIGHEST:
881b8e
-	  if (fixP->fx_pcrel)
881b8e
-	    goto bad_pcrel;
881b8e
-	  size = 2;
881b8e
-	  fieldval = PPC_HIGHEST (value);
881b8e
-	  break;
881b8e
-
881b8e
 	case BFD_RELOC_PPC64_HIGHEST_S:
881b8e
-	  if (fixP->fx_pcrel)
881b8e
-	    goto bad_pcrel;
881b8e
-	  size = 2;
881b8e
-	  fieldval = PPC_HIGHESTA (value);
881b8e
+	case BFD_RELOC_PPC64_ADDR16_HIGH:
881b8e
+	case BFD_RELOC_PPC64_ADDR16_HIGHA:
881b8e
 	  break;
881b8e
 
881b8e
 	case BFD_RELOC_PPC_DTPMOD:
881b8e
@@ -7034,8 +6962,17 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
881b8e
 
881b8e
 #ifdef OBJ_XCOFF
881b8e
 	case BFD_RELOC_NONE:
881b8e
-	  break;
881b8e
 #endif
881b8e
+	case BFD_RELOC_CTOR:
881b8e
+	case BFD_RELOC_32:
881b8e
+	case BFD_RELOC_32_PCREL:
881b8e
+	case BFD_RELOC_RVA:
881b8e
+	case BFD_RELOC_64:
881b8e
+	case BFD_RELOC_64_PCREL:
881b8e
+	case BFD_RELOC_16:
881b8e
+	case BFD_RELOC_16_PCREL:
881b8e
+	case BFD_RELOC_8:
881b8e
+	  break;
881b8e
 
881b8e
 	default:
881b8e
 	  fprintf (stderr,
881b8e
@@ -7044,9 +6981,85 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
881b8e
 	  abort ();
881b8e
 	}
881b8e
 
881b8e
-      if (size && APPLY_RELOC)
881b8e
+      if (fixP->fx_size && APPLY_RELOC)
881b8e
 	md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where,
881b8e
-			    fieldval, size);
881b8e
+			    fieldval, fixP->fx_size);
881b8e
+    }
881b8e
+
881b8e
+  /* We are only able to convert some relocs to pc-relative.  */
881b8e
+  if (!fixP->fx_done && fixP->fx_pcrel)
881b8e
+    {
881b8e
+      switch (fixP->fx_r_type)
881b8e
+	{
881b8e
+	case BFD_RELOC_LO16:
881b8e
+	  fixP->fx_r_type = BFD_RELOC_LO16_PCREL;
881b8e
+	  break;
881b8e
+
881b8e
+	case BFD_RELOC_HI16:
881b8e
+	  fixP->fx_r_type = BFD_RELOC_HI16_PCREL;
881b8e
+	  break;
881b8e
+
881b8e
+	case BFD_RELOC_HI16_S:
881b8e
+	  fixP->fx_r_type = BFD_RELOC_HI16_S_PCREL;
881b8e
+	  break;
881b8e
+
881b8e
+	case BFD_RELOC_64:
881b8e
+	  fixP->fx_r_type = BFD_RELOC_64_PCREL;
881b8e
+	  break;
881b8e
+
881b8e
+	case BFD_RELOC_32:
881b8e
+	  fixP->fx_r_type = BFD_RELOC_32_PCREL;
881b8e
+	  break;
881b8e
+
881b8e
+	case BFD_RELOC_16:
881b8e
+	  fixP->fx_r_type = BFD_RELOC_16_PCREL;
881b8e
+	  break;
881b8e
+
881b8e
+	  /* Some of course are already pc-relative.  */
881b8e
+	case BFD_RELOC_LO16_PCREL:
881b8e
+	case BFD_RELOC_HI16_PCREL:
881b8e
+	case BFD_RELOC_HI16_S_PCREL:
881b8e
+	case BFD_RELOC_64_PCREL:
881b8e
+	case BFD_RELOC_32_PCREL:
881b8e
+	case BFD_RELOC_16_PCREL:
881b8e
+	case BFD_RELOC_PPC_B16:
881b8e
+	case BFD_RELOC_PPC_B16_BRTAKEN:
881b8e
+	case BFD_RELOC_PPC_B16_BRNTAKEN:
881b8e
+	case BFD_RELOC_PPC_B26:
881b8e
+	case BFD_RELOC_PPC_LOCAL24PC:
881b8e
+	case BFD_RELOC_24_PLT_PCREL:
881b8e
+	case BFD_RELOC_32_PLT_PCREL:
881b8e
+	case BFD_RELOC_64_PLT_PCREL:
881b8e
+	case BFD_RELOC_PPC_VLE_REL8:
881b8e
+	case BFD_RELOC_PPC_VLE_REL15:
881b8e
+	case BFD_RELOC_PPC_VLE_REL24:
881b8e
+	  break;
881b8e
+
881b8e
+	default:
881b8e
+	  if (fixP->fx_addsy)
881b8e
+	    {
881b8e
+	      char *sfile;
881b8e
+	      unsigned int sline;
881b8e
+
881b8e
+	      /* Use expr_symbol_where to see if this is an
881b8e
+		 expression symbol.  */
881b8e
+	      if (expr_symbol_where (fixP->fx_addsy, &sfile, &sline))
881b8e
+		as_bad_where (fixP->fx_file, fixP->fx_line,
881b8e
+			      _("unresolved expression that must"
881b8e
+				" be resolved"));
881b8e
+	      else
881b8e
+		as_bad_where (fixP->fx_file, fixP->fx_line,
881b8e
+			      _("cannot emit PC relative %s relocation"
881b8e
+				" against %s"),
881b8e
+			      bfd_get_reloc_code_name (fixP->fx_r_type),
881b8e
+			      S_GET_NAME (fixP->fx_addsy));
881b8e
+	    }
881b8e
+	  else
881b8e
+	    as_bad_where (fixP->fx_file, fixP->fx_line,
881b8e
+			  _("unable to resolve expression"));
881b8e
+	  fixP->fx_done = 1;
881b8e
+	  break;
881b8e
+	}
881b8e
     }
881b8e
 
881b8e
 #ifdef OBJ_ELF
881b8e
@@ -7082,6 +7095,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
881b8e
       fixP->fx_addnumber =
881b8e
 	- bfd_get_section_vma (stdoutput, S_GET_SEGMENT (fixP->fx_addsy))
881b8e
 	- S_GET_VALUE (ppc_toc_csect);
881b8e
+      /* Set *valP to avoid errors.  */
881b8e
+      *valP = value;
881b8e
 #endif
881b8e
     }
881b8e
 #endif
881b8e
diff --git a/gas/testsuite/gas/ppc/vsx2.d b/gas/testsuite/gas/ppc/vsx2.d
881b8e
index 0fc1cfa..04e4294 100644
881b8e
--- a/gas/testsuite/gas/ppc/vsx2.d
881b8e
+++ b/gas/testsuite/gas/ppc/vsx2.d
881b8e
@@ -7,59 +7,59 @@
881b8e
 Disassembly of section \.text:
881b8e
 
881b8e
 0+00 <vsx2>:
881b8e
-   0:	7f ce d0 19 	lxsiwzx vs62,r14,r26
881b8e
-   4:	7d 00 c8 19 	lxsiwzx vs40,0,r25
881b8e
-   8:	7f 20 d0 98 	lxsiwax vs25,0,r26
881b8e
-   c:	7c 60 18 98 	lxsiwax vs3,0,r3
881b8e
-  10:	7f cc 00 66 	mfvsrd  r12,vs30
881b8e
-  14:	7f cc 00 66 	mfvsrd  r12,vs30
881b8e
-  18:	7f cc 00 67 	mfvsrd  r12,vs62
881b8e
-  1c:	7f cc 00 67 	mfvsrd  r12,vs62
881b8e
-  20:	7d 94 00 e6 	mffprwz r20,f12
881b8e
-  24:	7d 94 00 e6 	mffprwz r20,f12
881b8e
-  28:	7d 95 00 e7 	mfvrwz  r21,v12
881b8e
-  2c:	7d 95 00 e7 	mfvrwz  r21,v12
881b8e
-  30:	7d c9 71 18 	stxsiwx vs14,r9,r14
881b8e
-  34:	7e a0 41 18 	stxsiwx vs21,0,r8
881b8e
-  38:	7d 7c 01 66 	mtvsrd  vs11,r28
881b8e
-  3c:	7d 7c 01 66 	mtvsrd  vs11,r28
881b8e
-  40:	7d 7d 01 67 	mtvsrd  vs43,r29
881b8e
-  44:	7d 7d 01 67 	mtvsrd  vs43,r29
881b8e
-  48:	7f 16 01 a6 	mtfprwa f24,r22
881b8e
-  4c:	7f 16 01 a6 	mtfprwa f24,r22
881b8e
-  50:	7f 37 01 a7 	mtvrwa  v25,r23
881b8e
-  54:	7f 37 01 a7 	mtvrwa  v25,r23
881b8e
-  58:	7f 5b 01 e6 	mtfprwz f26,r27
881b8e
-  5c:	7f 5b 01 e6 	mtfprwz f26,r27
881b8e
-  60:	7f 7c 01 e7 	mtvrwz  v27,r28
881b8e
-  64:	7f 7c 01 e7 	mtvrwz  v27,r28
881b8e
-  68:	7d b3 6c 18 	lxsspx  vs13,r19,r13
881b8e
-  6c:	7e 40 6c 18 	lxsspx  vs18,0,r13
881b8e
-  70:	7d 62 25 19 	stxsspx vs43,r2,r4
881b8e
-  74:	7e e0 5d 19 	stxsspx vs55,0,r11
881b8e
-  78:	f2 d0 c8 05 	xsaddsp vs54,vs48,vs25
881b8e
-  7c:	f1 d2 08 0c 	xsmaddasp vs14,vs50,vs1
881b8e
-  80:	f3 56 50 42 	xssubsp vs26,vs22,vs42
881b8e
-  84:	f3 75 a0 4e 	xsmaddmsp vs27,vs53,vs52
881b8e
-  88:	f1 00 d8 2a 	xsrsqrtesp vs8,vs59
881b8e
-  8c:	f1 80 48 2e 	xssqrtsp vs12,vs41
881b8e
-  90:	f3 2b 00 83 	xsmulsp vs57,vs11,vs32
881b8e
-  94:	f0 d4 d0 89 	xsmsubasp vs38,vs20,vs26
881b8e
-  98:	f3 53 30 c0 	xsdivsp vs26,vs19,vs6
881b8e
-  9c:	f0 65 b8 cf 	xsmsubmsp vs35,vs37,vs55
881b8e
-  a0:	f3 60 40 69 	xsresp  vs59,vs8
881b8e
-  a4:	f1 81 0c 0f 	xsnmaddasp vs44,vs33,vs33
881b8e
-  a8:	f2 3e f4 4c 	xsnmaddmsp vs17,vs62,vs30
881b8e
-  ac:	f2 d4 fc 8d 	xsnmsubasp vs54,vs52,vs31
881b8e
-  b0:	f0 a5 d4 cb 	xsnmsubmsp vs37,vs5,vs58
881b8e
-  b4:	f3 d6 65 56 	xxlorc  vs30,vs54,vs44
881b8e
-  b8:	f2 2e ed 91 	xxlnand vs49,vs14,vs29
881b8e
-  bc:	f3 d6 f5 d1 	xxleqv  vs62,vs22,vs30
881b8e
-  c0:	f3 80 b4 2f 	xscvdpspn vs60,vs54
881b8e
-  c4:	f2 c0 6c 66 	xsrsp   vs22,vs45
881b8e
-  c8:	f3 40 dc a2 	xscvuxdsp vs26,vs59
881b8e
-  cc:	f0 c0 8c e3 	xscvsxdsp vs38,vs49
881b8e
-  d0:	f3 60 d5 2d 	xscvspdpn vs59,vs26
881b8e
-  d4:	ff 0e 16 8c 	fmrgow  f24,f14,f2
881b8e
-  d8:	fe c7 2f 8c 	fmrgew  f22,f7,f5
881b8e
+   0:	(7f ce d0 19|19 d0 ce 7f) 	lxsiwzx vs62,r14,r26
881b8e
+   4:	(7d 00 c8 19|19 c8 00 7d) 	lxsiwzx vs40,0,r25
881b8e
+   8:	(7f 20 d0 98|98 d0 20 7f) 	lxsiwax vs25,0,r26
881b8e
+   c:	(7c 60 18 98|98 18 60 7c) 	lxsiwax vs3,0,r3
881b8e
+  10:	(7f cc 00 66|66 00 cc 7f) 	mfvsrd  r12,vs30
881b8e
+  14:	(7f cc 00 66|66 00 cc 7f) 	mfvsrd  r12,vs30
881b8e
+  18:	(7f cc 00 67|67 00 cc 7f) 	mfvsrd  r12,vs62
881b8e
+  1c:	(7f cc 00 67|67 00 cc 7f) 	mfvsrd  r12,vs62
881b8e
+  20:	(7d 94 00 e6|e6 00 94 7d) 	mffprwz r20,f12
881b8e
+  24:	(7d 94 00 e6|e6 00 94 7d) 	mffprwz r20,f12
881b8e
+  28:	(7d 95 00 e7|e7 00 95 7d) 	mfvrwz  r21,v12
881b8e
+  2c:	(7d 95 00 e7|e7 00 95 7d) 	mfvrwz  r21,v12
881b8e
+  30:	(7d c9 71 18|18 71 c9 7d) 	stxsiwx vs14,r9,r14
881b8e
+  34:	(7e a0 41 18|18 41 a0 7e) 	stxsiwx vs21,0,r8
881b8e
+  38:	(7d 7c 01 66|66 01 7c 7d) 	mtvsrd  vs11,r28
881b8e
+  3c:	(7d 7c 01 66|66 01 7c 7d) 	mtvsrd  vs11,r28
881b8e
+  40:	(7d 7d 01 67|67 01 7d 7d) 	mtvsrd  vs43,r29
881b8e
+  44:	(7d 7d 01 67|67 01 7d 7d) 	mtvsrd  vs43,r29
881b8e
+  48:	(7f 16 01 a6|a6 01 16 7f) 	mtfprwa f24,r22
881b8e
+  4c:	(7f 16 01 a6|a6 01 16 7f) 	mtfprwa f24,r22
881b8e
+  50:	(7f 37 01 a7|a7 01 37 7f) 	mtvrwa  v25,r23
881b8e
+  54:	(7f 37 01 a7|a7 01 37 7f) 	mtvrwa  v25,r23
881b8e
+  58:	(7f 5b 01 e6|e6 01 5b 7f) 	mtfprwz f26,r27
881b8e
+  5c:	(7f 5b 01 e6|e6 01 5b 7f) 	mtfprwz f26,r27
881b8e
+  60:	(7f 7c 01 e7|e7 01 7c 7f) 	mtvrwz  v27,r28
881b8e
+  64:	(7f 7c 01 e7|e7 01 7c 7f) 	mtvrwz  v27,r28
881b8e
+  68:	(7d b3 6c 18|18 6c b3 7d) 	lxsspx  vs13,r19,r13
881b8e
+  6c:	(7e 40 6c 18|18 6c 40 7e) 	lxsspx  vs18,0,r13
881b8e
+  70:	(7d 62 25 19|19 25 62 7d) 	stxsspx vs43,r2,r4
881b8e
+  74:	(7e e0 5d 19|19 5d e0 7e) 	stxsspx vs55,0,r11
881b8e
+  78:	(f2 d0 c8 05|05 c8 d0 f2) 	xsaddsp vs54,vs48,vs25
881b8e
+  7c:	(f1 d2 08 0c|0c 08 d2 f1) 	xsmaddasp vs14,vs50,vs1
881b8e
+  80:	(f3 56 50 42|42 50 56 f3) 	xssubsp vs26,vs22,vs42
881b8e
+  84:	(f3 75 a0 4e|4e a0 75 f3) 	xsmaddmsp vs27,vs53,vs52
881b8e
+  88:	(f1 00 d8 2a|2a d8 00 f1) 	xsrsqrtesp vs8,vs59
881b8e
+  8c:	(f1 80 48 2e|2e 48 80 f1) 	xssqrtsp vs12,vs41
881b8e
+  90:	(f3 2b 00 83|83 00 2b f3) 	xsmulsp vs57,vs11,vs32
881b8e
+  94:	(f0 d4 d0 89|89 d0 d4 f0) 	xsmsubasp vs38,vs20,vs26
881b8e
+  98:	(f3 53 30 c0|c0 30 53 f3) 	xsdivsp vs26,vs19,vs6
881b8e
+  9c:	(f0 65 b8 cf|cf b8 65 f0) 	xsmsubmsp vs35,vs37,vs55
881b8e
+  a0:	(f3 60 40 69|69 40 60 f3) 	xsresp  vs59,vs8
881b8e
+  a4:	(f1 81 0c 0f|0f 0c 81 f1) 	xsnmaddasp vs44,vs33,vs33
881b8e
+  a8:	(f2 3e f4 4c|4c f4 3e f2) 	xsnmaddmsp vs17,vs62,vs30
881b8e
+  ac:	(f2 d4 fc 8d|8d fc d4 f2) 	xsnmsubasp vs54,vs52,vs31
881b8e
+  b0:	(f0 a5 d4 cb|cb d4 a5 f0) 	xsnmsubmsp vs37,vs5,vs58
881b8e
+  b4:	(f3 d6 65 56|56 65 d6 f3) 	xxlorc  vs30,vs54,vs44
881b8e
+  b8:	(f2 2e ed 91|91 ed 2e f2) 	xxlnand vs49,vs14,vs29
881b8e
+  bc:	(f3 d6 f5 d1|d1 f5 d6 f3) 	xxleqv  vs62,vs22,vs30
881b8e
+  c0:	(f3 80 b4 2f|2f b4 80 f3) 	xscvdpspn vs60,vs54
881b8e
+  c4:	(f2 c0 6c 66|66 6c c0 f2) 	xsrsp   vs22,vs45
881b8e
+  c8:	(f3 40 dc a2|a2 dc 40 f3) 	xscvuxdsp vs26,vs59
881b8e
+  cc:	(f0 c0 8c e3|e3 8c c0 f0) 	xscvsxdsp vs38,vs49
881b8e
+  d0:	(f3 60 d5 2d|2d d5 60 f3) 	xscvspdpn vs59,vs26
881b8e
+  d4:	(ff 0e 16 8c|8c 16 0e ff) 	fmrgow  f24,f14,f2
881b8e
+  d8:	(fe c7 2f 8c|8c 2f c7 fe) 	fmrgew  f22,f7,f5
881b8e
 #pass
881b8e
diff --git a/ld/testsuite/ld-powerpc/relbrlt.d b/ld/testsuite/ld-powerpc/relbrlt.d
881b8e
index 689373c..b04ae7d 100644
881b8e
--- a/ld/testsuite/ld-powerpc/relbrlt.d
881b8e
+++ b/ld/testsuite/ld-powerpc/relbrlt.d
881b8e
@@ -3,58 +3,58 @@
881b8e
 #ld: -melf64ppc --no-ld-generated-unwind-info --emit-relocs
881b8e
 #objdump: -Dr
881b8e
 
881b8e
-.*:     file format elf64-powerpc
881b8e
+.*
881b8e
 
881b8e
 Disassembly of section \.text:
881b8e
 
881b8e
 0*100000c0 <_start>:
881b8e
-[0-9a-f	 ]*:	49 bf 00 2d 	bl      .*
881b8e
+[0-9a-f	 ]*:	(49 bf 00 2d|2d 00 bf 49) 	bl      .*
881b8e
 [0-9a-f	 ]*: R_PPC64_REL24	\.text\+0x37e003c
881b8e
-[0-9a-f	 ]*:	60 00 00 00 	nop
881b8e
-[0-9a-f	 ]*:	49 bf 00 19 	bl      .*
881b8e
+[0-9a-f	 ]*:	(60 00 00 00|00 00 00 60) 	nop
881b8e
+[0-9a-f	 ]*:	(49 bf 00 19|19 00 bf 49) 	bl      .*
881b8e
 [0-9a-f	 ]*: R_PPC64_REL24	\.text\+0x3bf0020
881b8e
-[0-9a-f	 ]*:	60 00 00 00 	nop
881b8e
-[0-9a-f	 ]*:	49 bf 00 21 	bl      .*
881b8e
+[0-9a-f	 ]*:	(60 00 00 00|00 00 00 60) 	nop
881b8e
+[0-9a-f	 ]*:	(49 bf 00 21|21 00 bf 49) 	bl      .*
881b8e
 [0-9a-f	 ]*: R_PPC64_REL24	\.text\+0x57e0024
881b8e
-[0-9a-f	 ]*:	60 00 00 00 	nop
881b8e
+[0-9a-f	 ]*:	(60 00 00 00|00 00 00 60) 	nop
881b8e
 [0-9a-f	 ]*:	00 00 00 00 	\.long 0x0
881b8e
-[0-9a-f	 ]*:	4b ff ff e4 	b       .* <_start>
881b8e
+[0-9a-f	 ]*:	(4b ff ff e4|e4 ff ff 4b) 	b       .* <_start>
881b8e
 	\.\.\.
881b8e
 
881b8e
 [0-9a-f	 ]*<.*plt_branch.*>:
881b8e
-[0-9a-f	 ]*:	e9 62 80 00 	ld      r11,-32768\(r2\)
881b8e
+[0-9a-f	 ]*:	(e9 82 80 00|00 80 82 e9) 	ld      r12,-32768\(r2\)
881b8e
 [0-9a-f	 ]*: R_PPC64_TOC16_DS	\*ABS\*\+0x157f00e8
881b8e
-[0-9a-f	 ]*:	7d 69 03 a6 	mtctr   r11
881b8e
-[0-9a-f	 ]*:	4e 80 04 20 	bctr
881b8e
+[0-9a-f	 ]*:	(7d 89 03 a6|a6 03 89 7d) 	mtctr   r12
881b8e
+[0-9a-f	 ]*:	(4e 80 04 20|20 04 80 4e) 	bctr
881b8e
 
881b8e
 [0-9a-f	 ]*<.*long_branch.*>:
881b8e
-[0-9a-f	 ]*:	49 bf 00 10 	b       .* <far>
881b8e
+[0-9a-f	 ]*:	(49 bf 00 10|10 00 bf 49) 	b       .* <far>
881b8e
 [0-9a-f	 ]*: R_PPC64_REL24	\*ABS\*\+0x137e00fc
881b8e
 
881b8e
 [0-9a-f	 ]*<.*plt_branch.*>:
881b8e
-[0-9a-f	 ]*:	e9 62 80 08 	ld      r11,-32760\(r2\)
881b8e
+[0-9a-f	 ]*:	(e9 82 80 08|08 80 82 e9) 	ld      r12,-32760\(r2\)
881b8e
 [0-9a-f	 ]*: R_PPC64_TOC16_DS	\*ABS\*\+0x157f00f0
881b8e
-[0-9a-f	 ]*:	7d 69 03 a6 	mtctr   r11
881b8e
-[0-9a-f	 ]*:	4e 80 04 20 	bctr
881b8e
+[0-9a-f	 ]*:	(7d 89 03 a6|a6 03 89 7d) 	mtctr   r12
881b8e
+[0-9a-f	 ]*:	(4e 80 04 20|20 04 80 4e) 	bctr
881b8e
 	\.\.\.
881b8e
 
881b8e
 0*137e00fc <far>:
881b8e
-[0-9a-f	 ]*:	4e 80 00 20 	blr
881b8e
+[0-9a-f	 ]*:	(4e 80 00 20|20 00 80 4e) 	blr
881b8e
 	\.\.\.
881b8e
 
881b8e
 0*13bf00e0 <far2far>:
881b8e
-[0-9a-f	 ]*:	4e 80 00 20 	blr
881b8e
+[0-9a-f	 ]*:	(4e 80 00 20|20 00 80 4e) 	blr
881b8e
 	\.\.\.
881b8e
 
881b8e
 0*157e00e4 <huge>:
881b8e
-[0-9a-f	 ]*:	4e 80 00 20 	blr
881b8e
+[0-9a-f	 ]*:	(4e 80 00 20|20 00 80 4e) 	blr
881b8e
 
881b8e
 Disassembly of section \.branch_lt:
881b8e
 
881b8e
 0*157f00e8 .*:
881b8e
-[0-9a-f	 ]*:	00 00 00 00 .*
881b8e
+[0-9a-f	 ]*:	(00 00 00 00|e0 00 bf 13) .*
881b8e
 [0-9a-f	 ]*: R_PPC64_RELATIVE	\*ABS\*\+0x13bf00e0
881b8e
-[0-9a-f	 ]*:	13 bf 00 e0 .*
881b8e
-[0-9a-f	 ]*:	00 00 00 00 .*
881b8e
+[0-9a-f	 ]*:	(13 bf 00 e0|00 00 00 00) .*
881b8e
+[0-9a-f	 ]*:	(00 00 00 00|e4 00 7e 15) .*
881b8e
 [0-9a-f	 ]*: R_PPC64_RELATIVE	\*ABS\*\+0x157e00e4
881b8e
-[0-9a-f	 ]*:	15 7e 00 e4 .*
881b8e
+[0-9a-f	 ]*:	(15 7e 00 e4|00 00 00 00) .*
881b8e
diff --git a/ld/testsuite/ld-powerpc/symtocbase.d b/ld/testsuite/ld-powerpc/symtocbase.d
881b8e
index 5ffab72..118885f 100644
881b8e
--- a/ld/testsuite/ld-powerpc/symtocbase.d
881b8e
+++ b/ld/testsuite/ld-powerpc/symtocbase.d
881b8e
@@ -2,23 +2,24 @@
881b8e
 #source: symtocbase-2.s
881b8e
 #as: -a64
881b8e
 #ld: -shared -melf64ppc
881b8e
-#objdump: -dj.data
881b8e
+#objdump: -dj.data -z
881b8e
 #target: powerpc64*-*-*
881b8e
 
881b8e
-.*:     file format elf64-powerpc
881b8e
+.*
881b8e
 
881b8e
 Disassembly of section \.data:
881b8e
 
881b8e
 .* :
881b8e
-	\.\.\.
881b8e
-.*:	00 02 80 00 	\.long 0x28000
881b8e
-.*:	00 00 00 00 	\.long 0x0
881b8e
-.*:	00 02 80 00 	\.long 0x28000
881b8e
-.*:	00 00 00 00 	\.long 0x0
881b8e
-.*:	00 03 80 00 	\.long 0x38000
881b8e
-.*:	00 00 00 00 	\.long 0x0
881b8e
-.*:	00 03 80 00 	\.long 0x38000
881b8e
-.*:	00 00 00 00 	\.long 0x0
881b8e
-.*:	00 02 80 00 	\.long 0x28000
881b8e
-.*:	00 00 00 00 	\.long 0x0
881b8e
-.*:	00 03 80 00 	\.long 0x38000
881b8e
+#...
881b8e
+.*	\.long 0x28000
881b8e
+.*	\.long 0x0
881b8e
+.*	\.long 0x28000
881b8e
+.*	\.long 0x0
881b8e
+.*	\.long 0x38000
881b8e
+.*	\.long 0x0
881b8e
+.*	\.long 0x38000
881b8e
+.*	\.long 0x0
881b8e
+.*	\.long 0x28000
881b8e
+.*	\.long 0x0
881b8e
+.*	\.long 0x38000
881b8e
+#pass
881b8e
diff --git a/ld/testsuite/ld-powerpc/tls.d b/ld/testsuite/ld-powerpc/tls.d
881b8e
index eb4be24..7082028 100644
881b8e
--- a/ld/testsuite/ld-powerpc/tls.d
881b8e
+++ b/ld/testsuite/ld-powerpc/tls.d
881b8e
@@ -1,7 +1,7 @@
881b8e
 #source: tls.s
881b8e
 #source: tlslib.s
881b8e
 #as: -a64
881b8e
-#ld: 
881b8e
+#ld:
881b8e
 #objdump: -dr
881b8e
 #target: powerpc64*-*-*
881b8e
 
881b8e
diff --git a/ld/testsuite/ld-powerpc/tls.t b/ld/testsuite/ld-powerpc/tls.t
881b8e
index 77ba632..d54f25e 100644
881b8e
--- a/ld/testsuite/ld-powerpc/tls.t
881b8e
+++ b/ld/testsuite/ld-powerpc/tls.t
881b8e
@@ -5,7 +5,7 @@
881b8e
 #objdump: -sj.tdata
881b8e
 #target: powerpc64*-*-*
881b8e
 
881b8e
-.*: +file format elf64-powerpc
881b8e
+.*
881b8e
 
881b8e
 Contents of section \.tdata:
881b8e
 .* (12345678|f0debc9a) (9abcdef0|78563412) (23456789|01efcdab) (abcdef01|89674523)  .*
881b8e
diff --git a/ld/testsuite/ld-powerpc/tlstoc.d b/ld/testsuite/ld-powerpc/tlstoc.d
881b8e
index 05f61af..dccf82e 100644
881b8e
--- a/ld/testsuite/ld-powerpc/tlstoc.d
881b8e
+++ b/ld/testsuite/ld-powerpc/tlstoc.d
881b8e
@@ -1,7 +1,7 @@
881b8e
 #source: tlslib.s
881b8e
 #source: tlstoc.s
881b8e
 #as: -a64
881b8e
-#ld: 
881b8e
+#ld:
881b8e
 #objdump: -dr
881b8e
 #target: powerpc64*-*-*
881b8e
 
881b8e
diff --git a/ld/testsuite/ld-powerpc/tlstoc.t b/ld/testsuite/ld-powerpc/tlstoc.t
881b8e
index 8d25622..cdf43e7 100644
881b8e
--- a/ld/testsuite/ld-powerpc/tlstoc.t
881b8e
+++ b/ld/testsuite/ld-powerpc/tlstoc.t
881b8e
@@ -8,7 +8,7 @@
881b8e
 .*
881b8e
 
881b8e
 Contents of section \.tdata:
881b8e
- 10010148 (00c0ffee|eeffc000) 00000000 (12345678|78563412) (9abcdef0|f0debc9a)  .*
881b8e
- 10010158 (23456789|89674523) (abcdef01|01efcdab) (3456789a|9a785634) (bcdef012|12f0debc)  .*
881b8e
- 10010168 (456789ab|ab896745) (cdef0123|2301efcd) (56789abc|bc9a7856) (def01234|3412f0de)  .*
881b8e
- 10010178 (6789abcd|cdab8967) (ef012345|452301ef) (789abcde|debc9a78) (f0123456|563412f0)  .*
881b8e
+ 10010148 (00c0ffee|eeffc000) 00000000 (12345678|f0debc9a) (9abcdef0|78563412)  .*
881b8e
+ 10010158 (23456789|01efcdab) (abcdef01|89674523) (3456789a|12f0debc) (bcdef012|9a785634)  .*
881b8e
+ 10010168 (456789ab|2301efcd) (cdef0123|ab896745) (56789abc|3412f0de) (def01234|bc9a7856)  .*
881b8e
+ 10010178 (6789abcd|452301ef) (ef012345|cdab8967) (789abcde|563412f0) (f0123456|debc9a78)  .*
881b8e
diff --git a/ld/testsuite/ld-powerpc/tocopt.d b/ld/testsuite/ld-powerpc/tocopt.d
881b8e
index f447f70..161f00d 100644
881b8e
--- a/ld/testsuite/ld-powerpc/tocopt.d
881b8e
+++ b/ld/testsuite/ld-powerpc/tocopt.d
881b8e
@@ -2,13 +2,13 @@
881b8e
 .*:     file format .*
881b8e
 
881b8e
 Contents of section \.text:
881b8e
- 100000b0 3d220000 e9298018 3c820000 38a48020  .*
881b8e
- 100000c0 e8c50000 3fa00000 3bbd8028 7c62e82a  .*
881b8e
- 100000d0 3d220000 39298033 3c820000 38a48008  .*
881b8e
- 100000e0 e8c50000 3fa00000 3bbd8010 7c62e82a  .*
881b8e
+ 100000b0 (3d220000|0000223d) (e9298018|188029e9) (3c820000|0000823c) (38a48020|2080a438)  .*
881b8e
+ 100000c0 (e8c50000|0000c5e8) (3fa00000|0000a03f) (3bbd8028|2880bd3b) (7c62e82a|2ae8627c)  .*
881b8e
+ 100000d0 (3d220000|0000223d) (39298033|33802939) (3c820000|0000823c) (38a48008|0880a438)  .*
881b8e
+ 100000e0 (e8c50000|0000c5e8) (3fa00000|0000a03f) (3bbd8010|1080bd3b) (7c62e82a|2ae8627c)  .*
881b8e
 Contents of section \.got:
881b8e
- 100100f0 00000000 100180f0 00000000 10010124  .*
881b8e
- 10010100 00000000 10010125 00000000 10010120  .*
881b8e
- 10010110 00000000 10010121 00000000 10010122  .*
881b8e
+ 100100f0 (00000000|f0800110) (100180f0|00000000) (00000000|24010110) (10010124|00000000)  .*
881b8e
+ 10010100 (00000000|25010110) (10010125|00000000) (00000000|20010110) (10010120|00000000)  .*
881b8e
+ 10010110 (00000000|21010110) (10010121|00000000) (00000000|22010110) (10010122|00000000)  .*
881b8e
 Contents of section \.sdata:
881b8e
  10010120 01020304 0506                        .*
881b8e
diff --git a/ld/testsuite/ld-powerpc/tocopt2.d b/ld/testsuite/ld-powerpc/tocopt2.d
881b8e
index 174af27..a3e4aa7 100644
881b8e
--- a/ld/testsuite/ld-powerpc/tocopt2.d
881b8e
+++ b/ld/testsuite/ld-powerpc/tocopt2.d
881b8e
@@ -2,4 +2,4 @@
881b8e
 .*:     file format .*
881b8e
 
881b8e
 Contents of section \.text:
881b8e
- 100000b0 3d22effe 39297f4a .*
881b8e
+ 100000b0 (3d22effe|feef223d) (39297f4a|4a7f2939) .*
881b8e
diff --git a/ld/testsuite/ld-powerpc/tocopt3.d b/ld/testsuite/ld-powerpc/tocopt3.d
881b8e
index 174af27..a3e4aa7 100644
881b8e
--- a/ld/testsuite/ld-powerpc/tocopt3.d
881b8e
+++ b/ld/testsuite/ld-powerpc/tocopt3.d
881b8e
@@ -2,4 +2,4 @@
881b8e
 .*:     file format .*
881b8e
 
881b8e
 Contents of section \.text:
881b8e
- 100000b0 3d22effe 39297f4a .*
881b8e
+ 100000b0 (3d22effe|feef223d) (39297f4a|4a7f2939) .*
881b8e
diff --git a/ld/testsuite/ld-powerpc/tocopt4.d b/ld/testsuite/ld-powerpc/tocopt4.d
881b8e
index 4f450e4..1e0ccc5 100644
881b8e
--- a/ld/testsuite/ld-powerpc/tocopt4.d
881b8e
+++ b/ld/testsuite/ld-powerpc/tocopt4.d
881b8e
@@ -2,6 +2,6 @@
881b8e
 .*:     file format .*
881b8e
 
881b8e
 Contents of section \.text:
881b8e
- 100000b0 e9298000 .*
881b8e
+ 100000b0 (e9298000|008029e9) .*
881b8e
 Contents of section \.got:
881b8e
- 100100b8 00000000 00000002 .*
881b8e
+ 100100b8 (00000000|02000000) (00000002|00000000) .*
881b8e
diff --git a/ld/testsuite/ld-powerpc/tocopt5.d b/ld/testsuite/ld-powerpc/tocopt5.d
881b8e
index 8f03c07..758b7fc 100644
881b8e
--- a/ld/testsuite/ld-powerpc/tocopt5.d
881b8e
+++ b/ld/testsuite/ld-powerpc/tocopt5.d
881b8e
@@ -2,12 +2,12 @@
881b8e
 .*:     file format .*
881b8e
 
881b8e
 Contents of section \.text:
881b8e
- 100000b0 60000000 e9228018 60000000 38a28020  .*
881b8e
- 100000c0 e8c50000 60000000 3922802b 60000000  .*
881b8e
- 100000d0 38a28008 e8c50000                    .*
881b8e
+ 100000b0 (60000000|00000060) (e9228018|188022e9) (60000000|00000060) (38a28020|2080a238)  .*
881b8e
+ 100000c0 (e8c50000|0000c5e8) (60000000|00000060) (3922802b|2b802239) (60000000|00000060)  .*
881b8e
+ 100000d0 (38a28008|0880a238) (e8c50000|0000c5e8)                    .*
881b8e
 Contents of section \.got:
881b8e
- 100100d8 00000000 100180d8 00000000 10010104  .*
881b8e
- 100100e8 00000000 10010105 00000000 10010100  .*
881b8e
- 100100f8 00000000 10010101                    .*
881b8e
+ 100100d8 (00000000|d8800110) (100180d8|00000000) (00000000|04010110) (10010104|00000000)  .*
881b8e
+ 100100e8 (00000000|05010110) (10010105|00000000) (00000000|00010110) (10010100|00000000)  .*
881b8e
+ 100100f8 (00000000|01010110) (10010101|00000000)                    .*
881b8e
 Contents of section \.sdata:
881b8e
  10010100 01020304 0506                        .*