aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2003-01-22 00:41:59 +0000
committerRichard Henderson <rth@redhat.com>2003-01-22 00:41:59 +0000
commit8b0c8155b226b3baa54c9d27ae02e6687e131a43 (patch)
treed31ebdd9356a45b24b4a1ccc6c5af93baa695570
parent811daac4022c49191e0988db4a5401f54beb3a00 (diff)
downloadgdb-8b0c8155b226b3baa54c9d27ae02e6687e131a43.zip
gdb-8b0c8155b226b3baa54c9d27ae02e6687e131a43.tar.gz
gdb-8b0c8155b226b3baa54c9d27ae02e6687e131a43.tar.bz2
New TLS tests for Alpha.
-rw-r--r--ld/testsuite/ChangeLog23
-rw-r--r--ld/testsuite/ld-alpha/align.s9
-rw-r--r--ld/testsuite/ld-alpha/alpha.exp61
-rw-r--r--ld/testsuite/ld-alpha/tlsbin.dd62
-rw-r--r--ld/testsuite/ld-alpha/tlsbin.rd143
-rw-r--r--ld/testsuite/ld-alpha/tlsbin.s46
-rw-r--r--ld/testsuite/ld-alpha/tlsbin.sd17
-rw-r--r--ld/testsuite/ld-alpha/tlsbin.td17
-rw-r--r--ld/testsuite/ld-alpha/tlsbinpic.s74
-rw-r--r--ld/testsuite/ld-alpha/tlsbinr.dd62
-rw-r--r--ld/testsuite/ld-alpha/tlsbinr.rd138
-rw-r--r--ld/testsuite/ld-alpha/tlsbinr.sd12
-rw-r--r--ld/testsuite/ld-alpha/tlsg.s14
-rw-r--r--ld/testsuite/ld-alpha/tlsg.sd10
-rw-r--r--ld/testsuite/ld-alpha/tlslib.s19
-rw-r--r--ld/testsuite/ld-alpha/tlspic.dd56
-rw-r--r--ld/testsuite/ld-alpha/tlspic.rd152
-rw-r--r--ld/testsuite/ld-alpha/tlspic.sd17
-rw-r--r--ld/testsuite/ld-alpha/tlspic.td17
-rw-r--r--ld/testsuite/ld-alpha/tlspic1.s87
-rw-r--r--ld/testsuite/ld-alpha/tlspic2.s11
21 files changed, 1047 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index dd063c8..b080896 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,26 @@
+2003-01-21 Richard Henderson <rth@redhat.com>
+
+ * ld-alpha/alpha.exp: New.
+ * ld-alpha/align.s: New.
+ * ld-alpha/tlsbin.dd: New.
+ * ld-alpha/tlsbin.rd: New.
+ * ld-alpha/tlsbin.s: New.
+ * ld-alpha/tlsbin.sd: New.
+ * ld-alpha/tlsbin.td: New.
+ * ld-alpha/tlsbinpic.s: New.
+ * ld-alpha/tlsbinr.dd: New.
+ * ld-alpha/tlsbinr.rd: New.
+ * ld-alpha/tlsbinr.sd: New.
+ * ld-alpha/tlsg.s: New.
+ * ld-alpha/tlsg.sd: New.
+ * ld-alpha/tlslib.s: New.
+ * ld-alpha/tlspic.dd: New.
+ * ld-alpha/tlspic.rd: New.
+ * ld-alpha/tlspic.sd: New.
+ * ld-alpha/tlspic.td: New.
+ * ld-alpha/tlspic1.s: New.
+ * ld-alpha/tlspic2.s: New.
+
2003-01-20 Alan Modra <amodra@bigpond.net.au>
* ld-srec/srec.exp (run_srec_test): Pass --traditional-format to ld.
diff --git a/ld/testsuite/ld-alpha/align.s b/ld/testsuite/ld-alpha/align.s
new file mode 100644
index 0000000..6c48ba9
--- /dev/null
+++ b/ld/testsuite/ld-alpha/align.s
@@ -0,0 +1,9 @@
+ /* Force .data aligned to 4K, so that .got very likely gets
+ placed at 0x1200131d0. */
+ .data
+ .balign 4096
+
+ /* Force .text aligned to 4K, so it very likely gets placed at
+ 0x120001000. */
+ .text
+ .balign 4096
diff --git a/ld/testsuite/ld-alpha/alpha.exp b/ld/testsuite/ld-alpha/alpha.exp
new file mode 100644
index 0000000..5b2c7e0
--- /dev/null
+++ b/ld/testsuite/ld-alpha/alpha.exp
@@ -0,0 +1,61 @@
+# Expect script for ld-alpha tests
+# Copyright (C) 2003 Free Software Foundation
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+# Test Alpha ELF linking; all types of relocs. This tests the
+# assembler and tools like objdump as well as the linker.
+
+if { !([istarget "alpha*-*-elf*"]
+ || [istarget "alpha*-*-linux*"]) } {
+ return
+}
+
+# List contains test-items with 3 items followed by 2 lists:
+# 0:name 1:ld options 2:assembler options
+# 3:filenames of assembler files 4: action and options. 5: name of output file
+
+# Actions:
+# objdump: Apply objdump options on result. Compare with regex (last arg).
+# nm: Apply nm options on result. Compare with regex (last arg).
+# readelf: Apply readelf options on result. Compare with regex (last arg).
+
+set alphatests {
+ {"TLS -fpic -shared" "-shared -melf64alpha"
+ "" {align.s tlspic1.s tlspic2.s}
+ {{readelf -WSsrl tlspic.rd} {objdump -drj.text tlspic.dd}
+ {objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}}
+ "libtlspic.so"}
+ {"Helper shared library" "-shared -melf64alpha"
+ "" {tlslib.s} {} "libtlslib.so"}
+ {"TLS -fpic and -fno-pic exec"
+ "-melf64alpha tmpdir/libtlslib.so" "" {align.s tlsbinpic.s tlsbin.s}
+ {{readelf -WSsrl tlsbin.rd} {objdump -drj.text tlsbin.dd}
+ {objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}}
+ "tlsbin"}
+ {"TLS -fpic and -fno-pic exec -relax"
+ "-relax -melf64alpha tmpdir/libtlslib.so" "" {align.s tlsbinpic.s tlsbin.s}
+ {{readelf -WSsrl tlsbinr.rd} {objdump -drj.text tlsbinr.dd}
+ {objdump -sj.got tlsbinr.sd}}
+ "tlsbinr"}
+}
+
+# Not implemented yet
+# {"TLS in debug sections" "-melf64alpha"
+# "" {tlsg.s}
+# {{objdump -sj.debug_foobar tlsg.sd}} "tlsg"}
+
+run_ld_link_tests $alphatests
diff --git a/ld/testsuite/ld-alpha/tlsbin.dd b/ld/testsuite/ld-alpha/tlsbin.dd
new file mode 100644
index 0000000..8dfd97a
--- /dev/null
+++ b/ld/testsuite/ld-alpha/tlsbin.dd
@@ -0,0 +1,62 @@
+#source: align.s
+#source: tlsbinpic.s
+#source: tlsbin.s
+#as:
+#ld: -melf64alpha
+#objdump: -drj.text
+#target: alpha*-*-*
+
+.*: +file format elf64-alpha
+
+Disassembly of section \.text:
+
+0+120001000 <fn2>:
+ 120001000: 02 00 bb 27 ldah gp,2\(t12\)
+ 120001004: d0 91 bd 23 lda gp,-28208\(gp\)
+ 120001008: 3e 15 c2 43 subq sp,0x10,sp
+ 12000100c: 00 00 5e b7 stq ra,0\(sp\)
+ 120001010: 18 80 1d 22 lda a0,-32744\(gp\)
+ 120001014: 08 80 7d a7 ldq t12,-32760\(gp\)
+ 120001018: 00 40 5b 6b jsr ra,\(t12\),12000101c <.*>
+ 12000101c: 02 00 ba 27 ldah gp,2\(ra\)
+ 120001020: b4 91 bd 23 lda gp,-28236\(gp\)
+ 120001024: 38 80 1d 22 lda a0,-32712\(gp\)
+ 120001028: 08 80 7d a7 ldq t12,-32760\(gp\)
+ 12000102c: 00 40 5b 6b jsr ra,\(t12\),120001030 <.*>
+ 120001030: 02 00 ba 27 ldah gp,2\(ra\)
+ 120001034: a0 91 bd 23 lda gp,-28256\(gp\)
+ 120001038: 28 80 1d 22 lda a0,-32728\(gp\)
+ 12000103c: 08 80 7d a7 ldq t12,-32760\(gp\)
+ 120001040: 00 40 5b 6b jsr ra,\(t12\),120001044 <.*>
+ 120001044: 02 00 ba 27 ldah gp,2\(ra\)
+ 120001048: 8c 91 bd 23 lda gp,-28276\(gp\)
+ 12000104c: 21 00 20 20 lda t0,33\(v0\)
+ 120001050: 28 80 1d 22 lda a0,-32728\(gp\)
+ 120001054: 08 80 7d a7 ldq t12,-32760\(gp\)
+ 120001058: 00 40 5b 6b jsr ra,\(t12\),12000105c <.*>
+ 12000105c: 02 00 ba 27 ldah gp,2\(ra\)
+ 120001060: 74 91 bd 23 lda gp,-28300\(gp\)
+ 120001064: 40 00 20 20 lda t0,64\(v0\)
+ 120001068: 46 00 20 20 lda t0,70\(v0\)
+ 12000106c: 00 00 20 24 ldah t0,0\(v0\)
+ 120001070: 4b 00 21 20 lda t0,75\(t0\)
+ 120001074: 10 80 3d a4 ldq t0,-32752\(gp\)
+ 120001078: 01 04 20 40 addq t0,v0,t0
+ 12000107c: 00 00 5e a7 ldq ra,0\(sp\)
+ 120001080: 1e 14 c2 43 addq sp,0x10,sp
+ 120001084: 01 80 fa 6b ret
+
+0+120001088 <_start>:
+ 120001088: 9e 00 00 00 rduniq
+ 12000108c: 09 04 e0 47 mov v0,s0
+ 120001090: 00 80 3d a4 ldq t0,-32768\(gp\)
+ 120001094: 01 04 29 40 addq t0,s0,t0
+ 120001098: 48 80 3d a4 ldq t0,-32696\(gp\)
+ 12000109c: 01 04 29 40 addq t0,s0,t0
+ 1200010a0: 10 00 29 20 lda t0,16\(s0\)
+ 1200010a4: 96 00 29 20 lda t0,150\(s0\)
+ 1200010a8: 00 00 29 24 ldah t0,0\(s0\)
+ 1200010ac: 57 00 21 20 lda t0,87\(t0\)
+ 1200010b0: 50 80 3d a4 ldq t0,-32688\(gp\)
+ 1200010b4: 01 04 29 40 addq t0,s0,t0
+ 1200010b8: 01 80 fa 6b ret
diff --git a/ld/testsuite/ld-alpha/tlsbin.rd b/ld/testsuite/ld-alpha/tlsbin.rd
new file mode 100644
index 0000000..25eb120
--- /dev/null
+++ b/ld/testsuite/ld-alpha/tlsbin.rd
@@ -0,0 +1,143 @@
+#source: align.s
+#source: tlsbinpic.s
+#source: tlsbin.s
+#as:
+#ld: -melf64alpha
+#readelf: -WSsrl
+#target: alpha*-*-*
+
+There are 19 section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ \[Nr\] Name +Type +Address +Off +Size +ES Flg Lk Inf Al
+ \[ 0\] +NULL +0+ 0+ 0+ 00 +0 +0 +0
+ \[ 1] .interp +.*
+ \[ 2\] .hash +.*
+ \[ 3\] .dynsym +.*
+ \[ 4\] .dynstr +.*
+ \[ 5\] .rela.dyn +.*
+ \[ 6\] .rela.plt +.*
+ \[ 7\] .text +PROGBITS +0+120001000 0+1000 0+bc 00 +AX +0 +0 4096
+ \[ 8\] .data +.*
+ \[ 9\] .tdata +PROGBITS +0+120012000 0+2000 0+60 00 WAT +0 +0 +4
+ \[10\] .tbss +NOBITS +0+120012060 0+2060 0+40 00 WAT +0 +0 +1
+ \[11\] .dynamic +DYNAMIC +0+120012060 0+2060 0+140 10 +WA +4 +0 +8
+ \[12\] .plt +.*
+ \[13\] .got +PROGBITS +0+1200121d0 0+21d0 0+58 00 +WA +0 +0 +8
+ \[14\] .sbss +.*
+ \[15\] .bss +.*
+ \[16\] .shstrtab +.*
+ \[17\] .symtab +.*
+ \[18\] .strtab +.*
+#...
+
+Elf file type is EXEC \(Executable file\)
+Entry point 0x[0-9a-f]+
+There are 6 program headers, starting at offset [0-9]+
+
+Program Headers:
+ Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg Align
+ PHDR +0x0+40 0x0+120000040 0x0+120000040 0x0+150 0x0+150 R E 0x8
+ INTERP +0x0+190 0x0+120000190 0x0+120000190 0x[0-9a-f]+ 0x[0-9a-f]+ R +0x1
+.*Requesting program interpreter.*
+ LOAD +0x0+ 0x0+120000000 0x0+120000000 0x0+10bc 0x0+10bc R E 0x10000
+ LOAD +0x0+2000 0x0+120012000 0x0+120012000 0x0+228 0x0+228 RWE 0x10000
+ DYNAMIC +0x0+2060 0x0+120012060 0x0+120012060 0x0+140 0x0+140 RW +0x8
+ TLS +0x0+2000 0x0+120012000 0x0+120012000 0x0+60 0x0+a0 R +0x4
+#...
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 3 entries:
+ +Offset +Info +Type +Symbol's Value Symbol's Name \+ Addend
+0+1200121d0 0+200000026 R_ALPHA_TPREL64 +0+ sG2 \+ 0
+0+1200121e8 0+60000001f R_ALPHA_DTPMOD64 +0+ sG1 \+ 0
+0+1200121f0 0+600000021 R_ALPHA_DTPREL64 +0+ sG1 \+ 0
+
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entries:
+ +Offset +Info +Type +Symbol's Value Symbol's Name \+ Addend
+0+1200121d8 0+40000001a R_ALPHA_JMP_SLOT +0+1200121c0 __tls_get_addr \+ 0
+
+Symbol table '.dynsym' contains 10 entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+ +0: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND *
+ +1: 0+120012060 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC
+ +2: 0+ +0 TLS +GLOBAL DEFAULT +UND sG2
+ +3: 0+1200121a0 +0 OBJECT +GLOBAL DEFAULT +ABS _PROCEDURE_LINKAGE_TABLE_
+ +4: 0+1200121c0 +4 FUNC +GLOBAL DEFAULT +UND __tls_get_addr
+ +5: 0+120012228 +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+ +6: 0+ +0 TLS +GLOBAL DEFAULT +UND sG1
+ +7: 0+120012228 +0 NOTYPE +GLOBAL DEFAULT +ABS _edata
+ +8: 0+1200121d0 +0 OBJECT +GLOBAL DEFAULT +ABS _GLOBAL_OFFSET_TABLE_
+ +9: 0+120012228 +0 NOTYPE +GLOBAL DEFAULT +ABS _end
+
+Symbol table '.symtab' contains 70 entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+ +0: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND
+ +1: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +1
+ +2: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +2
+ +3: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +3
+ +4: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +4
+ +5: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +5
+ +6: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +6
+ +7: 0+120001000 +0 SECTION LOCAL +DEFAULT +7
+ +8: 0+120012000 +0 SECTION LOCAL +DEFAULT +8
+ +9: 0+120012000 +0 SECTION LOCAL +DEFAULT +9
+ +10: 0+120012060 +0 SECTION LOCAL +DEFAULT +10
+ +11: 0+120012060 +0 SECTION LOCAL +DEFAULT +11
+ +12: 0+1200121a0 +0 SECTION LOCAL +DEFAULT +12
+ +13: 0+1200121d0 +0 SECTION LOCAL +DEFAULT +13
+ +14: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +14
+ +15: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +15
+ +16: 0+ +0 SECTION LOCAL +DEFAULT +16
+ +17: 0+ +0 SECTION LOCAL +DEFAULT +17
+ +18: 0+ +0 SECTION LOCAL +DEFAULT +18
+ +19: 0+20 +0 TLS +LOCAL +DEFAULT +9 sl1
+ +20: 0+24 +0 TLS +LOCAL +DEFAULT +9 sl2
+ +21: 0+28 +0 TLS +LOCAL +DEFAULT +9 sl3
+ +22: 0+2c +0 TLS +LOCAL +DEFAULT +9 sl4
+ +23: 0+30 +0 TLS +LOCAL +DEFAULT +9 sl5
+ +24: 0+34 +0 TLS +LOCAL +DEFAULT +9 sl6
+ +25: 0+38 +0 TLS +LOCAL +DEFAULT +9 sl7
+ +26: 0+3c +0 TLS +LOCAL +DEFAULT +9 sl8
+ +27: 0+80 +0 TLS +LOCAL +DEFAULT +10 bl1
+ +28: 0+84 +0 TLS +LOCAL +DEFAULT +10 bl2
+ +29: 0+88 +0 TLS +LOCAL +DEFAULT +10 bl3
+ +30: 0+8c +0 TLS +LOCAL +DEFAULT +10 bl4
+ +31: 0+90 +0 TLS +LOCAL +DEFAULT +10 bl5
+ +32: 0+94 +0 TLS +LOCAL +DEFAULT +10 bl6
+ +33: 0+98 +0 TLS +LOCAL +DEFAULT +10 bl7
+ +34: 0+9c +0 TLS +LOCAL +DEFAULT +10 bl8
+ +35: 0+1c +0 TLS +GLOBAL DEFAULT +9 sg8
+ +36: 0+7c +0 TLS +GLOBAL DEFAULT +10 bg8
+ +37: 0+74 +0 TLS +GLOBAL DEFAULT +10 bg6
+ +38: 0+68 +0 TLS +GLOBAL DEFAULT +10 bg3
+ +39: 0+120012060 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC
+ +40: 0+8 +0 TLS +GLOBAL DEFAULT +9 sg3
+ +41: 0+48 +0 TLS +GLOBAL HIDDEN +9 sh3
+ +42: 0+ +0 TLS +GLOBAL DEFAULT +UND sG2
+ +43: 0+c +0 TLS +GLOBAL DEFAULT +9 sg4
+ +44: 0+10 +0 TLS +GLOBAL DEFAULT +9 sg5
+ +45: 0+1200121a0 +0 OBJECT +GLOBAL DEFAULT +ABS _PROCEDURE_LINKAGE_TABLE_
+ +46: 0+70 +0 TLS +GLOBAL DEFAULT +10 bg5
+ +47: 0+1200121c0 +4 FUNC +GLOBAL DEFAULT +UND __tls_get_addr
+ +48: 0+58 +0 TLS +GLOBAL HIDDEN +9 sh7
+ +49: 0+5c +0 TLS +GLOBAL HIDDEN +9 sh8
+ +50: 0+ +0 TLS +GLOBAL DEFAULT +9 sg1
+ +51: 0+120001088 +52 FUNC +GLOBAL DEFAULT +7 _start
+ +52: 0+4c +0 TLS +GLOBAL HIDDEN +9 sh4
+ +53: 0+78 +0 TLS +GLOBAL DEFAULT +10 bg7
+ +54: 0+50 +0 TLS +GLOBAL HIDDEN +9 sh5
+ +55: 0+120012228 +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+ +56: 0+120001000 +136 FUNC +GLOBAL DEFAULT +7 fn2
+ +57: 0+4 +0 TLS +GLOBAL DEFAULT +9 sg2
+ +58: 0+ +0 TLS +GLOBAL DEFAULT +UND sG1
+ +59: 0+40 +0 TLS +GLOBAL HIDDEN +9 sh1
+ +60: 0+14 +0 TLS +GLOBAL DEFAULT +9 sg6
+ +61: 0+18 +0 TLS +GLOBAL DEFAULT +9 sg7
+ +62: 0+120012228 +0 NOTYPE +GLOBAL DEFAULT +ABS _edata
+ +63: 0+1200121d0 +0 OBJECT +GLOBAL DEFAULT +ABS _GLOBAL_OFFSET_TABLE_
+ +64: 0+120012228 +0 NOTYPE +GLOBAL DEFAULT +ABS _end
+ +65: 0+44 +0 TLS +GLOBAL HIDDEN +9 sh2
+ +66: 0+54 +0 TLS +GLOBAL HIDDEN +9 sh6
+ +67: 0+64 +0 TLS +GLOBAL DEFAULT +10 bg2
+ +68: 0+60 +0 TLS +GLOBAL DEFAULT +10 bg1
+ +69: 0+6c +0 TLS +GLOBAL DEFAULT +10 bg4
diff --git a/ld/testsuite/ld-alpha/tlsbin.s b/ld/testsuite/ld-alpha/tlsbin.s
new file mode 100644
index 0000000..a772a7e
--- /dev/null
+++ b/ld/testsuite/ld-alpha/tlsbin.s
@@ -0,0 +1,46 @@
+ .section ".tbss", "awT", @nobits
+ .globl bg1, bg2, bg3, bg4, bg5, bg6, bg7, bg8
+bg1: .space 4
+bg2: .space 4
+bg3: .space 4
+bg4: .space 4
+bg5: .space 4
+bg6: .space 4
+bg7: .space 4
+bg8: .space 4
+bl1: .space 4
+bl2: .space 4
+bl3: .space 4
+bl4: .space 4
+bl5: .space 4
+bl6: .space 4
+bl7: .space 4
+bl8: .space 4
+
+ .text
+ .globl _start
+ .ent _start
+_start:
+ rduniq
+ mov $0, $9
+
+ /* IE */
+ ldq $1, sG2($gp) !gottprel
+ addq $1, $9, $1
+
+ /* IE against global symbol in exec */
+ ldq $1, bl1($gp) !gottprel
+ addq $1, $9, $1
+
+ /* LE */
+ lda $1, sg1($9) !tprel
+ lda $1, bl2+2($9) !tprel
+
+ ldah $1, sh2+3($9) !tprelhi
+ lda $1, sh2+3($1) !tprello
+
+ ldq $1, bl2+4($gp) !gottprel
+ addq $1, $9, $1
+
+ ret
+ .end _start
diff --git a/ld/testsuite/ld-alpha/tlsbin.sd b/ld/testsuite/ld-alpha/tlsbin.sd
new file mode 100644
index 0000000..9f5e240
--- /dev/null
+++ b/ld/testsuite/ld-alpha/tlsbin.sd
@@ -0,0 +1,17 @@
+#source: align.s
+#source: tlsbinpic.s
+#source: tlsbin.s
+#as:
+#ld: -melfalpha
+#objdump: -sj.got
+#target: alpha*-*-*
+
+.*: +file format elf64-alpha
+
+Contents of section .got:
+ 1200121d0 00000000 00000000 c0210120 01000000 .*
+ 1200121e0 56000000 00000000 00000000 00000000 .*
+ 1200121f0 00000000 00000000 01000000 00000000 .*
+ 120012200 00000000 00000000 01000000 00000000 .*
+ 120012210 24000000 00000000 90000000 00000000 .*
+ 120012220 98000000 00000000 .*
diff --git a/ld/testsuite/ld-alpha/tlsbin.td b/ld/testsuite/ld-alpha/tlsbin.td
new file mode 100644
index 0000000..4e8b2c7
--- /dev/null
+++ b/ld/testsuite/ld-alpha/tlsbin.td
@@ -0,0 +1,17 @@
+#source: align.s
+#source: tlsbinpic.s
+#source: tlsbin.s
+#as:
+#ld: -melf64alpha
+#objdump: -sj.tdata
+#target: alpha*-*-*
+
+.*: +file format elf64-alpha
+
+Contents of section .tdata:
+ 120012000 11000000 12000000 13000000 14000000 .*
+ 120012010 15000000 16000000 17000000 18000000 .*
+ 120012020 41000000 42000000 43000000 44000000 .*
+ 120012030 45000000 46000000 47000000 48000000 .*
+ 120012040 01010000 02010000 03010000 04010000 .*
+ 120012050 05010000 06010000 07010000 08010000 .*
diff --git a/ld/testsuite/ld-alpha/tlsbinpic.s b/ld/testsuite/ld-alpha/tlsbinpic.s
new file mode 100644
index 0000000..7a94eb1
--- /dev/null
+++ b/ld/testsuite/ld-alpha/tlsbinpic.s
@@ -0,0 +1,74 @@
+ .section ".tdata", "awT", @progbits
+ .globl sg1, sg2, sg3, sg4, sg5, sg6, sg7, sg8
+ .globl sh1, sh2, sh3, sh4, sh5, sh6, sh7, sh8
+ .hidden sh1, sh2, sh3, sh4, sh5, sh6, sh7, sh8
+sg1: .long 17
+sg2: .long 18
+sg3: .long 19
+sg4: .long 20
+sg5: .long 21
+sg6: .long 22
+sg7: .long 23
+sg8: .long 24
+sl1: .long 65
+sl2: .long 66
+sl3: .long 67
+sl4: .long 68
+sl5: .long 69
+sl6: .long 70
+sl7: .long 71
+sl8: .long 72
+sh1: .long 257
+sh2: .long 258
+sh3: .long 259
+sh4: .long 260
+sh5: .long 261
+sh6: .long 262
+sh7: .long 263
+sh8: .long 264
+
+ .text
+ .globl fn2
+ .ent fn2
+fn2:
+ .frame $sp, 16, $26, 0
+ ldgp $gp, 0($27)
+ subq $sp, 16, $sp
+ stq $26, 0($sp)
+ .prologue 1
+
+ /* GD */
+ lda $16, sG1($gp) !tlsgd!1
+ ldq $27, __tls_get_addr($gp) !literal!1
+ jsr $26, ($27), __tls_get_addr !lituse_tlsgd!1
+ ldgp $gp, 0($26)
+
+ /* GD against local symbol */
+ lda $16, sl2($gp) !tlsgd!2
+ ldq $27, __tls_get_addr($gp) !literal!2
+ jsr $26, ($27), __tls_get_addr !lituse_tlsgd!2
+ ldgp $gp, 0($26)
+
+ /* LD */
+ lda $16, sl1($gp) !tlsldm!3
+ ldq $27, __tls_get_addr($gp) !literal!3
+ jsr $26, ($27), __tls_get_addr !lituse_tlsldm!3
+ ldgp $gp, 0($26)
+ lda $1, sl1+1($0) !dtprel
+
+ /* LD with 4 variables */
+ lda $16, sh1($gp) !tlsldm!4
+ ldq $27, __tls_get_addr($gp) !literal!4
+ jsr $26, ($27), __tls_get_addr !lituse_tlsldm!4
+ ldgp $gp, 0($26)
+ lda $1, sh1($0) !dtprel
+ lda $1, sh2+2($0) !dtprel
+ ldah $1, sh3+3($0) !dtprelhi
+ lda $1, sh3+3($1) !dtprello
+ ldq $1, sh4+10($gp) !gotdtprel
+ addq $1, $0, $1
+
+ ldq $26, 0($sp)
+ addq $sp, 16, $sp
+ ret
+ .end fn2
diff --git a/ld/testsuite/ld-alpha/tlsbinr.dd b/ld/testsuite/ld-alpha/tlsbinr.dd
new file mode 100644
index 0000000..6bba77d
--- /dev/null
+++ b/ld/testsuite/ld-alpha/tlsbinr.dd
@@ -0,0 +1,62 @@
+#source: align.s
+#source: tlsbinpic.s
+#source: tlsbin.s
+#as:
+#ld: -relax -melf64alpha
+#objdump: -drj.text
+#target: alpha*-*-*
+
+.*: +file format elf64-alpha
+
+Disassembly of section \.text:
+
+0+120001000 <fn2>:
+ 120001000: 02 00 bb 27 ldah gp,2\(t12\)
+ 120001004: a0 91 bd 23 lda gp,-28256\(gp\)
+ 120001008: 3e 15 c2 43 subq sp,0x10,sp
+ 12000100c: 00 00 5e b7 stq ra,0\(sp\)
+ 120001010: 08 80 1d a6 ldq a0,-32760\(gp\)
+ 120001014: 00 00 fe 2f unop
+ 120001018: 9e 00 00 00 rduniq
+ 12000101c: 00 04 00 42 addq a0,v0,v0
+ 120001020: 00 00 fe 2f unop
+ 120001024: 34 00 1f 22 lda a0,52
+ 120001028: 00 00 fe 2f unop
+ 12000102c: 9e 00 00 00 rduniq
+ 120001030: 00 04 00 42 addq a0,v0,v0
+ 120001034: 00 00 fe 2f unop
+ 120001038: 00 00 1f 22 lda a0,0
+ 12000103c: 00 00 fe 2f unop
+ 120001040: 9e 00 00 00 rduniq
+ 120001044: 00 04 00 42 addq a0,v0,v0
+ 120001048: 00 00 fe 2f unop
+ 12000104c: 21 00 20 20 lda t0,33\(v0\)
+ 120001050: 00 00 1f 22 lda a0,0
+ 120001054: 00 00 fe 2f unop
+ 120001058: 9e 00 00 00 rduniq
+ 12000105c: 00 04 00 42 addq a0,v0,v0
+ 120001060: 00 00 fe 2f unop
+ 120001064: 40 00 20 20 lda t0,64\(v0\)
+ 120001068: 46 00 20 20 lda t0,70\(v0\)
+ 12000106c: 00 00 20 24 ldah t0,0\(v0\)
+ 120001070: 4b 00 21 20 lda t0,75\(t0\)
+ 120001074: 56 00 3f 20 lda t0,86
+ 120001078: 01 04 20 40 addq t0,v0,t0
+ 12000107c: 00 00 5e a7 ldq ra,0\(sp\)
+ 120001080: 1e 14 c2 43 addq sp,0x10,sp
+ 120001084: 01 80 fa 6b ret
+
+0000000120001088 <_start>:
+ 120001088: 9e 00 00 00 rduniq
+ 12000108c: 09 04 e0 47 mov v0,s0
+ 120001090: 00 80 3d a4 ldq t0,-32768\(gp\)
+ 120001094: 01 04 29 40 addq t0,s0,t0
+ 120001098: 90 00 3f 20 lda t0,144
+ 12000109c: 01 04 29 40 addq t0,s0,t0
+ 1200010a0: 10 00 29 20 lda t0,16\(s0\)
+ 1200010a4: 96 00 29 20 lda t0,150\(s0\)
+ 1200010a8: 00 00 29 24 ldah t0,0\(s0\)
+ 1200010ac: 57 00 21 20 lda t0,87\(t0\)
+ 1200010b0: 98 00 3f 20 lda t0,152
+ 1200010b4: 01 04 29 40 addq t0,s0,t0
+ 1200010b8: 01 80 fa 6b ret
diff --git a/ld/testsuite/ld-alpha/tlsbinr.rd b/ld/testsuite/ld-alpha/tlsbinr.rd
new file mode 100644
index 0000000..1ba3dbb
--- /dev/null
+++ b/ld/testsuite/ld-alpha/tlsbinr.rd
@@ -0,0 +1,138 @@
+#source: align.s
+#source: tlsbinpic.s
+#source: tlsbin.s
+#as:
+#ld: -relax -melf64alpha
+#readelf: -WSsrl
+#target: alpha*-*-*
+
+There are 19 section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Address +Off +Size +ES Flg Lk Inf Al
+ +\[ 0\] +NULL +0+ 0+ 0+ 0+ +0 +0 +0
+ +\[ 1\] .interp +.*
+ +\[ 2\] .hash +.*
+ +\[ 3\] .dynsym +.*
+ +\[ 4\] .dynstr +.*
+ +\[ 5\] .rela.dyn +.*
+ +\[ 6\] .rela.plt +.*
+ +\[ 7\] .text +PROGBITS +0+120001000 0+1000 0+bc 0+ +AX +0 +0 4096
+ +\[ 8\] .data +.*
+ +\[ 9\] .tdata +PROGBITS +0+120012000 0+2000 0+60 0+ WAT +0 +0 +4
+ +\[10\] .tbss +NOBITS +0+120012060 0+2060 0+40 0+ WAT +0 +0 +1
+ +\[11\] .dynamic +DYNAMIC +0+120012060 0+2060 0+140 10 +WA +4 +0 +8
+ +\[12\] .plt +PROGBITS +0+1200121a0 0+21a0 0+ 0+ WAX +0 +0 +8
+ +\[13\] .got +PROGBITS +0+1200121a0 0+21a0 0+10 0+ +WA +0 +0 +8
+ +\[14\] .sbss +.*
+ +\[15\] .bss +.*
+ +\[16\] .shstrtab +.*
+ +\[17\] .symtab +.*
+ +\[18\] .strtab +.*
+#...
+
+Elf file type is EXEC \(Executable file\)
+Entry point 0x[0-9a-f]+
+There are 6 program headers, starting at offset [0-9]+
+
+Program Headers:
+ +Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg Align
+ +PHDR +0x0+40 0x0+120000040 0x0+120000040 0x0+150 0x0+150 R E 0x8
+ +INTERP +0x0+190 0x0+120000190 0x0+120000190 0x[0-9a-f]+ 0x[0-9a-f]+ R +0x1
+.*Requesting program interpreter.*
+ +LOAD +0x0+ 0x0+120000000 0x0+120000000 0x0+10bc 0x0+10bc R E 0x10000
+ +LOAD +0x0+2000 0x0+120012000 0x0+120012000 0x0+1b0 0x0+1b0 RWE 0x10000
+ +DYNAMIC +0x0+2060 0x0+120012060 0x0+120012060 0x0+140 0x0+140 RW +0x8
+ +TLS +0x0+2000 0x0+120012000 0x0+120012000 0x0+60 0x0+a0 R +0x4
+#...
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
+ +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
+0+1200121a0 +0+200000026 R_ALPHA_TPREL64 +0+ sG2 \+ 0
+0+1200121a8 +0+600000026 R_ALPHA_TPREL64 +0+ sG1 \+ 0
+
+Symbol table '.dynsym' contains 10 entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+ +0: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND
+ +1: 0+120012060 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC
+ +2: 0+ +0 TLS +GLOBAL DEFAULT +UND sG2
+ +3: 0+1200121a0 +0 OBJECT +GLOBAL DEFAULT +ABS _PROCEDURE_LINKAGE_TABLE_
+ +4: 0+ +4 FUNC +GLOBAL DEFAULT +UND __tls_get_addr
+ +5: 0+1200121b0 +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+ +6: 0+ +0 TLS +GLOBAL DEFAULT +UND sG1
+ +7: 0+1200121b0 +0 NOTYPE +GLOBAL DEFAULT +ABS _edata
+ +8: 0+1200121a0 +0 OBJECT +GLOBAL DEFAULT +ABS _GLOBAL_OFFSET_TABLE_
+ +9: 0+1200121b0 +0 NOTYPE +GLOBAL DEFAULT +ABS _end
+
+Symbol table '.symtab' contains 70 entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+ +0: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND
+ +1: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +1
+ +2: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +2
+ +3: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +3
+ +4: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +4
+ +5: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +5
+ +6: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +6
+ +7: 0+120001000 +0 SECTION LOCAL +DEFAULT +7
+ +8: 0+120012000 +0 SECTION LOCAL +DEFAULT +8
+ +9: 0+120012000 +0 SECTION LOCAL +DEFAULT +9
+ +10: 0+120012060 +0 SECTION LOCAL +DEFAULT +10
+ +11: 0+120012060 +0 SECTION LOCAL +DEFAULT +11
+ +12: 0+1200121a0 +0 SECTION LOCAL +DEFAULT +12
+ +13: 0+1200121a0 +0 SECTION LOCAL +DEFAULT +13
+ +14: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +14
+ +15: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +15
+ +16: 0+ +0 SECTION LOCAL +DEFAULT +16
+ +17: 0+ +0 SECTION LOCAL +DEFAULT +17
+ +18: 0+ +0 SECTION LOCAL +DEFAULT +18
+ +19: 0+20 +0 TLS +LOCAL +DEFAULT +9 sl1
+ +20: 0+24 +0 TLS +LOCAL +DEFAULT +9 sl2
+ +21: 0+28 +0 TLS +LOCAL +DEFAULT +9 sl3
+ +22: 0+2c +0 TLS +LOCAL +DEFAULT +9 sl4
+ +23: 0+30 +0 TLS +LOCAL +DEFAULT +9 sl5
+ +24: 0+34 +0 TLS +LOCAL +DEFAULT +9 sl6
+ +25: 0+38 +0 TLS +LOCAL +DEFAULT +9 sl7
+ +26: 0+3c +0 TLS +LOCAL +DEFAULT +9 sl8
+ +27: 0+80 +0 TLS +LOCAL +DEFAULT +10 bl1
+ +28: 0+84 +0 TLS +LOCAL +DEFAULT +10 bl2
+ +29: 0+88 +0 TLS +LOCAL +DEFAULT +10 bl3
+ +30: 0+8c +0 TLS +LOCAL +DEFAULT +10 bl4
+ +31: 0+90 +0 TLS +LOCAL +DEFAULT +10 bl5
+ +32: 0+94 +0 TLS +LOCAL +DEFAULT +10 bl6
+ +33: 0+98 +0 TLS +LOCAL +DEFAULT +10 bl7
+ +34: 0+9c +0 TLS +LOCAL +DEFAULT +10 bl8
+ +35: 0+1c +0 TLS +GLOBAL DEFAULT +9 sg8
+ +36: 0+7c +0 TLS +GLOBAL DEFAULT +10 bg8
+ +37: 0+74 +0 TLS +GLOBAL DEFAULT +10 bg6
+ +38: 0+68 +0 TLS +GLOBAL DEFAULT +10 bg3
+ +39: 0+120012060 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC
+ +40: 0+8 +0 TLS +GLOBAL DEFAULT +9 sg3
+ +41: 0+48 +0 TLS +GLOBAL HIDDEN +9 sh3
+ +42: 0+ +0 TLS +GLOBAL DEFAULT +UND sG2
+ +43: 0+c +0 TLS +GLOBAL DEFAULT +9 sg4
+ +44: 0+10 +0 TLS +GLOBAL DEFAULT +9 sg5
+ +45: 0+1200121a0 +0 OBJECT +GLOBAL DEFAULT +ABS _PROCEDURE_LINKAGE_TABLE_
+ +46: 0+70 +0 TLS +GLOBAL DEFAULT +10 bg5
+ +47: 0+ +4 FUNC +GLOBAL DEFAULT +UND __tls_get_addr
+ +48: 0+58 +0 TLS +GLOBAL HIDDEN +9 sh7
+ +49: 0+5c +0 TLS +GLOBAL HIDDEN +9 sh8
+ +50: 0+ +0 TLS +GLOBAL DEFAULT +9 sg1
+ +51: 0+120001088 +52 FUNC +GLOBAL DEFAULT +7 _start
+ +52: 0+4c +0 TLS +GLOBAL HIDDEN +9 sh4
+ +53: 0+78 +0 TLS +GLOBAL DEFAULT +10 bg7
+ +54: 0+50 +0 TLS +GLOBAL HIDDEN +9 sh5
+ +55: 0+1200121b0 +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+ +56: 0+120001000 +136 FUNC +GLOBAL DEFAULT +7 fn2
+ +57: 0+4 +0 TLS +GLOBAL DEFAULT +9 sg2
+ +58: 0+ +0 TLS +GLOBAL DEFAULT +UND sG1
+ +59: 0+40 +0 TLS +GLOBAL HIDDEN +9 sh1
+ +60: 0+14 +0 TLS +GLOBAL DEFAULT +9 sg6
+ +61: 0+18 +0 TLS +GLOBAL DEFAULT +9 sg7
+ +62: 0+1200121b0 +0 NOTYPE +GLOBAL DEFAULT +ABS _edata
+ +63: 0+1200121a0 +0 OBJECT +GLOBAL DEFAULT +ABS _GLOBAL_OFFSET_TABLE_
+ +64: 0+1200121b0 +0 NOTYPE +GLOBAL DEFAULT +ABS _end
+ +65: 0+44 +0 TLS +GLOBAL HIDDEN +9 sh2
+ +66: 0+54 +0 TLS +GLOBAL HIDDEN +9 sh6
+ +67: 0+64 +0 TLS +GLOBAL DEFAULT +10 bg2
+ +68: 0+60 +0 TLS +GLOBAL DEFAULT +10 bg1
+ +69: 0+6c +0 TLS +GLOBAL DEFAULT +10 bg4
diff --git a/ld/testsuite/ld-alpha/tlsbinr.sd b/ld/testsuite/ld-alpha/tlsbinr.sd
new file mode 100644
index 0000000..0329537
--- /dev/null
+++ b/ld/testsuite/ld-alpha/tlsbinr.sd
@@ -0,0 +1,12 @@
+#source: align.s
+#source: tlsbinpic.s
+#source: tlsbin.s
+#as:
+#ld: -relax -melfalpha
+#objdump: -sj.got
+#target: alpha*-*-*
+
+.*: +file format elf64-alpha
+
+Contents of section .got:
+ 1200121a0 00000000 00000000 00000000 00000000 .*
diff --git a/ld/testsuite/ld-alpha/tlsg.s b/ld/testsuite/ld-alpha/tlsg.s
new file mode 100644
index 0000000..99fb84a
--- /dev/null
+++ b/ld/testsuite/ld-alpha/tlsg.s
@@ -0,0 +1,14 @@
+ .section .tbss,"awT",@nobits
+ .align 4
+ .skip 24
+ .type a,@object
+ .size a,4
+a:
+ .long 0
+ .text
+ .globl _start
+ .ent _start
+_start:
+ .end _start
+ .section .debug_foobar
+ .quad a !dtprel
diff --git a/ld/testsuite/ld-alpha/tlsg.sd b/ld/testsuite/ld-alpha/tlsg.sd
new file mode 100644
index 0000000..c426a99
--- /dev/null
+++ b/ld/testsuite/ld-alpha/tlsg.sd
@@ -0,0 +1,10 @@
+#source: tlsg.s
+#as:
+#ld: -melf64_ia64
+#objdump: -sj.debug_foobar
+#target: ia64-*-*
+
+.*: +file format elf64-ia64-little
+
+Contents of section .debug_foobar:
+ 0+ 18000000 0+ +.*
diff --git a/ld/testsuite/ld-alpha/tlslib.s b/ld/testsuite/ld-alpha/tlslib.s
new file mode 100644
index 0000000..88cdff2
--- /dev/null
+++ b/ld/testsuite/ld-alpha/tlslib.s
@@ -0,0 +1,19 @@
+ .section ".tdata", "awT", @progbits
+ .globl sG1, sG2, sG3, sG4, sG5, sG6, sG7, sG8
+sG1: .long 513
+sG2: .long 514
+sG3: .long 515
+sG4: .long 516
+sG5: .long 517
+sG6: .long 518
+sG7: .long 519
+sG8: .long 520
+
+ .text
+ /* Dummy. */
+ .globl __tls_get_addr
+ .ent __tls_get_addr
+__tls_get_addr:
+ .prologue 0
+ ret
+ .end __tls_get_addr
diff --git a/ld/testsuite/ld-alpha/tlspic.dd b/ld/testsuite/ld-alpha/tlspic.dd
new file mode 100644
index 0000000..0af92f9
--- /dev/null
+++ b/ld/testsuite/ld-alpha/tlspic.dd
@@ -0,0 +1,56 @@
+#source: align.s
+#source: tlspic1.s
+#source: tlspic2.s
+#as:
+#ld: -shared -melf64alpha
+#objdump: -drj.text
+#target: alpha*-*-*
+
+.*: +file format elf64-alpha
+
+Disassembly of section .text:
+
+0+1000 <fn1>:
+ 1000: 02 00 bb 27 ldah gp,2\(t12\)
+ 1004: c0 91 bd 23 lda gp,-28224\(gp\)
+ 1008: 3e 15 c2 43 subq sp,0x10,sp
+ 100c: 00 00 5e b7 stq ra,0\(sp\)
+ 1010: 08 00 3e b5 stq s0,8\(sp\)
+ 1014: 9e 00 00 00 rduniq
+ 1018: 09 04 e0 47 mov v0,s0
+ 101c: 08 80 1d 22 lda a0,-32760\(gp\)
+ 1020: 00 80 7d a7 ldq t12,-32768\(gp\)
+ 1024: 00 40 5b 6b jsr ra,\(t12\),1028 <.*>
+ 1028: 02 00 ba 27 ldah gp,2\(ra\)
+ 102c: 98 91 bd 23 lda gp,-28264\(gp\)
+ 1030: 30 80 1d 22 lda a0,-32720\(gp\)
+ 1034: 00 80 7d a7 ldq t12,-32768\(gp\)
+ 1038: 00 40 5b 6b jsr ra,\(t12\),103c <.*>
+ 103c: 02 00 ba 27 ldah gp,2\(ra\)
+ 1040: 84 91 bd 23 lda gp,-28284\(gp\)
+ 1044: 40 80 1d 22 lda a0,-32704\(gp\)
+ 1048: 00 80 7d a7 ldq t12,-32768\(gp\)
+ 104c: 00 40 5b 6b jsr ra,\(t12\),1050 <.*>
+ 1050: 02 00 ba 27 ldah gp,2\(ra\)
+ 1054: 70 91 bd 23 lda gp,-28304\(gp\)
+ 1058: 21 00 20 20 lda t0,33\(v0\)
+ 105c: 40 80 1d 22 lda a0,-32704\(gp\)
+ 1060: 00 80 7d a7 ldq t12,-32768\(gp\)
+ 1064: 00 40 5b 6b jsr ra,\(t12\),1068 <.*>
+ 1068: 02 00 ba 27 ldah gp,2\(ra\)
+ 106c: 58 91 bd 23 lda gp,-28328\(gp\)
+ 1070: 40 00 20 20 lda t0,64\(v0\)
+ 1074: 62 00 20 20 lda t0,98\(v0\)
+ 1078: 00 00 20 24 ldah t0,0\(v0\)
+ 107c: 53 00 21 20 lda t0,83\(t0\)
+ 1080: 18 80 3d a4 ldq t0,-32744\(gp\)
+ 1084: 01 04 20 40 addq t0,v0,t0
+ 1088: 20 80 3d a4 ldq t0,-32736\(gp\)
+ 108c: 01 04 29 40 addq t0,s0,t0
+ 1090: 50 80 3d a4 ldq t0,-32688\(gp\)
+ 1094: 28 80 5d a4 ldq t1,-32728\(gp\)
+ 1098: 01 04 29 40 addq t0,s0,t0
+ 109c: 02 04 49 40 addq t1,s0,t1
+ 10a0: 00 00 5e a7 ldq ra,0\(sp\)
+ 10a4: 1e 14 c2 43 addq sp,0x10,sp
+ 10a8: 01 80 fa 6b ret
diff --git a/ld/testsuite/ld-alpha/tlspic.rd b/ld/testsuite/ld-alpha/tlspic.rd
new file mode 100644
index 0000000..d0250dd
--- /dev/null
+++ b/ld/testsuite/ld-alpha/tlspic.rd
@@ -0,0 +1,152 @@
+#source: align.s
+#source: tlspic1.s
+#source: tlspic2.s
+#as:
+#ld: -shared -melf64alpha
+#readelf: -WSsrl
+#target: alpha*-*-*
+
+There are 18 section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Address +Off +Size +ES Flg Lk Inf Al
+ +\[ 0\] +NULL +0+ 0+ 0+ 0+ +0 +0 +0
+ +\[ 1\] .hash +.*
+ +\[ 2\] .dynsym +.*
+ +\[ 3\] .dynstr +.*
+ +\[ 4\] .rela.dyn +.*
+ +\[ 5\] .rela.plt +.*
+ +\[ 6\] .text +PROGBITS +0+1000 0+1000 0+ac 0+ +AX +0 +0 4096
+ +\[ 7\] .data +.*
+ +\[ 8\] .tdata +PROGBITS +0+12000 0+2000 0+60 0+ WAT +0 +0 +4
+ +\[ 9\] .tbss +NOBITS +0+12060 0+2060 0+20 0+ WAT +0 +0 +1
+ +\[10\] .dynamic +DYNAMIC +0+12060 0+2060 0+130 10 +WA +3 +0 +8
+ +\[11\] .plt +.*
+ +\[12\] .got +PROGBITS +0+121c0 0+21c0 0+58 0+ +WA +0 +0 +8
+ +\[13\] .sbss +.*
+ +\[14\] .bss +.*
+ +\[15\] .shstrtab +.*
+ +\[16\] .symtab +.*
+ +\[17\] .strtab +.*
+#...
+
+Elf file type is DYN \(Shared object file\)
+Entry point 0x1000
+There are 4 program headers, starting at offset [0-9a-f]+
+
+Program Headers:
+ +Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg Align
+ +LOAD +0x0+ 0x0+ 0x0+ 0x0+10ac 0x0+10ac R E 0x10000
+ +LOAD +0x0+2000 0x0+12000 0x0+12000 0x0+218 0x0+218 RWE 0x10000
+ +DYNAMIC +0x0+2060 0x0+12060 0x0+12060 0x0+130 0x0+130 RW +0x8
+ +TLS +0x0+2000 0x0+12000 0x0+12000 0x0+60 0x0+80 R +0x4
+#...
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 7 entries:
+ +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
+0+121c8 +0+160000001f R_ALPHA_DTPMOD64 +0+ sg1 \+ 0
+0+121d0 +0+1600000021 R_ALPHA_DTPREL64 +0+ sg1 \+ 0
+0+121e0 +0+1900000026 R_ALPHA_TPREL64 +0+4 sg2 \+ 0
+0+121e8 +0+26 R_ALPHA_TPREL64 +0+44
+0+121f0 +0+1f R_ALPHA_DTPMOD64 +0+
+0+12200 +0+1f R_ALPHA_DTPMOD64 +0+
+0+12210 +0+26 R_ALPHA_TPREL64 +0+24
+
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entries:
+ +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
+0+121c0 +0+150000001a R_ALPHA_JMP_SLOT +0+ __tls_get_addr \+ 0
+
+Symbol table '.dynsym' contains 31 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 0+ 0 NOTYPE LOCAL DEFAULT UND
+ 1: 0+120 0 SECTION LOCAL DEFAULT 1
+ 2: 0+2b0 0 SECTION LOCAL DEFAULT 2
+ 3: 0+598 0 SECTION LOCAL DEFAULT 3
+ 4: 0+620 0 SECTION LOCAL DEFAULT 4
+ 5: 0+6c8 0 SECTION LOCAL DEFAULT 5
+ 6: 0+1000 0 SECTION LOCAL DEFAULT 6
+ 7: 0+12000 0 SECTION LOCAL DEFAULT 7
+ 8: 0+12000 0 SECTION LOCAL DEFAULT 8
+ 9: 0+12060 0 SECTION LOCAL DEFAULT 9
+ 10: 0+12060 0 SECTION LOCAL DEFAULT 10
+ 11: 0+12190 0 SECTION LOCAL DEFAULT 11
+ 12: 0+121c0 0 SECTION LOCAL DEFAULT 12
+ 13: 0+12218 0 SECTION LOCAL DEFAULT 13
+ 14: 0+12218 0 SECTION LOCAL DEFAULT 14
+ 15: 0+1c 0 TLS GLOBAL DEFAULT 8 sg8
+ 16: 0+12060 0 OBJECT GLOBAL DEFAULT ABS _DYNAMIC
+ 17: 0+8 0 TLS GLOBAL DEFAULT 8 sg3
+ 18: 0+c 0 TLS GLOBAL DEFAULT 8 sg4
+ 19: 0+10 0 TLS GLOBAL DEFAULT 8 sg5
+ 20: 0+12190 0 OBJECT GLOBAL DEFAULT ABS _PROCEDURE_LINKAGE_TABLE_
+ 21: 0+ 0 NOTYPE GLOBAL DEFAULT UND __tls_get_addr
+ 22: 0+ 0 TLS GLOBAL DEFAULT 8 sg1
+ 23: 0+1000 172 FUNC GLOBAL DEFAULT 6 fn1
+ 24: 0+12218 0 NOTYPE GLOBAL DEFAULT ABS __bss_start
+ 25: 0+4 0 TLS GLOBAL DEFAULT 8 sg2
+ 26: 0+14 0 TLS GLOBAL DEFAULT 8 sg6
+ 27: 0+18 0 TLS GLOBAL DEFAULT 8 sg7
+ 28: 0+12218 0 NOTYPE GLOBAL DEFAULT ABS _edata
+ 29: 0+121c0 0 OBJECT GLOBAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
+ 30: 0+12218 0 NOTYPE GLOBAL DEFAULT ABS _end
+
+Symbol table '.symtab' contains 58 entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+ +0: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND
+ +1: 0+[0-9a-f]+ +0 SECTION LOCAL +DEFAULT +1
+ +2: 0+[0-9a-f]+ +0 SECTION LOCAL +DEFAULT +2
+ +3: 0+[0-9a-f]+ +0 SECTION LOCAL +DEFAULT +3
+ +4: 0+[0-9a-f]+ +0 SECTION LOCAL +DEFAULT +4
+ +5: 0+[0-9a-f]+ +0 SECTION LOCAL +DEFAULT +5
+ +6: 0+1000 +0 SECTION LOCAL +DEFAULT +6
+ +7: 0+12000 +0 SECTION LOCAL +DEFAULT +7
+ +8: 0+12000 +0 SECTION LOCAL +DEFAULT +8
+ +9: 0+12060 +0 SECTION LOCAL +DEFAULT +9
+ +10: 0+12060 +0 SECTION LOCAL +DEFAULT +10
+ +11: 0+12190 +0 SECTION LOCAL +DEFAULT +11
+ +12: 0+121c0 +0 SECTION LOCAL +DEFAULT +12
+ +13: 0+[0-9a-f]+ +0 SECTION LOCAL +DEFAULT +13
+ +14: 0+[0-9a-f]+ +0 SECTION LOCAL +DEFAULT +14
+ +15: 0+ +0 SECTION LOCAL +DEFAULT +15
+ +16: 0+ +0 SECTION LOCAL +DEFAULT +16
+ +17: 0+ +0 SECTION LOCAL +DEFAULT +17
+ +18: 0+20 +0 TLS +LOCAL +DEFAULT +8 sl1
+ +19: 0+24 +0 TLS +LOCAL +DEFAULT +8 sl2
+ +20: 0+28 +0 TLS +LOCAL +DEFAULT +8 sl3
+ +21: 0+2c +0 TLS +LOCAL +DEFAULT +8 sl4
+ +22: 0+30 +0 TLS +LOCAL +DEFAULT +8 sl5
+ +23: 0+34 +0 TLS +LOCAL +DEFAULT +8 sl6
+ +24: 0+38 +0 TLS +LOCAL +DEFAULT +8 sl7
+ +25: 0+3c +0 TLS +LOCAL +DEFAULT +8 sl8
+ +26: 0+60 +0 TLS +LOCAL +HIDDEN +9 sH1
+ +27: 0+48 +0 TLS +LOCAL +HIDDEN +8 sh3
+ +28: 0+64 +0 TLS +LOCAL +HIDDEN +9 sH2
+ +29: 0+78 +0 TLS +LOCAL +HIDDEN +9 sH7
+ +30: 0+58 +0 TLS +LOCAL +HIDDEN +8 sh7
+ +31: 0+5c +0 TLS +LOCAL +HIDDEN +8 sh8
+ +32: 0+6c +0 TLS +LOCAL +HIDDEN +9 sH4
+ +33: 0+4c +0 TLS +LOCAL +HIDDEN +8 sh4
+ +34: 0+68 +0 TLS +LOCAL +HIDDEN +9 sH3
+ +35: 0+50 +0 TLS +LOCAL +HIDDEN +8 sh5
+ +36: 0+70 +0 TLS +LOCAL +HIDDEN +9 sH5
+ +37: 0+74 +0 TLS +LOCAL +HIDDEN +9 sH6
+ +38: 0+7c +0 TLS +LOCAL +HIDDEN +9 sH8
+ +39: 0+40 +0 TLS +LOCAL +HIDDEN +8 sh1
+ +40: 0+44 +0 TLS +LOCAL +HIDDEN +8 sh2
+ +41: 0+54 +0 TLS +LOCAL +HIDDEN +8 sh6
+ +42: 0+1c +0 TLS +GLOBAL DEFAULT +8 sg8
+ +43: 0+12060 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC
+ +44: 0+8 +0 TLS +GLOBAL DEFAULT +8 sg3
+ +45: 0+c +0 TLS +GLOBAL DEFAULT +8 sg4
+ +46: 0+10 +0 TLS +GLOBAL DEFAULT +8 sg5
+ +47: 0+12190 +0 OBJECT +GLOBAL DEFAULT +ABS _PROCEDURE_LINKAGE_TABLE_
+ +48: 0+ +0 NOTYPE +GLOBAL DEFAULT +UND __tls_get_addr
+ +49: 0+ +0 TLS +GLOBAL DEFAULT +8 sg1
+ +50: 0+1000 +172 FUNC +GLOBAL DEFAULT +6 fn1
+ +51: 0+[0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+ +52: 0+4 +0 TLS +GLOBAL DEFAULT +8 sg2
+ +53: 0+14 +0 TLS +GLOBAL DEFAULT +8 sg6
+ +54: 0+18 +0 TLS +GLOBAL DEFAULT +8 sg7
+ +55: 0+[0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS _edata
+ +56: 0+121c0 +0 OBJECT +GLOBAL DEFAULT +ABS _GLOBAL_OFFSET_TABLE_
+ +57: 0+[0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS _end
diff --git a/ld/testsuite/ld-alpha/tlspic.sd b/ld/testsuite/ld-alpha/tlspic.sd
new file mode 100644
index 0000000..23a0857
--- /dev/null
+++ b/ld/testsuite/ld-alpha/tlspic.sd
@@ -0,0 +1,17 @@
+#source: align.s
+#source: tlspic1.s
+#source: tlspic2.s
+#as:
+#ld: -shared -melf64alpha
+#objdump: -sj.got
+#target: alpha*-*-*
+
+.*: +file format elf64-alpha
+
+Contents of section .got:
+ 121c0 b0210100 00000000 00000000 00000000 .*
+ 121d0 00000000 00000000 71000000 00000000 .*
+ 121e0 00000000 00000000 00000000 00000000 .*
+ 121f0 00000000 00000000 44000000 00000000 .*
+ 12200 00000000 00000000 00000000 00000000 .*
+ 12210 00000000 00000000 .*
diff --git a/ld/testsuite/ld-alpha/tlspic.td b/ld/testsuite/ld-alpha/tlspic.td
new file mode 100644
index 0000000..5c97568
--- /dev/null
+++ b/ld/testsuite/ld-alpha/tlspic.td
@@ -0,0 +1,17 @@
+#source: align.s
+#source: tlspic1.s
+#source: tlspic2.s
+#as:
+#ld: -shared -melf64alpha
+#objdump: -sj.tdata
+#target: alpha*-*-*
+
+.*: +file format elf64-alpha
+
+Contents of section .tdata:
+ 12000 11000000 12000000 13000000 14000000 .*
+ 12010 15000000 16000000 17000000 18000000 .*
+ 12020 41000000 42000000 43000000 44000000 .*
+ 12030 45000000 46000000 47000000 48000000 .*
+ 12040 01010000 02010000 03010000 04010000 .*
+ 12050 05010000 06010000 07010000 08010000 .*
diff --git a/ld/testsuite/ld-alpha/tlspic1.s b/ld/testsuite/ld-alpha/tlspic1.s
new file mode 100644
index 0000000..822f36d
--- /dev/null
+++ b/ld/testsuite/ld-alpha/tlspic1.s
@@ -0,0 +1,87 @@
+ .section ".tdata", "awT", @progbits
+ .globl sg1, sg2, sg3, sg4, sg5, sg6, sg7, sg8
+ .globl sh1, sh2, sh3, sh4, sh5, sh6, sh7, sh8
+ .hidden sh1, sh2, sh3, sh4, sh5, sh6, sh7, sh8
+sg1: .long 17
+sg2: .long 18
+sg3: .long 19
+sg4: .long 20
+sg5: .long 21
+sg6: .long 22
+sg7: .long 23
+sg8: .long 24
+sl1: .long 65
+sl2: .long 66
+sl3: .long 67
+sl4: .long 68
+sl5: .long 69
+sl6: .long 70
+sl7: .long 71
+sl8: .long 72
+sh1: .long 257
+sh2: .long 258
+sh3: .long 259
+sh4: .long 260
+sh5: .long 261
+sh6: .long 262
+sh7: .long 263
+sh8: .long 264
+ .text
+ .globl fn1
+ .ent fn1
+fn1:
+ .frame $sp, 16, $26, 0
+ ldgp $gp, 0($27)
+ subq $sp, 16, $sp
+ stq $26, 0($sp)
+ stq $9, 8($sp)
+ .prologue 1
+
+ rduniq
+ mov $0, $9
+
+ /* GD */
+ lda $16, sg1($gp) !tlsgd!1
+ ldq $27, __tls_get_addr($gp) !literal!1
+ jsr $26, ($27), __tls_get_addr !lituse_tlsgd!1
+ ldgp $gp, 0($26)
+
+ /* GD against hidden symbol */
+ lda $16, sh2($gp) !tlsgd!2
+ ldq $27, __tls_get_addr($gp) !literal!2
+ jsr $26, ($27), __tls_get_addr !lituse_tlsgd!2
+ ldgp $gp, 0($26)
+
+ /* LD */
+ lda $16, sl1($gp) !tlsldm!3
+ ldq $27, __tls_get_addr($gp) !literal!3
+ jsr $26, ($27), __tls_get_addr !lituse_tlsldm!3
+ ldgp $gp, 0($26)
+ lda $1, sl1+1($0) !dtprel
+
+ /* LD with 4 variables */
+ lda $16, sh1($gp) !tlsldm!4
+ ldq $27, __tls_get_addr($gp) !literal!4
+ jsr $26, ($27), __tls_get_addr !lituse_tlsldm!4
+ ldgp $gp, 0($26)
+ lda $1, sh1($0) !dtprel
+ lda $1, sH1+2($0) !dtprel
+ ldah $1, sh5+3($0) !dtprelhi
+ lda $1, sh5+3($1) !dtprello
+ ldq $1, sH5+1($gp) !gotdtprel
+ addq $1, $0, $1
+
+ /* IE against global */
+ ldq $1, sg2($gp) !gottprel
+ addq $1, $9, $1
+
+ /* IE against local and hidden */
+ ldq $1, sl2($gp) !gottprel
+ ldq $2, sh2($gp) !gottprel
+ addq $1, $9, $1
+ addq $2, $9, $2
+
+ ldq $26, 0($sp)
+ addq $sp, 16, $sp
+ ret
+ .end fn1
diff --git a/ld/testsuite/ld-alpha/tlspic2.s b/ld/testsuite/ld-alpha/tlspic2.s
new file mode 100644
index 0000000..5513f9b
--- /dev/null
+++ b/ld/testsuite/ld-alpha/tlspic2.s
@@ -0,0 +1,11 @@
+ .section ".tbss", "awT", @nobits
+ .globl sH1, sH2, sH3, sH4, sH5, sH6, sH7, sH8
+ .hidden sH1, sH2, sH3, sH4, sH5, sH6, sH7, sH8
+sH1: .space 4
+sH2: .space 4
+sH3: .space 4
+sH4: .space 4
+sH5: .space 4
+sH6: .space 4
+sH7: .space 4
+sH8: .space 4