summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-04-11 22:13:28 +0000
committerJakub Jelinek <jakub@redhat.com>2005-04-11 22:13:28 +0000
commit96b399d565fbad7ff49bb51857cec63ba0683dfb (patch)
tree7db0263aedf241e04a6458c02bc3e08343e3f645
parent327c9969b571319298ebf7af1ce93de72ecb06d0 (diff)
downloadbinutils-redhat-96b399d565fbad7ff49bb51857cec63ba0683dfb.tar.gz
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. * ld-sparc/tlssunbin32.dd: Update for TLS relocation fixes. * ld-sparc/tlssunbin32.rd: Likewise. * ld-sparc/tlssunbin32.sd: Likewise. * ld-sparc/tlssunpic32.dd: Likewise.
-rw-r--r--bfd/ChangeLog10
-rw-r--r--bfd/elf32-sparc.c19
-rw-r--r--ld/testsuite/ChangeLog7
-rw-r--r--ld/testsuite/ld-sparc/tlssunbin32.dd4
-rw-r--r--ld/testsuite/ld-sparc/tlssunbin32.rd22
-rw-r--r--ld/testsuite/ld-sparc/tlssunbin32.sd4
-rw-r--r--ld/testsuite/ld-sparc/tlssunpic32.dd24
7 files changed, 57 insertions, 33 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index bc3b8dedda..7accdd9b0e 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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.
diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c
index 1669aaa874..74c16272a3 100644
--- a/bfd/elf32-sparc.c
+++ b/bfd/elf32-sparc.c
@@ -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;
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index b692cc189b..6ac830cbea 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2005-04-11 David S. Miller <davem@davemloft.net>
+
+ * ld-sparc/tlssunbin32.dd: Update for TLS relocation fixes.
+ * ld-sparc/tlssunbin32.rd: Likewise.
+ * ld-sparc/tlssunbin32.sd: Likewise.
+ * ld-sparc/tlssunpic32.dd: Likewise.
+
2005-03-30 Julian Brown <julian@codesourcery.com>
* ld-arm/arm-app-abs32.d: Update expected output due to mapping symbols
diff --git a/ld/testsuite/ld-sparc/tlssunbin32.dd b/ld/testsuite/ld-sparc/tlssunbin32.dd
index 7acf66dcca..37c1d04280 100644
--- a/ld/testsuite/ld-sparc/tlssunbin32.dd
+++ b/ld/testsuite/ld-sparc/tlssunbin32.dd
@@ -16,7 +16,7 @@ Disassembly of section .text:
+11008: 9d e3 bf 98 save %sp, -104, %sp
+1100c: 2f 00 00 48 sethi %hi\(0x12000\), %l7
+11010: 7f ff ff fc call 11000 <.*>
- +11014: ae 05 e2 68 add %l7, 0x268, %l7 ! 12268 <.*>
+ +11014: ae 05 e2 64 add %l7, 0x264, %l7 ! 12264 <.*>
+11018: 01 00 00 00 nop *
+1101c: 01 00 00 00 nop *
+11020: 01 00 00 00 nop *
@@ -172,7 +172,7 @@ Disassembly of section .text:
00012000 <_start>:
+12000: 9d e3 bf 98 save %sp, -104, %sp
+12004: 29 00 00 8c sethi %hi\(0x23000\), %l4
- +12008: a8 15 22 78 or %l4, 0x278, %l4 ! 23278 <.*>
+ +12008: a8 15 22 74 or %l4, 0x274, %l4 ! 23274 <.*>
+1200c: 01 00 00 00 nop *
+12010: 01 00 00 00 nop *
+12014: 01 00 00 00 nop *
diff --git a/ld/testsuite/ld-sparc/tlssunbin32.rd b/ld/testsuite/ld-sparc/tlssunbin32.rd
index 073bd16ae5..c2abc8f25d 100644
--- a/ld/testsuite/ld-sparc/tlssunbin32.rd
+++ b/ld/testsuite/ld-sparc/tlssunbin32.rd
@@ -17,8 +17,8 @@ Section Headers:
+\[ 6\] .text +PROGBITS +0+11000 0+1000 0+1194 00 +AX +0 +0 4096
+\[ 7\] .tdata +PROGBITS +0+22194 0+2194 0+1060 00 WAT +0 +0 +4
+\[ 8\] .tbss +NOBITS +0+231f4 0+31f4 0+40 00 WAT +0 +0 +4
- +\[ 9\] .dynamic +DYNAMIC +0+231f8 0+31f8 0+80 08 +WA +4 +0 +4
- +\[10\] .got +PROGBITS +0+23278 0+3278 0+14 04 +WA +0 +0 +4
+ +\[ 9\] .dynamic +DYNAMIC +0+231f4 0+31f4 0+80 08 +WA +4 +0 +4
+ +\[10\] .got +PROGBITS +0+23274 0+3274 0+14 04 +WA +0 +0 +4
+\[11\] .plt +.*
+\[12\] .shstrtab +.*
+\[13\] .symtab +.*
@@ -35,23 +35,23 @@ Program Headers:
+INTERP +0x0+f4 0x0+100f4 0x0+100f4 0x0+11 0x0+11 R +0x1
.*Requesting program interpreter.*
+LOAD +0x0+ 0x0+10000 0x0+10000 0x0+2194 0x0+2194 R E 0x10000
- +LOAD +0x0+2194 0x0+22194 0x0+22194 0x0+10f8 0x0+10f8 RWE 0x10000
- +DYNAMIC +0x0+31f8 0x0+231f8 0x0+231f8 0x0+80 0x0+80 RW +0x4
+ +LOAD +0x0+2194 0x0+22194 0x0+22194 0x0+10f4 0x0+10f4 RWE 0x10000
+ +DYNAMIC +0x0+31f4 0x0+231f4 0x0+231f4 0x0+80 0x0+80 RW +0x4
+TLS +0x0+2194 0x0+22194 0x0+22194 0x0+1060 0x0+10a0 R +0x4
#...
Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 4 entries:
Offset +Info +Type +Sym. Value +Symbol's Name \+ Addend
-0002327c +0000014e R_SPARC_TLS_TPOFF32 +00000000 +sG5 \+ 0
-00023280 +0000034e R_SPARC_TLS_TPOFF32 +00000000 +sG2 \+ 0
-00023284 +0000074e R_SPARC_TLS_TPOFF32 +00000000 +sG6 \+ 0
-00023288 +0000084e R_SPARC_TLS_TPOFF32 +00000000 +sG1 \+ 0
+00023278 +0000014e R_SPARC_TLS_TPOFF32 +00000000 +sG5 \+ 0
+0002327c +0000034e R_SPARC_TLS_TPOFF32 +00000000 +sG2 \+ 0
+00023280 +0000074e R_SPARC_TLS_TPOFF32 +00000000 +sG6 \+ 0
+00023284 +0000084e R_SPARC_TLS_TPOFF32 +00000000 +sG1 \+ 0
Symbol table '.dynsym' contains 11 entries:
+Num: +Value +Size Type +Bind +Vis +Ndx Name
+0: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND *
+1: 0+ +0 TLS +GLOBAL DEFAULT +UND sG5
- +2: 0+231f8 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC
+ +2: 0+231f4 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC
+3: 0+ +0 TLS +GLOBAL DEFAULT +UND sG2
+4: [0-9a-f]+ +0 OBJECT +GLOBAL DEFAULT +ABS _PROCEDURE_LINKAGE_TABLE_
+5: 0+ +0 FUNC +GLOBAL DEFAULT +UND __tls_get_addr
@@ -99,7 +99,7 @@ Symbol table '.symtab' contains 68 entries:
+[0-9]+: 0+1074 +0 TLS +GLOBAL DEFAULT +8 bg6
+[0-9]+: 0+ +0 TLS +GLOBAL DEFAULT +UND sG5
+[0-9]+: 0+1068 +0 TLS +GLOBAL DEFAULT +8 bg3
- +[0-9]+: 0+231f8 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC
+ +[0-9]+: 0+231f4 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC
+[0-9]+: 0+1008 +0 TLS +GLOBAL DEFAULT +7 sg3
+[0-9]+: 0+1048 +0 TLS +GLOBAL HIDDEN +7 sh3
+[0-9]+: 0+ +0 TLS +GLOBAL DEFAULT +UND sG2
@@ -124,7 +124,7 @@ Symbol table '.symtab' contains 68 entries:
+[0-9]+: 0+1014 +0 TLS +GLOBAL DEFAULT +7 sg6
+[0-9]+: 0+1018 +0 TLS +GLOBAL DEFAULT +7 sg7
+[0-9]+: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS _edata
- +[0-9]+: 0+23278 +0 OBJECT +GLOBAL +HIDDEN +10 _GLOBAL_OFFSET_TABLE_
+ +[0-9]+: 0+23274 +0 OBJECT +GLOBAL +HIDDEN +10 _GLOBAL_OFFSET_TABLE_
+[0-9]+: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS _end
+[0-9]+: 0+1044 +0 TLS +GLOBAL HIDDEN +7 sh2
+[0-9]+: 0+1054 +0 TLS +GLOBAL HIDDEN +7 sh6
diff --git a/ld/testsuite/ld-sparc/tlssunbin32.sd b/ld/testsuite/ld-sparc/tlssunbin32.sd
index 78a2ba96e6..7db88c9f84 100644
--- a/ld/testsuite/ld-sparc/tlssunbin32.sd
+++ b/ld/testsuite/ld-sparc/tlssunbin32.sd
@@ -7,5 +7,5 @@
.*: +file format elf32-sparc
Contents of section .got:
- 23278 000231f8 0+ 0+ 0+ .*
- 23288 0+ .*
+ 23274 000231f4 0+ 0+ 0+ .*
+ 23284 0+ .*
diff --git a/ld/testsuite/ld-sparc/tlssunpic32.dd b/ld/testsuite/ld-sparc/tlssunpic32.dd
index 75ad02ee5d..c34d514ac1 100644
--- a/ld/testsuite/ld-sparc/tlssunpic32.dd
+++ b/ld/testsuite/ld-sparc/tlssunpic32.dd
@@ -105,15 +105,15 @@ Disassembly of section .text:
+1168: 01 00 00 00 nop *
+116c: 40 00 44 02 call [0-9a-f]+ <__tls_get_addr@plt>
+1170: 01 00 00 00 nop *
- +1174: 27 3f ff ff sethi %hi\(0xfffffc00\), %l3
+ +1174: 27 00 00 00 sethi %hi\(0\), %l3
+1178: 01 00 00 00 nop *
- +117c: a8 1c fc 20 xor %l3, -992, %l4
+ +117c: a8 1c e0 20 xor %l3, 0x20, %l4
+1180: 01 00 00 00 nop *
+1184: aa 02 00 14 add %o0, %l4, %l5
+1188: 01 00 00 00 nop *
- +118c: 25 3f ff ff sethi %hi\(0xfffffc00\), %l2
+ +118c: 25 00 00 00 sethi %hi\(0\), %l2
+1190: 01 00 00 00 nop *
- +1194: a6 1c bc 26 xor %l2, -986, %l3
+ +1194: a6 1c a0 26 xor %l2, 0x26, %l3
+1198: 01 00 00 00 nop *
+119c: ec 12 00 13 lduh \[ %o0 \+ %l3 \], %l6
+11a0: 01 00 00 00 nop *
@@ -121,13 +121,13 @@ Disassembly of section .text:
+11a8: 01 00 00 00 nop *
+11ac: 01 00 00 00 nop *
+11b0: 13 00 00 00 sethi %hi\(0\), %o1
- +11b4: 27 3f ff ff sethi %hi\(0xfffffc00\), %l3
+ +11b4: 27 00 00 00 sethi %hi\(0\), %l3
+11b8: 94 02 60 14 add %o1, 0x14, %o2
- +11bc: 25 3f ff ff sethi %hi\(0xfffffc00\), %l2
+ +11bc: 25 00 00 00 sethi %hi\(0\), %l2
+11c0: 90 05 c0 0a add %l7, %o2, %o0
- +11c4: a8 1c fc 40 xor %l3, -960, %l4
+ +11c4: a8 1c e0 40 xor %l3, 0x40, %l4
+11c8: 40 00 43 eb call [0-9a-f]+ <__tls_get_addr@plt>
- +11cc: a6 1c bc 45 xor %l2, -955, %l3
+ +11cc: a6 1c a0 45 xor %l2, 0x45, %l3
+11d0: aa 02 00 14 add %o0, %l4, %l5
+11d4: ec 0a 00 13 ldub \[ %o0 \+ %l3 \], %l6
+11d8: 01 00 00 00 nop *
@@ -135,13 +135,13 @@ Disassembly of section .text:
+11e0: 01 00 00 00 nop *
+11e4: 01 00 00 00 nop *
+11e8: 13 00 00 00 sethi %hi\(0\), %o1
- +11ec: 27 3f ff ff sethi %hi\(0xfffffc00\), %l3
+ +11ec: 27 00 00 00 sethi %hi\(0\), %l3
+11f0: 94 02 60 14 add %o1, 0x14, %o2
- +11f4: 25 3f ff ff sethi %hi\(0xfffffc00\), %l2
+ +11f4: 25 00 00 00 sethi %hi\(0\), %l2
+11f8: 90 05 c0 0a add %l7, %o2, %o0
- +11fc: a8 1c fc 63 xor %l3, -925, %l4
+ +11fc: a8 1c e0 63 xor %l3, 0x63, %l4
+1200: 40 00 43 dd call [0-9a-f]+ <__tls_get_addr@plt>
- +1204: a6 1c bc 64 xor %l2, -924, %l3
+ +1204: a6 1c a0 64 xor %l2, 0x64, %l3
+1208: aa 02 00 14 add %o0, %l4, %l5
+120c: ec 02 00 13 ld \[ %o0 \+ %l3 \], %l6
+1210: 01 00 00 00 nop *