aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ld/testsuite/ChangeLog17
-rw-r--r--ld/testsuite/ld-powerpc/powerpc.exp16
-rw-r--r--ld/testsuite/ld-powerpc/tls32.d50
-rw-r--r--ld/testsuite/ld-powerpc/tls32.g11
-rw-r--r--ld/testsuite/ld-powerpc/tls32.s80
-rw-r--r--ld/testsuite/ld-powerpc/tls32.t12
-rw-r--r--ld/testsuite/ld-powerpc/tlsexe32.d45
-rw-r--r--ld/testsuite/ld-powerpc/tlsexe32.g11
-rw-r--r--ld/testsuite/ld-powerpc/tlsexe32.r128
-rw-r--r--ld/testsuite/ld-powerpc/tlsexe32.t11
-rw-r--r--ld/testsuite/ld-powerpc/tlslib32.s14
-rw-r--r--ld/testsuite/ld-powerpc/tlsso32.d45
-rw-r--r--ld/testsuite/ld-powerpc/tlsso32.g13
-rw-r--r--ld/testsuite/ld-powerpc/tlsso32.r162
-rw-r--r--ld/testsuite/ld-powerpc/tlsso32.t11
15 files changed, 625 insertions, 1 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index e879b083..b5117c7 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,5 +1,22 @@
2003-02-18 Alan Modra <amodra@bigpond.net.au>
+ * ld-powerpc/tls32.s: New file.
+ * ld-powerpc/tlslib32.s: New file.
+ * ld-powerpc/tls32.d: New file.
+ * ld-powerpc/tls32.g: New file.
+ * ld-powerpc/tls32.t: New file.
+ * ld-powerpc/tlsexe32.d: New file.
+ * ld-powerpc/tlsexe32.g: New file.
+ * ld-powerpc/tlsexe32.r: New file.
+ * ld-powerpc/tlsexe32.t: New file.
+ * ld-powerpc/tlsso32.d: New file.
+ * ld-powerpc/tlsso32.g: New file.
+ * ld-powerpc/tlsso32.r: New file.
+ * ld-powerpc/tlsso32.t: New file.
+ * ld-powerpc/powerpc.exp: Run new tests.
+
+2003-02-18 Alan Modra <amodra@bigpond.net.au>
+
* ld-powerpc/tlsexe.g: Update for 2003-02-14 elf64-ppc.c change.
2003-02-10 Jakub Jelinek <jakub@redhat.com>
diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
index 01fca29..63b8365 100644
--- a/ld/testsuite/ld-powerpc/powerpc.exp
+++ b/ld/testsuite/ld-powerpc/powerpc.exp
@@ -54,7 +54,21 @@ set ppcelftests {
{{objdump -hw reloc.d}} "reloc.so"}
{"APUinfo section processing" "-melf32ppc"
"-a32 -me500" {apuinfo1.s apuinfo2.s}
- {{readelf -x5 apuinfo.rd}} "apuinfo"}
+ {{readelf -x5 apuinfo.rd}} "apuinfo"}
+ {"TLS32 static exec" "-melf32ppc" "-a32" {tls32.s tlslib32.s}
+ {{objdump -dr tls32.d} {objdump -sj.got tls32.g}
+ {objdump -sj.tdata tls32.t}}
+ "tls32"}
+ {"TLS32 helper shared library" "-shared -melf32ppc tmpdir/tlslib32.o" "" {}
+ {} "libtlslib32.so"}
+ {"TLS32 dynamic exec" "-melf32ppc tmpdir/tls32.o tmpdir/libtlslib32.so" "" {}
+ {{readelf -WSsrl tlsexe32.r} {objdump -dr tlsexe32.d}
+ {objdump -sj.got tlsexe32.g} {objdump -sj.tdata tlsexe32.t}}
+ "tlsexe32"}
+ {"TLS32 shared" "-shared -melf32ppc tmpdir/tls32.o" "" {}
+ {{readelf -WSsrl tlsso32.r} {objdump -dr tlsso32.d}
+ {objdump -sj.got tlsso32.g} {objdump -sj.tdata tlsso32.t}}
+ "tls32.so"}
}
set ppc64elftests {
diff --git a/ld/testsuite/ld-powerpc/tls32.d b/ld/testsuite/ld-powerpc/tls32.d
new file mode 100644
index 0000000..b2e384d
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tls32.d
@@ -0,0 +1,50 @@
+#source: tls32.s
+#source: tlslib32.s
+#as: -a32
+#ld: -melf32ppc
+#objdump: -dr
+#target: powerpc*-*-*
+
+.*: +file format elf32-powerpc
+
+Disassembly of section \.text:
+
+0+1800094 <_start>:
+ 1800094: 3c 62 00 00 addis r3,r2,0
+ 1800098: 38 63 90 3c addi r3,r3,-28612
+ 180009c: 3c 62 00 00 addis r3,r2,0
+ 18000a0: 38 63 10 00 addi r3,r3,4096
+ 18000a4: 3c 62 00 00 addis r3,r2,0
+ 18000a8: 38 63 90 20 addi r3,r3,-28640
+ 18000ac: 3c 62 00 00 addis r3,r2,0
+ 18000b0: 38 63 10 00 addi r3,r3,4096
+ 18000b4: 39 23 80 24 addi r9,r3,-32732
+ 18000b8: 3d 23 00 00 addis r9,r3,0
+ 18000bc: 81 49 80 28 lwz r10,-32728\(r9\)
+ 18000c0: 3d 22 00 00 addis r9,r2,0
+ 18000c4: a1 49 90 30 lhz r10,-28624\(r9\)
+ 18000c8: 89 42 90 34 lbz r10,-28620\(r2\)
+ 18000cc: 3d 22 00 00 addis r9,r2,0
+ 18000d0: 99 49 90 38 stb r10,-28616\(r9\)
+ 18000d4: 3c 62 00 00 addis r3,r2,0
+ 18000d8: 38 63 90 00 addi r3,r3,-28672
+ 18000dc: 3c 62 00 00 addis r3,r2,0
+ 18000e0: 38 63 10 00 addi r3,r3,4096
+ 18000e4: 91 43 80 04 stw r10,-32764\(r3\)
+ 18000e8: 3d 23 00 00 addis r9,r3,0
+ 18000ec: 91 49 80 08 stw r10,-32760\(r9\)
+ 18000f0: 3d 22 00 00 addis r9,r2,0
+ 18000f4: b1 49 90 30 sth r10,-28624\(r9\)
+ 18000f8: a1 42 90 14 lhz r10,-28652\(r2\)
+ 18000fc: 3d 22 00 00 addis r9,r2,0
+ 1800100: a9 49 90 18 lha r10,-28648\(r9\)
+
+0+1800104 <__tls_get_addr>:
+ 1800104: 4e 80 00 20 blr
+Disassembly of section \.got:
+
+0+1810128 <_GLOBAL_OFFSET_TABLE_-0x4>:
+ 1810128: 4e 80 00 21 blrl
+
+0+181012c <_GLOBAL_OFFSET_TABLE_>:
+ \.\.\.
diff --git a/ld/testsuite/ld-powerpc/tls32.g b/ld/testsuite/ld-powerpc/tls32.g
new file mode 100644
index 0000000..e8c72cc
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tls32.g
@@ -0,0 +1,11 @@
+#source: tls32.s
+#source: tlslib32.s
+#as: -a32
+#ld: -melf32ppc
+#objdump: -sj.got
+#target: powerpc*-*-*
+
+.*: +file format elf32-powerpc
+
+Contents of section \.got:
+ 1810128 4e800021 00000000 00000000 00000000 .*
diff --git a/ld/testsuite/ld-powerpc/tls32.s b/ld/testsuite/ld-powerpc/tls32.s
new file mode 100644
index 0000000..b8d0e3d
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tls32.s
@@ -0,0 +1,80 @@
+ .section ".tbss","awT",@nobits
+ .global _start,gd0,ld0,ld1,ld2,ie0,le0,le1
+ .align 2
+gd0: .space 4
+ld0: .space 4
+ld1: .space 4
+ld2: .space 4
+ie0: .space 4
+le0: .space 4
+le1: .space 4
+
+ .section ".tdata","awT",@progbits
+ .align 2
+gd4: .long 0x12345678
+ld4: .long 0x23456789
+ld5: .long 0x3456789a
+ld6: .long 0x456789ab
+ie4: .long 0x56789abc
+le4: .long 0x6789abcd
+le5: .long 0x789abcde
+
+ .text
+_start:
+#extern syms
+#GD
+ addi 3,31,gd@got@tlsgd #R_PPC_GOT_TLSGD16 gd
+ bl __tls_get_addr #R_PPC_REL24 __tls_get_addr
+
+#LD
+ addi 3,31,ld@got@tlsld #R_PPC_GOT_TLSLD16 ld
+ bl __tls_get_addr #R_PPC_REL24 __tls_get_addr
+
+#global syms
+#GD
+ addi 3,31,gd0@got@tlsgd #R_PPC_GOT_TLSGD16 gd0
+ bl __tls_get_addr@plt #R_PPC_PLTREL24 __tls_get_addr
+
+#LD
+ addi 3,31,ld0@got@tlsld #R_PPC_GOT_TLSLD16 ld0
+ bl __tls_get_addr@plt #R_PPC_PLTREL24 __tls_get_addr
+
+ addi 9,3,ld0@dtprel #R_PPC_DTPREL16 ld0
+
+ addis 9,3,ld1@dtprel@ha #R_PPC_DTPREL16_HA ld1
+ lwz 10,ld1@dtprel@l(9) #R_PPC_DTPREL16_LO ld1
+
+#IE
+ lwz 9,ie0@got@tprel(31) #R_PPC_GOT_TPREL16 ie0
+ lhzx 10,9,ie0@tls #R_PPC_TLS ie0
+
+#LE
+ lbz 10,le0@tprel(2) #R_PPC_TPREL16 le0
+
+ addis 9,2,le1@tprel@ha #R_PPC_TPREL16_HA le1
+ stb 10,le1@tprel@l(9) #R_PPC_TPREL16_LO le1
+
+#local syms, use a different got reg too.
+#GD
+ addi 3,30,gd4@got@tlsgd #R_PPC_GOT_TLSGD16 gd4
+ bl __tls_get_addr #R_PPC_REL24 __tls_get_addr
+
+#LD
+ addi 3,30,ld4@got@tlsld #R_PPC_GOT_TLSLD16 ld4
+ bl __tls_get_addr #R_PPC_REL24 __tls_get_addr
+
+ stw 10,ld4@dtprel(3) #R_PPC_DTPREL16 ld4
+
+ addis 9,3,ld5@dtprel@ha #R_PPC_DTPREL16_HA ld5
+ stw 10,ld5@dtprel@l(9) #R_PPC_DTPREL16_LO ld5
+
+#IE
+ lwz 9,ie0@got@tprel(30) #R_PPC_GOT_TPREL16 ie4
+ sthx 10,9,ie0@tls #R_PPC_TLS ie4
+
+#LE
+ lhz 10,le4@tprel(2) #R_PPC_TPREL16 le4
+
+ addis 9,2,le5@tprel@ha #R_PPC_TPREL16_HA le5
+ lha 10,le5@tprel@l(9) #R_PPC_TPREL16_LO le5
+
diff --git a/ld/testsuite/ld-powerpc/tls32.t b/ld/testsuite/ld-powerpc/tls32.t
new file mode 100644
index 0000000..8149a28
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tls32.t
@@ -0,0 +1,12 @@
+#source: tls32.s
+#source: tlslib32.s
+#as: -a32
+#ld: -melf32ppc
+#objdump: -sj.tdata
+#target: powerpc*-*-*
+
+.*: +file format elf32-powerpc
+
+Contents of section \.tdata:
+ 1810108 12345678 23456789 3456789a 456789ab .*
+ 1810118 56789abc 6789abcd 789abcde 00c0ffee .*
diff --git a/ld/testsuite/ld-powerpc/tlsexe32.d b/ld/testsuite/ld-powerpc/tlsexe32.d
new file mode 100644
index 0000000..6c07ffa
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tlsexe32.d
@@ -0,0 +1,45 @@
+#source: tls32.s
+#as: -a32
+#ld: -melf32ppc tmpdir/libtlslib32.so
+#objdump: -dr
+#target: powerpc*-*-*
+
+.*: +file format elf32-powerpc
+
+Disassembly of section \.text:
+
+0180028c <_start>:
+ 180028c: 80 7f 00 0c lwz r3,12\(r31\)
+ 1800290: 7c 63 12 14 add r3,r3,r2
+ 1800294: 38 7f 00 10 addi r3,r31,16
+ 1800298: 48 01 01 85 bl 181041c <__bss_start\+0x48>
+ 180029c: 3c 62 00 00 addis r3,r2,0
+ 18002a0: 38 63 90 1c addi r3,r3,-28644
+ 18002a4: 3c 62 00 00 addis r3,r2,0
+ 18002a8: 38 63 10 00 addi r3,r3,4096
+ 18002ac: 39 23 80 20 addi r9,r3,-32736
+ 18002b0: 3d 23 00 00 addis r9,r3,0
+ 18002b4: 81 49 80 24 lwz r10,-32732\(r9\)
+ 18002b8: 3d 22 00 00 addis r9,r2,0
+ 18002bc: a1 49 90 2c lhz r10,-28628\(r9\)
+ 18002c0: 89 42 90 30 lbz r10,-28624\(r2\)
+ 18002c4: 3d 22 00 00 addis r9,r2,0
+ 18002c8: 99 49 90 34 stb r10,-28620\(r9\)
+ 18002cc: 3c 62 00 00 addis r3,r2,0
+ 18002d0: 38 63 90 00 addi r3,r3,-28672
+ 18002d4: 3c 62 00 00 addis r3,r2,0
+ 18002d8: 38 63 10 00 addi r3,r3,4096
+ 18002dc: 91 43 80 04 stw r10,-32764\(r3\)
+ 18002e0: 3d 23 00 00 addis r9,r3,0
+ 18002e4: 91 49 80 08 stw r10,-32760\(r9\)
+ 18002e8: 3d 22 00 00 addis r9,r2,0
+ 18002ec: b1 49 90 2c sth r10,-28628\(r9\)
+ 18002f0: a1 42 90 14 lhz r10,-28652\(r2\)
+ 18002f4: 3d 22 00 00 addis r9,r2,0
+ 18002f8: a9 49 90 18 lha r10,-28648\(r9\)
+Disassembly of section \.got:
+
+018103b8 <\.got>:
+ 18103b8: 4e 80 00 21 blrl
+ 18103bc: 01 81 03 18 \.long 0x1810318
+ \.\.\.
diff --git a/ld/testsuite/ld-powerpc/tlsexe32.g b/ld/testsuite/ld-powerpc/tlsexe32.g
new file mode 100644
index 0000000..c7ffff3
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tlsexe32.g
@@ -0,0 +1,11 @@
+#source: tls32.s
+#as: -a32
+#ld: -melf32ppc tmpdir/libtlslib32.so
+#objdump: -sj.got
+#target: powerpc*-*-*
+
+.*: +file format elf32-powerpc
+
+Contents of section \.got:
+ 18103b8 4e800021 01810318 00000000 00000000 .*
+ 18103c8 00000000 00000000 00000000 .*
diff --git a/ld/testsuite/ld-powerpc/tlsexe32.r b/ld/testsuite/ld-powerpc/tlsexe32.r
new file mode 100644
index 0000000..d6ae3e7
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tlsexe32.r
@@ -0,0 +1,128 @@
+#source: tls32.s
+#source: tlslib32.s
+#as: -a32
+#ld: -melf32ppc
+#readelf: -WSsrl
+#target: powerpc*-*-*
+
+There are 21 section headers.*
+
+Section Headers:
+ +\[Nr\] Name +Type +Addr +Off +Size +ES Flg Lk Inf Al
+ +\[ 0\] +NULL +00000000 000000 000000 00 +0 +0 +0
+ +\[ 1\] \.interp +PROGBITS +01800114 000114 000011 00 +A +0 +0 +1
+ +\[ 2\] \.hash +HASH +01800128 000128 00003c 04 +A +3 +0 +4
+ +\[ 3\] \.dynsym +DYNSYM +01800164 000164 0000a0 10 +A +4 +1 +4
+ +\[ 4\] \.dynstr +STRTAB +01800204 000204 000064 00 +A +0 +0 +1
+ +\[ 5\] \.rela\.dyn +RELA +01800268 000268 000018 0c +A +3 +0 +4
+ +\[ 6\] \.rela\.plt +RELA +01800280 000280 00000c 0c +A +3 +10 +4
+ +\[ 7\] \.text +PROGBITS +0180028c 00028c 000070 00 +AX +0 +0 +1
+ +\[ 8\] \.sdata2 +PROGBITS +018002fc 0002fc 000000 00 +A +0 +0 +4
+ +\[ 9\] \.data +PROGBITS +018102fc 0002fc 000000 00 +WA +0 +0 +1
+ +\[10\] \.tdata +PROGBITS +018102fc 0002fc 00001c 00 WAT +0 +0 +4
+ +\[11\] \.tbss +NOBITS +01810318 000318 00001c 00 WAT +0 +0 +4
+ +\[12\] \.dynamic +DYNAMIC +01810318 000318 0000a0 08 +WA +4 +0 +4
+ +\[13\] \.got +PROGBITS +018103b8 0003b8 00001c 04 WAX +0 +0 +4
+ +\[14\] \.sdata +PROGBITS +018103d4 0003d4 000000 00 +WA +0 +0 +4
+ +\[15\] \.sbss +NOBITS +018103d4 0003d4 000000 00 +WA +0 +0 +1
+ +\[16\] \.plt +NOBITS +018103d4 0003d4 000054 00 WAX +0 +0 +4
+ +\[17\] \.bss +NOBITS +01810428 0003d4 000000 00 +WA +0 +0 +1
+ +\[18\] \.shstrtab +STRTAB +00000000 0003d4 00008e 00 +0 +0 +1
+ +\[19\] \.symtab +SYMTAB +00000000 0007ac 0002f0 10 +20 +1c +4
+ +\[20\] \.strtab +STRTAB +00000000 000a9c 0000a9 00 +0 +0 +1
+#...
+
+Elf file type is EXEC \(Executable file\)
+Entry point 0x180028c
+There are 6 program headers, starting at offset 52
+
+Program Headers:
+ +Type +Offset +VirtAddr +PhysAddr +FileSiz MemSiz +Flg Align
+ +PHDR +0x000034 0x01800034 0x01800034 0x000e0 0x000e0 R E 0x4
+ +INTERP +0x000114 0x01800114 0x01800114 0x00011 0x00011 R +0x1
+ +\[Requesting program interpreter: .*\]
+ +LOAD +0x000000 0x01800000 0x01800000 0x002fc 0x002fc R E 0x10000
+ +LOAD +0x0002fc 0x018102fc 0x018102fc 0x000d8 0x0012c RWE 0x10000
+ +DYNAMIC +0x000318 0x01810318 0x01810318 0x000a0 0x000a0 RW +0x4
+ +TLS +0x0002fc 0x018102fc 0x018102fc 0x0001c 0x00038 R +0x4
+
+ Section to Segment mapping:
+ +Segment Sections\.\.\.
+ +00 +
+ +01 +\.interp
+ +02 +\.interp \.hash \.dynsym \.dynstr \.rela\.dyn \.rela\.plt \.text
+ +03 +\.tdata \.tbss \.dynamic \.got \.plt
+ +04 +\.tbss \.dynamic
+ +05 +\.tdata \.tbss
+
+Relocation section '\.rela\.dyn' at offset 0x268 contains 2 entries:
+ Offset +Info +Type +Sym\. Value +Symbol's Name \+ Addend
+018103c8 +00000249 R_PPC_TPREL32 +00000000 +gd \+ 0
+018103cc +00000444 R_PPC_DTPMOD32 +00000000 +ld \+ 0
+
+Relocation section '\.rela\.plt' at offset 0x280 contains 1 entries:
+ Offset +Info +Type +Sym\. Value +Symbol's Name \+ Addend
+0181041c +00000315 R_PPC_JMP_SLOT +0181041c +__tls_get_addr \+ 0
+
+Symbol table '\.dynsym' contains 10 entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+ +0: 00000000 +0 NOTYPE +LOCAL +DEFAULT +UND
+ +1: 01810318 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC
+ +2: 00000000 +0 TLS +GLOBAL DEFAULT +UND gd
+ +3: 0181041c +0 FUNC +GLOBAL DEFAULT +UND __tls_get_addr
+ +4: 00000000 +0 TLS +GLOBAL DEFAULT +UND ld
+ +5: 01810428 +0 NOTYPE +GLOBAL DEFAULT +ABS __end
+ +6: 018103d4 +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+ +7: 018103d4 +0 NOTYPE +GLOBAL DEFAULT +ABS _edata
+ +8: 018103bc +0 OBJECT +GLOBAL DEFAULT +ABS _GLOBAL_OFFSET_TABLE_
+ +9: 01810428 +0 NOTYPE +GLOBAL DEFAULT +ABS _end
+
+Symbol table '\.symtab' contains 47 entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+ +0: 00000000 +0 NOTYPE +LOCAL +DEFAULT +UND
+ +1: 01800114 +0 SECTION LOCAL +DEFAULT +1
+ +2: 01800128 +0 SECTION LOCAL +DEFAULT +2
+ +3: 01800164 +0 SECTION LOCAL +DEFAULT +3
+ +4: 01800204 +0 SECTION LOCAL +DEFAULT +4
+ +5: 01800268 +0 SECTION LOCAL +DEFAULT +5
+ +6: 01800280 +0 SECTION LOCAL +DEFAULT +6
+ +7: 0180028c +0 SECTION LOCAL +DEFAULT +7
+ +8: 018002fc +0 SECTION LOCAL +DEFAULT +8
+ +9: 018102fc +0 SECTION LOCAL +DEFAULT +9
+ +10: 018102fc +0 SECTION LOCAL +DEFAULT +10
+ +11: 01810318 +0 SECTION LOCAL +DEFAULT +11
+ +12: 01810318 +0 SECTION LOCAL +DEFAULT +12
+ +13: 018103b8 +0 SECTION LOCAL +DEFAULT +13
+ +14: 018103d4 +0 SECTION LOCAL +DEFAULT +14
+ +15: 018103d4 +0 SECTION LOCAL +DEFAULT +15
+ +16: 018103d4 +0 SECTION LOCAL +DEFAULT +16
+ +17: 01810428 +0 SECTION LOCAL +DEFAULT +17
+ +18: 00000000 +0 SECTION LOCAL +DEFAULT +18
+ +19: 00000000 +0 SECTION LOCAL +DEFAULT +19
+ +20: 00000000 +0 SECTION LOCAL +DEFAULT +20
+ +21: 00000000 +0 TLS +LOCAL +DEFAULT +10 gd4
+ +22: 00000004 +0 TLS +LOCAL +DEFAULT +10 ld4
+ +23: 00000008 +0 TLS +LOCAL +DEFAULT +10 ld5
+ +24: 0000000c +0 TLS +LOCAL +DEFAULT +10 ld6
+ +25: 00000010 +0 TLS +LOCAL +DEFAULT +10 ie4
+ +26: 00000014 +0 TLS +LOCAL +DEFAULT +10 le4
+ +27: 00000018 +0 TLS +LOCAL +DEFAULT +10 le5
+ +28: 01810318 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC
+ +29: 00000000 +0 TLS +GLOBAL DEFAULT +UND gd
+ +30: 00000030 +0 TLS +GLOBAL DEFAULT +11 le0
+ +31: 0181041c +0 FUNC +GLOBAL DEFAULT +UND __tls_get_addr
+ +32: 00000020 +0 TLS +GLOBAL DEFAULT +11 ld0
+ +33: 00000034 +0 TLS +GLOBAL DEFAULT +11 le1
+ +34: 00000000 +0 TLS +GLOBAL DEFAULT +UND ld
+ +35: 0180028c +0 NOTYPE +GLOBAL DEFAULT +7 _start
+ +36: 01810428 +0 NOTYPE +GLOBAL DEFAULT +ABS __end
+ +37: 018183d4 +0 OBJECT +GLOBAL DEFAULT +14 _SDA_BASE_
+ +38: 00000028 +0 TLS +GLOBAL DEFAULT +11 ld2
+ +39: 00000024 +0 TLS +GLOBAL DEFAULT +11 ld1
+ +40: 018103d4 +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+ +41: 018103d4 +0 NOTYPE +GLOBAL DEFAULT +ABS _edata
+ +42: 018103bc +0 OBJECT +GLOBAL DEFAULT +ABS _GLOBAL_OFFSET_TABLE_
+ +43: 01810428 +0 NOTYPE +GLOBAL DEFAULT +ABS _end
+ +44: 0000001c +0 TLS +GLOBAL DEFAULT +11 gd0
+ +45: 0000002c +0 TLS +GLOBAL DEFAULT +11 ie0
+ +46: 018082fc +0 OBJECT +GLOBAL DEFAULT +8 _SDA2_BASE_
diff --git a/ld/testsuite/ld-powerpc/tlsexe32.t b/ld/testsuite/ld-powerpc/tlsexe32.t
new file mode 100644
index 0000000..f05aaf3
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tlsexe32.t
@@ -0,0 +1,11 @@
+#source: tls32.s
+#as: -a32
+#ld: -melf32ppc tmpdir/libtlslib32.so
+#objdump: -sj.tdata
+#target: powerpc*-*-*
+
+.*: +file format elf32-powerpc
+
+Contents of section \.tdata:
+ 18102fc 12345678 23456789 3456789a 456789ab .*
+ 181030c 56789abc 6789abcd 789abcde .*
diff --git a/ld/testsuite/ld-powerpc/tlslib32.s b/ld/testsuite/ld-powerpc/tlslib32.s
new file mode 100644
index 0000000..98cd3e9
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tlslib32.s
@@ -0,0 +1,14 @@
+ .global __tls_get_addr,gd,ld
+ .type __tls_get_addr,@function
+
+ .section ".tbss","awT",@nobits
+ .align 2
+gd: .space 4
+
+ .section ".tdata","awT",@progbits
+ .align 2
+ld: .long 0xc0ffee
+
+ .text
+__tls_get_addr:
+ blr
diff --git a/ld/testsuite/ld-powerpc/tlsso32.d b/ld/testsuite/ld-powerpc/tlsso32.d
new file mode 100644
index 0000000..2db9658
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tlsso32.d
@@ -0,0 +1,45 @@
+#source: tls32.s
+#as: -a32
+#ld: -shared -melf32ppc
+#objdump: -dr
+#target: powerpc*-*-*
+
+.*: +file format elf32-powerpc
+
+Disassembly of section \.text:
+
+0+538 <_start>:
+ 538: 38 7f 00 1c addi r3,r31,28
+ 53c: 48 00 00 01 bl 53c <_start\+0x4>
+ 540: 38 7f 00 0c addi r3,r31,12
+ 544: 48 00 00 01 bl 544 <_start\+0xc>
+ 548: 38 7f 00 24 addi r3,r31,36
+ 54c: 48 01 01 95 bl 106e0 <__bss_start\+0x48>
+ 550: 38 7f 00 0c addi r3,r31,12
+ 554: 48 01 01 8d bl 106e0 <__bss_start\+0x48>
+ 558: 39 23 80 20 addi r9,r3,-32736
+ 55c: 3d 23 00 00 addis r9,r3,0
+ 560: 81 49 80 24 lwz r10,-32732\(r9\)
+ 564: 81 3f 00 2c lwz r9,44\(r31\)
+ 568: 7d 49 12 2e lhzx r10,r9,r2
+ 56c: 89 42 00 00 lbz r10,0\(r2\)
+ 570: 3d 22 00 00 addis r9,r2,0
+ 574: 99 49 00 00 stb r10,0\(r9\)
+ 578: 38 7e 00 14 addi r3,r30,20
+ 57c: 48 00 00 01 bl 57c <_start\+0x44>
+ 580: 38 7e 00 0c addi r3,r30,12
+ 584: 48 00 00 01 bl 584 <_start\+0x4c>
+ 588: 91 43 80 04 stw r10,-32764\(r3\)
+ 58c: 3d 23 00 00 addis r9,r3,0
+ 590: 91 49 80 08 stw r10,-32760\(r9\)
+ 594: 81 3e 00 2c lwz r9,44\(r30\)
+ 598: 7d 49 13 2e sthx r10,r9,r2
+ 59c: a1 42 00 00 lhz r10,0\(r2\)
+ 5a0: 3d 22 00 00 addis r9,r2,0
+ 5a4: a9 49 00 00 lha r10,0\(r9\)
+Disassembly of section \.got:
+
+00010664 <\.got>:
+ 10664: 4e 80 00 21 blrl
+ 10668: 00 01 05 c4 \.long 0x105c4
+ \.\.\.
diff --git a/ld/testsuite/ld-powerpc/tlsso32.g b/ld/testsuite/ld-powerpc/tlsso32.g
new file mode 100644
index 0000000..13c991f
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tlsso32.g
@@ -0,0 +1,13 @@
+#source: tls32.s
+#as: -a32
+#ld: -shared -melf32ppc
+#objdump: -sj.got
+#target: powerpc*-*-*
+
+.*: +file format elf32-powerpc
+
+Contents of section \.got:
+ 10664 4e800021 000105c4 00000000 00000000 .*
+ 10674 00000000 00000000 00000000 00000000 .*
+ 10684 00000000 00000000 00000000 00000000 .*
+ 10694 00000000 .*
diff --git a/ld/testsuite/ld-powerpc/tlsso32.r b/ld/testsuite/ld-powerpc/tlsso32.r
new file mode 100644
index 0000000..7125875
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tlsso32.r
@@ -0,0 +1,162 @@
+#source: tls32.s
+#as: -a32
+#ld: -shared -melf32ppc
+#readelf: -WSsrl
+#target: powerpc*-*-*
+
+There are 20 section headers.*
+
+Section Headers:
+ +\[Nr\] Name +Type +Addr +Off +Size +ES Flg Lk Inf Al
+ +\[ 0\] +NULL +0+ 0+ 0+ 0+ +0 +0 +0
+ +\[ 1\] \.hash +HASH +0+b4 0+b4 0+dc 04 +A +2 +0 +4
+ +\[ 2\] \.dynsym +DYNSYM +0+190 0+190 0+240 10 +A +3 +11 +4
+ +\[ 3\] \.dynstr +STRTAB +0+3d0 0+3d0 0+81 0+ +A +0 +0 +1
+ +\[ 4\] \.rela\.dyn +RELA +0+454 0+454 0+d8 0c +A +2 +0 +4
+ +\[ 5\] \.rela\.plt +RELA +0+52c 0+52c 0+c 0c +A +2 +f +4
+ +\[ 6\] \.text +PROGBITS +0+538 0+538 0+70 0+ +AX +0 +0 +1
+ +\[ 7\] \.data +PROGBITS +0+105a8 0+5a8 0+ 0+ +WA +0 +0 +1
+ +\[ 8\] \.tdata +PROGBITS +0+105a8 0+5a8 0+1c 0+ WAT +0 +0 +4
+ +\[ 9\] \.tbss +NOBITS +0+105c4 0+5c4 0+1c 0+ WAT +0 +0 +4
+ +\[10\] \.dynamic +DYNAMIC +0+105c4 0+5c4 0+a0 08 +WA +3 +0 +4
+ +\[11\] \.got +PROGBITS +0+10664 0+664 0+34 04 WAX +0 +0 +4
+ +\[12\] \.sdata2 +PROGBITS +0+10698 0+698 0+ 0+ +A +0 +0 +4
+ +\[13\] \.sdata +PROGBITS +0+10698 0+698 0+ 0+ +WA +0 +0 +4
+ +\[14\] \.sbss +NOBITS +0+10698 0+698 0+ 0+ +WA +0 +0 +1
+ +\[15\] \.plt +NOBITS +0+10698 0+698 0+54 0+ WAX +0 +0 +4
+ +\[16\] \.bss +NOBITS +0+106ec 0+698 0+ 0+ +WA +0 +0 +1
+ +\[17\] \.shstrtab +STRTAB +0+ 0+698 0+86 0+ +0 +0 +1
+ +\[18\] \.symtab +SYMTAB +0+ 0+a40 0+2e0 10 +19 +1b +4
+ +\[19\] \.strtab +STRTAB +0+ 0+d20 0+a9 0+ +0 +0 +1
+#...
+
+Elf file type is DYN \(Shared object file\)
+Entry point 0x538
+There are 4 program headers.*
+
+Program Headers:
+ +Type +Offset +VirtAddr +PhysAddr +FileSiz MemSiz +Flg Align
+ +LOAD +0x0+ 0x0+ 0x0+ 0x0+5a8 0x0+5a8 R E 0x10000
+ +LOAD +0x0+5a8 0x0+105a8 0x0+105a8 0x0+f0 0x0+144 RWE 0x10000
+ +DYNAMIC +0x0+5c4 0x0+105c4 0x0+105c4 0x0+a0 0x0+a0 RW +0x4
+ +TLS +0x0+5a8 0x0+105a8 0x0+105a8 0x0+1c 0x0+38 R +0x4
+
+ Section to Segment mapping:
+ +Segment Sections\.\.\.
+ +0+ +\.hash \.dynsym \.dynstr \.rela\.dyn \.rela\.plt \.text
+ +01 +\.tdata \.tbss \.dynamic \.got \.plt
+ +02 +\.tbss \.dynamic
+ +03 +\.tdata \.tbss
+
+Relocation section '\.rela\.dyn' at offset 0x454 contains 18 entries:
+ Offset +Info +Type +Sym\. Value +Symbol's Name \+ Addend
+0+53c +0+140a R_PPC_REL24 +0+ +__tls_get_addr \+ 0
+0+544 +0+140a R_PPC_REL24 +0+ +__tls_get_addr \+ 0
+0+57c +0+140a R_PPC_REL24 +0+ +__tls_get_addr \+ 0
+0+584 +0+140a R_PPC_REL24 +0+ +__tls_get_addr \+ 0
+0+56e +0+1345 R_PPC_TPREL16 +0+30 +le0 \+ 0
+0+572 +0+1648 R_PPC_TPREL16_HA +0+34 +le1 \+ 0
+0+576 +0+1646 R_PPC_TPREL16_LO +0+34 +le1 \+ 0
+0+59e +0+845 R_PPC_TPREL16 +0+105a8 +\.tdata \+ 105bc
+0+5a2 +0+848 R_PPC_TPREL16_HA +0+105a8 +\.tdata \+ 105c0
+0+5a6 +0+846 R_PPC_TPREL16_LO +0+105a8 +\.tdata \+ 105c0
+0+10674 +0+44 R_PPC_DTPMOD32 +0+
+0+1067c +0+44 R_PPC_DTPMOD32 +0+
+0+10680 +0+4e R_PPC_DTPREL32 +0+105a8
+0+10684 +0+1244 R_PPC_DTPMOD32 +0+ +gd \+ 0
+0+10688 +0+124e R_PPC_DTPREL32 +0+ +gd \+ 0
+0+1068c +0+2144 R_PPC_DTPMOD32 +0+1c +gd0 \+ 0
+0+10690 +0+214e R_PPC_DTPREL32 +0+1c +gd0 \+ 0
+0+10694 +0+2249 R_PPC_TPREL32 +0+2c +ie0 \+ 0
+
+Relocation section '\.rela\.plt' at offset 0x52c contains 1 entries:
+ Offset +Info +Type +Sym\. Value +Symbol's Name \+ Addend
+0+106e0 +0+1415 R_PPC_JMP_SLOT +0+ +__tls_get_addr \+ 0
+
+Symbol table '\.dynsym' contains 36 entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+ +0: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND
+ +1: 0+b4 +0 SECTION LOCAL +DEFAULT +1
+ +2: 0+190 +0 SECTION LOCAL +DEFAULT +2
+ +3: 0+3d0 +0 SECTION LOCAL +DEFAULT +3
+ +4: 0+454 +0 SECTION LOCAL +DEFAULT +4
+ +5: 0+52c +0 SECTION LOCAL +DEFAULT +5
+ +6: 0+538 +0 SECTION LOCAL +DEFAULT +6
+ +7: 0+105a8 +0 SECTION LOCAL +DEFAULT +7
+ +8: 0+105a8 +0 SECTION LOCAL +DEFAULT +8
+ +9: 0+105c4 +0 SECTION LOCAL +DEFAULT +9
+ +10: 0+105c4 +0 SECTION LOCAL +DEFAULT +10
+ +11: 0+10664 +0 SECTION LOCAL +DEFAULT +11
+ +12: 0+10698 +0 SECTION LOCAL +DEFAULT +12
+ +13: 0+10698 +0 SECTION LOCAL +DEFAULT +13
+ +14: 0+10698 +0 SECTION LOCAL +DEFAULT +14
+ +15: 0+10698 +0 SECTION LOCAL +DEFAULT +15
+ +16: 0+106ec +0 SECTION LOCAL +DEFAULT +16
+ +17: 0+105c4 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC
+ +18: 0+ +0 NOTYPE +GLOBAL DEFAULT +UND gd
+ +19: 0+30 +0 TLS +GLOBAL DEFAULT +9 le0
+ +20: 0+ +0 NOTYPE +GLOBAL DEFAULT +UND __tls_get_addr
+ +21: 0+20 +0 TLS +GLOBAL DEFAULT +9 ld0
+ +22: 0+34 +0 TLS +GLOBAL DEFAULT +9 le1
+ +23: 0+ +0 NOTYPE +GLOBAL DEFAULT +UND ld
+ +24: 0+538 +0 NOTYPE +GLOBAL DEFAULT +6 _start
+ +25: 0+106ec +0 NOTYPE +GLOBAL DEFAULT +ABS __end
+ +26: 0+18698 +0 OBJECT +GLOBAL DEFAULT +13 _SDA_BASE_
+ +27: 0+28 +0 TLS +GLOBAL DEFAULT +9 ld2
+ +28: 0+24 +0 TLS +GLOBAL DEFAULT +9 ld1
+ +29: 0+10698 +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+ +30: 0+10698 +0 NOTYPE +GLOBAL DEFAULT +ABS _edata
+ +31: 0+10668 +0 OBJECT +GLOBAL DEFAULT +ABS _GLOBAL_OFFSET_TABLE_
+ +32: 0+106ec +0 NOTYPE +GLOBAL DEFAULT +ABS _end
+ +33: 0+1c +0 TLS +GLOBAL DEFAULT +9 gd0
+ +34: 0+2c +0 TLS +GLOBAL DEFAULT +9 ie0
+ +35: 0+18698 +0 OBJECT +GLOBAL DEFAULT +12 _SDA2_BASE_
+
+Symbol table '\.symtab' contains 46 entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+ +0: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND
+ +1: 0+b4 +0 SECTION LOCAL +DEFAULT +1
+ +2: 0+190 +0 SECTION LOCAL +DEFAULT +2
+ +3: 0+3d0 +0 SECTION LOCAL +DEFAULT +3
+ +4: 0+454 +0 SECTION LOCAL +DEFAULT +4
+ +5: 0+52c +0 SECTION LOCAL +DEFAULT +5
+ +6: 0+538 +0 SECTION LOCAL +DEFAULT +6
+ +7: 0+105a8 +0 SECTION LOCAL +DEFAULT +7
+ +8: 0+105a8 +0 SECTION LOCAL +DEFAULT +8
+ +9: 0+105c4 +0 SECTION LOCAL +DEFAULT +9
+ +10: 0+105c4 +0 SECTION LOCAL +DEFAULT +10
+ +11: 0+10664 +0 SECTION LOCAL +DEFAULT +11
+ +12: 0+10698 +0 SECTION LOCAL +DEFAULT +12
+ +13: 0+10698 +0 SECTION LOCAL +DEFAULT +13
+ +14: 0+10698 +0 SECTION LOCAL +DEFAULT +14
+ +15: 0+10698 +0 SECTION LOCAL +DEFAULT +15
+ +16: 0+106ec +0 SECTION LOCAL +DEFAULT +16
+ +17: 0+ +0 SECTION LOCAL +DEFAULT +17
+ +18: 0+ +0 SECTION LOCAL +DEFAULT +18
+ +19: 0+ +0 SECTION LOCAL +DEFAULT +19
+ +20: 0+ +0 TLS +LOCAL +DEFAULT +8 gd4
+ +21: 0+4 +0 TLS +LOCAL +DEFAULT +8 ld4
+ +22: 0+8 +0 TLS +LOCAL +DEFAULT +8 ld5
+ +23: 0+c +0 TLS +LOCAL +DEFAULT +8 ld6
+ +24: 0+10 +0 TLS +LOCAL +DEFAULT +8 ie4
+ +25: 0+14 +0 TLS +LOCAL +DEFAULT +8 le4
+ +26: 0+18 +0 TLS +LOCAL +DEFAULT +8 le5
+ +27: 0+105c4 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC
+ +28: 0+ +0 NOTYPE +GLOBAL DEFAULT +UND gd
+ +29: 0+30 +0 TLS +GLOBAL DEFAULT +9 le0
+ +30: 0+ +0 NOTYPE +GLOBAL DEFAULT +UND __tls_get_addr
+ +31: 0+20 +0 TLS +GLOBAL DEFAULT +9 ld0
+ +32: 0+34 +0 TLS +GLOBAL DEFAULT +9 le1
+ +33: 0+ +0 NOTYPE +GLOBAL DEFAULT +UND ld
+ +34: 0+538 +0 NOTYPE +GLOBAL DEFAULT +6 _start
+ +35: 0+106ec +0 NOTYPE +GLOBAL DEFAULT +ABS __end
+ +36: 0+18698 +0 OBJECT +GLOBAL DEFAULT +13 _SDA_BASE_
+ +37: 0+28 +0 TLS +GLOBAL DEFAULT +9 ld2
+ +38: 0+24 +0 TLS +GLOBAL DEFAULT +9 ld1
+ +39: 0+10698 +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+ +40: 0+10698 +0 NOTYPE +GLOBAL DEFAULT +ABS _edata
+ +41: 0+10668 +0 OBJECT +GLOBAL DEFAULT +ABS _GLOBAL_OFFSET_TABLE_
+ +42: 0+106ec +0 NOTYPE +GLOBAL DEFAULT +ABS _end
+ +43: 0+1c +0 TLS +GLOBAL DEFAULT +9 gd0
+ +44: 0+2c +0 TLS +GLOBAL DEFAULT +9 ie0
+ +45: 0+18698 +0 OBJECT +GLOBAL DEFAULT +12 _SDA2_BASE_
diff --git a/ld/testsuite/ld-powerpc/tlsso32.t b/ld/testsuite/ld-powerpc/tlsso32.t
new file mode 100644
index 0000000..1481864
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tlsso32.t
@@ -0,0 +1,11 @@
+#source: tls32.s
+#as: -a32
+#ld: -shared -melf32ppc
+#objdump: -sj.tdata
+#target: powerpc*-*-*
+
+.*: +file format elf32-powerpc
+
+Contents of section \.tdata:
+ 105a8 12345678 23456789 3456789a 456789ab .*
+ 105b8 56789abc 6789abcd 789abcde .*