OSDN Git Service

2005-04-11 David S. Miller <davem@davemloft.net>
authorJakub Jelinek <jakub@redhat.com>
Mon, 11 Apr 2005 22:13:28 +0000 (22:13 +0000)
committerJakub Jelinek <jakub@redhat.com>
Mon, 11 Apr 2005 22:13:28 +0000 (22:13 +0000)
* elf32-sparc.c (elf32_sparc_relocate_section,
R_SPARC_TLS_LDO_{HIX22,LOX10}): When not shared, transition to
R_SPARC_TLS_LE_{HIX22,LOX10}.
(elf32_sparc_relocate_section, R_SPARC_TLS_{LDO,LE}_HIX22): Only
xor relocation with 0xffffffff if R_SPARC_TLS_LE_HIX22.
(elf32_sparc_relocate_section, R_SPARC_TLS_{LDO,LE}_LOX10): Only
or 0x1c00 into relocation if R_SPARC_TLS_LE_HIX22.

* ld-sparc/tlssunbin32.dd: Update for TLS relocation fixes.
* ld-sparc/tlssunbin32.rd: Likewise.
* ld-sparc/tlssunbin32.sd: Likewise.
* ld-sparc/tlssunpic32.dd: Likewise.

bfd/ChangeLog
bfd/elf32-sparc.c

index bc3b8de..7accdd9 100644 (file)
@@ -1,3 +1,13 @@
+2005-04-11  David S. Miller  <davem@davemloft.net>
+
+       * elf32-sparc.c (elf32_sparc_relocate_section,
+       R_SPARC_TLS_LDO_{HIX22,LOX10}): When not shared, transition to
+       R_SPARC_TLS_LE_{HIX22,LOX10}.
+       (elf32_sparc_relocate_section, R_SPARC_TLS_{LDO,LE}_HIX22): Only
+       xor relocation with 0xffffffff if R_SPARC_TLS_LE_HIX22.
+       (elf32_sparc_relocate_section, R_SPARC_TLS_{LDO,LE}_LOX10): Only
+       or 0x1c00 into relocation if R_SPARC_TLS_LE_HIX22.
+
 2005-04-11  H.J. Lu  <hongjiu.lu@intel.com>
 
        * coffcode.h (STRING_SIZE_SIZE): Updated to match libcoff-in.h.
index 1669aaa..74c1627 100644 (file)
@@ -2678,10 +2678,14 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
        case R_SPARC_TLS_LDO_HIX22:
        case R_SPARC_TLS_LDO_LOX10:
          if (info->shared)
-           relocation -= dtpoff_base (info);
-         else
-           relocation = tpoff (info, relocation);
-         break;
+           {
+             relocation -= dtpoff_base (info);
+             break;
+           }
+
+         r_type = (r_type == R_SPARC_TLS_LDO_HIX22
+                   ? R_SPARC_TLS_LE_HIX22 : R_SPARC_TLS_LE_LOX10);
+         /* Fall through.  */
 
        case R_SPARC_TLS_LE_HIX22:
        case R_SPARC_TLS_LE_LOX10:
@@ -2900,7 +2904,8 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
          bfd_vma x;
 
          relocation += rel->r_addend;
-         relocation = relocation ^ 0xffffffff;
+         if (r_type == R_SPARC_TLS_LE_HIX22)
+           relocation = relocation ^ 0xffffffff;
 
          x = bfd_get_32 (input_bfd, contents + rel->r_offset);
          x = (x & ~(bfd_vma) 0x3fffff) | ((relocation >> 10) & 0x3fffff);
@@ -2913,7 +2918,9 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
          bfd_vma x;
 
          relocation += rel->r_addend;
-         relocation = (relocation & 0x3ff) | 0x1c00;
+         relocation &= 0x3ff;
+         if (r_type == R_SPARC_TLS_LE_LOX10)
+           relocation |= 0x1c00;
 
          x = bfd_get_32 (input_bfd, contents + rel->r_offset);
          x = (x & ~(bfd_vma) 0x1fff) | relocation;