Module Name:    src
Committed By:   skrll
Date:           Mon Dec 12 07:40:56 UTC 2011

Modified Files:
        src/external/gpl3/binutils/dist/bfd: ChangeLog elf32-hppa.c

Log Message:
Revert last change to elf32-hppa.c and pull across the fix to my binutils
PR 13476.

tests/lib/libc/tls on hppa still passes with this change.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/binutils/dist/bfd/ChangeLog
cvs rdiff -u -r1.4 -r1.5 src/external/gpl3/binutils/dist/bfd/elf32-hppa.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/binutils/dist/bfd/ChangeLog
diff -u src/external/gpl3/binutils/dist/bfd/ChangeLog:1.3 src/external/gpl3/binutils/dist/bfd/ChangeLog:1.4
--- src/external/gpl3/binutils/dist/bfd/ChangeLog:1.3	Sun Sep 25 04:32:34 2011
+++ src/external/gpl3/binutils/dist/bfd/ChangeLog	Mon Dec 12 07:40:56 2011
@@ -1,3 +1,13 @@
+2011-12-11  John Davis Anglin  <dave.ang...@nrc-cnrc.gc.ca>
+
+	PR binutils/13476
+	* elf32-hppa.c (final_link_relocate): Convert R_PARISC_TLS_GD21L,
+	R_PARISC_TLS_LDM21L and R_PARISC_TLS_IE21L relocations to
+	R_PARISC_DPREL21L when not doing a shared link.  Likewise convert
+	R_PARISC_TLS_GD14R, R_PARISC_TLS_LDM14R and R_PARISC_TLS_IE14R to
+	R_PARISC_DPREL14R.  Handle R_PARISC_TLS_GD21L, R_PARISC_TLS_LDM21L
+	and R_PARISC_TLS_IE21L with R_PARISC_DLTIND21L.
+
 2011-06-27  Tristan Gingold  <ging...@adacore.com>
 
 	* configure.in: Bump version to 2.21.1

Index: src/external/gpl3/binutils/dist/bfd/elf32-hppa.c
diff -u src/external/gpl3/binutils/dist/bfd/elf32-hppa.c:1.4 src/external/gpl3/binutils/dist/bfd/elf32-hppa.c:1.5
--- src/external/gpl3/binutils/dist/bfd/elf32-hppa.c:1.4	Fri Dec  2 09:40:18 2011
+++ src/external/gpl3/binutils/dist/bfd/elf32-hppa.c	Mon Dec 12 07:40:56 2011
@@ -3356,10 +3356,16 @@ final_link_relocate (asection *input_sec
       switch (r_type)
 	{
 	  case R_PARISC_DLTIND21L:
+	  case R_PARISC_TLS_GD21L:
+	  case R_PARISC_TLS_LDM21L:
+	  case R_PARISC_TLS_IE21L:
 	    r_type = R_PARISC_DPREL21L;
 	    break;
 
 	  case R_PARISC_DLTIND14R:
+	  case R_PARISC_TLS_GD14R:
+	  case R_PARISC_TLS_LDM14R:
+	  case R_PARISC_TLS_IE14R:
 	    r_type = R_PARISC_DPREL14R;
 	    break;
 
@@ -3430,41 +3436,43 @@ final_link_relocate (asection *input_sec
 	 most efficient way of using PIC code in an incomplete executable,
 	 but the user must follow the standard runtime conventions for
 	 accessing data for this to work.  */
-      if (orig_r_type == R_PARISC_DLTIND21L)
+      if (orig_r_type != r_type)
 	{
-	  /* Convert addil instructions if the original reloc was a
-	     DLTIND21L.  GCC sometimes uses a register other than r19 for
-	     the operation, so we must convert any addil instruction
-	     that uses this relocation.  */
-	  if ((insn & 0xfc000000) == ((int) OP_ADDIL << 26))
-	    insn = ADDIL_DP;
-	  else
-	    /* We must have a ldil instruction.  It's too hard to find
-	       and convert the associated add instruction, so issue an
-	       error.  */
-	    (*_bfd_error_handler)
-	      (_("%B(%A+0x%lx): %s fixup for insn 0x%x is not supported in a non-shared link"),
-	       input_bfd,
-	       input_section,
-	       (long) offset,
-	       howto->name,
-	       insn);
-	}
-      else if (orig_r_type == R_PARISC_DLTIND14F)
-	{
-	  /* This must be a format 1 load/store.  Change the base
-	     register to dp.  */
-	  insn = (insn & 0xfc1ffff) | (27 << 21);
-	}
-
-    /* For all the DP relative relocations, we need to examine the symbol's
-       section.  If it has no section or if it's a code section, then
-       "data pointer relative" makes no sense.  In that case we don't
-       adjust the "value", and for 21 bit addil instructions, we change the
-       source addend register from %dp to %r0.  This situation commonly
-       arises for undefined weak symbols and when a variable's "constness"
-       is declared differently from the way the variable is defined.  For
-       instance: "extern int foo" with foo defined as "const int foo".  */
+	  if (r_type == R_PARISC_DPREL21L)
+	    {
+	      /* GCC sometimes uses a register other than r19 for the
+		 operation, so we must convert any addil instruction
+		 that uses this relocation.  */
+	      if ((insn & 0xfc000000) == ((int) OP_ADDIL << 26))
+		insn = ADDIL_DP;
+	      else
+		/* We must have a ldil instruction.  It's too hard to find
+		   and convert the associated add instruction, so issue an
+		   error.  */
+		(*_bfd_error_handler)
+		  (_("%B(%A+0x%lx): %s fixup for insn 0x%x is not supported in a non-shared link"),
+		   input_bfd,
+		   input_section,
+		   (long) offset,
+		   howto->name,
+		   insn);
+	    }
+	  else if (r_type == R_PARISC_DPREL14F)
+	    {
+	      /* This must be a format 1 load/store.  Change the base
+		 register to dp.  */
+	      insn = (insn & 0xfc1ffff) | (27 << 21);
+	    }
+	}
+
+      /* For all the DP relative relocations, we need to examine the symbol's
+	 section.  If it has no section or if it's a code section, then
+	 "data pointer relative" makes no sense.  In that case we don't
+	 adjust the "value", and for 21 bit addil instructions, we change the
+	 source addend register from %dp to %r0.  This situation commonly
+	 arises for undefined weak symbols and when a variable's "constness"
+	 is declared differently from the way the variable is defined.  For
+	 instance: "extern int foo" with foo defined as "const int foo".  */
       if (sym_sec == NULL || (sym_sec->flags & SEC_CODE) != 0)
 	{
 	  if ((insn & ((0x3f << 26) | (0x1f << 21)))
@@ -3482,10 +3490,10 @@ final_link_relocate (asection *input_sec
     case R_PARISC_DLTIND14R:
     case R_PARISC_DLTIND14F:
     case R_PARISC_TLS_GD21L:
-    case R_PARISC_TLS_GD14R:
     case R_PARISC_TLS_LDM21L:
-    case R_PARISC_TLS_LDM14R:
     case R_PARISC_TLS_IE21L:
+    case R_PARISC_TLS_GD14R:
+    case R_PARISC_TLS_LDM14R:
     case R_PARISC_TLS_IE14R:
       value -= elf_gp (input_section->output_section->owner);
       break;

Reply via email to