summaryrefslogtreecommitdiffstats
path: root/binutils-2.21/ld/testsuite/ld-x86-64
diff options
context:
space:
mode:
Diffstat (limited to 'binutils-2.21/ld/testsuite/ld-x86-64')
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/abs-l1om.d11
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/abs.d10
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/compressed1.d9
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/compressed1.s176
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/discarded1.d3
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/discarded1.s13
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/discarded1.t7
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/dwarfreloc.exp86
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/dwarfreloc.rd17
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/dwarfreloc1.s101
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/dwarfreloc2.s94
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/hidden1.d3
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/hidden1.s9
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/hidden2.d13
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/hidden2.s9
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/hidden3.d3
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/hidden3.s8
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/line.exp57
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/mixed1a.s6
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/mixed1b.s10
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/mixed2a.s7
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/mixed2b.s7
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/nogot1.d8
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/nogot1.s10
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/nogot2.d7
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/nogot2.s4
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/pcrel16.d15
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/pcrel8.d4
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/protected1.d3
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/protected1.s13
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/protected2-l1om.d17
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/protected2.d16
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/protected2.s13
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/protected3-l1om.d16
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/protected3.d13
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/protected3.s15
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/split-by-file.rd17
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/split-by-file1.s7
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/split-by-file2.s6
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsbin.dd310
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsbin.rd147
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsbin.s97
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsbin.sd12
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsbin.td16
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsbindesc.dd301
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsbindesc.rd138
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsbindesc.s128
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsbindesc.sd12
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsbindesc.td16
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsbinpic.s146
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.dd200
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.pd20
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.rd160
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.s157
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.sd23
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.td16
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsg.s12
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsg.sd10
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsgd1.dd14
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsgd1.s15
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsgd2.d4
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsgd2.s5
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsgd3.d4
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsgd3.s11
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsgdesc.dd163
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsgdesc.rd104
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsgdesc.s106
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsie1.dd16
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsie1.s14
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsie2.d4
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsie2.s12
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsie3.d4
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsie3.s12
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsld1.dd13
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsld1.s12
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsle1.d6
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlsle1.s11
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlslib.s18
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlspic.dd230
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlspic.rd144
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlspic.sd19
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlspic.td16
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlspic1.s187
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlspic2.s11
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlspie1.d6
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/tlspie1.s58
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/undefined.s154
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/unique1.d10
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/unique1.s9
-rw-r--r--binutils-2.21/ld/testsuite/ld-x86-64/x86-64.exp143
90 files changed, 4299 insertions, 0 deletions
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/abs-l1om.d b/binutils-2.21/ld/testsuite/ld-x86-64/abs-l1om.d
new file mode 100644
index 0000000..1b2231c
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/abs-l1om.d
@@ -0,0 +1,11 @@
+#name: Absolute non-overflowing relocs
+#source: ../ld-i386/abs.s
+#source: ../ld-i386/zero.s
+#as: --64 -march=l1om
+#ld: -m elf_l1om
+#objdump: -rs -j .text
+
+.*: file format .*
+
+Contents of section \.text:
+[ ][0-9a-f]+ c800fff0 c8000110 c9c3.*
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/abs.d b/binutils-2.21/ld/testsuite/ld-x86-64/abs.d
new file mode 100644
index 0000000..b24b018
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/abs.d
@@ -0,0 +1,10 @@
+#name: Absolute non-overflowing relocs
+#source: ../ld-i386/abs.s
+#source: ../ld-i386/zero.s
+#ld:
+#objdump: -rs
+
+.*: file format .*
+
+Contents of section \.text:
+[ ][0-9a-f]+ c800fff0 c8000110 c9c3.*
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/compressed1.d b/binutils-2.21/ld/testsuite/ld-x86-64/compressed1.d
new file mode 100644
index 0000000..1dd0f4c
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/compressed1.d
@@ -0,0 +1,9 @@
+#name: undefined symbol with compressed debug sections
+#as: --64
+#ld: -e foo -melf_x86_64 --noinhibit-exec
+#warning: .*/compressed1.c:13: undefined reference to .bar.
+#nm: -n
+
+#...
+[ \t]+U bar
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/compressed1.s b/binutils-2.21/ld/testsuite/ld-x86-64/compressed1.s
new file mode 100644
index 0000000..196bc88
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/compressed1.s
@@ -0,0 +1,176 @@
+ .file "compressed1.c"
+ .section .debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+ .section .debug_info,"",@progbits
+.Ldebug_info0:
+ .section .debug_line,"",@progbits
+.Ldebug_line0:
+ .text
+.Ltext0:
+ .cfi_sections .debug_frame
+ .p2align 4,,15
+.globl foo
+ .type foo, @function
+foo:
+.LFB0:
+ .file 1 "compressed1.c"
+ .loc 1 12 0
+ .cfi_startproc
+ .loc 1 13 0
+ jmp bar
+ .cfi_endproc
+.LFE0:
+ .size foo, .-foo
+.Letext0:
+ .section .debug_info
+ .long 0x6e
+ .value 0x3
+ .long .Ldebug_abbrev0
+ .byte 0x8
+ .uleb128 0x1
+ .long .LASF5
+ .byte 0x1
+ .long .LASF6
+ .long .LASF7
+ .quad .Ltext0
+ .quad .Letext0
+ .long .Ldebug_line0
+ .uleb128 0x2
+ .byte 0x1
+ .byte 0x6
+ .long .LASF0
+ .uleb128 0x2
+ .byte 0x2
+ .byte 0x5
+ .long .LASF1
+ .uleb128 0x3
+ .byte 0x4
+ .byte 0x5
+ .string "int"
+ .uleb128 0x2
+ .byte 0x8
+ .byte 0x5
+ .long .LASF2
+ .uleb128 0x2
+ .byte 0x1
+ .byte 0x8
+ .long .LASF3
+ .uleb128 0x2
+ .byte 0x2
+ .byte 0x7
+ .long .LASF4
+ .uleb128 0x4
+ .byte 0x1
+ .string "foo"
+ .byte 0x1
+ .byte 0xb
+ .quad .LFB0
+ .quad .LFE0
+ .byte 0x1
+ .byte 0x9c
+ .byte 0x0
+ .section .debug_abbrev
+ .uleb128 0x1
+ .uleb128 0x11
+ .byte 0x1
+ .uleb128 0x25
+ .uleb128 0xe
+ .uleb128 0x13
+ .uleb128 0xb
+ .uleb128 0x3
+ .uleb128 0xe
+ .uleb128 0x1b
+ .uleb128 0xe
+ .uleb128 0x11
+ .uleb128 0x1
+ .uleb128 0x12
+ .uleb128 0x1
+ .uleb128 0x10
+ .uleb128 0x6
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x2
+ .uleb128 0x24
+ .byte 0x0
+ .uleb128 0xb
+ .uleb128 0xb
+ .uleb128 0x3e
+ .uleb128 0xb
+ .uleb128 0x3
+ .uleb128 0xe
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x3
+ .uleb128 0x24
+ .byte 0x0
+ .uleb128 0xb
+ .uleb128 0xb
+ .uleb128 0x3e
+ .uleb128 0xb
+ .uleb128 0x3
+ .uleb128 0x8
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x4
+ .uleb128 0x2e
+ .byte 0x0
+ .uleb128 0x3f
+ .uleb128 0xc
+ .uleb128 0x3
+ .uleb128 0x8
+ .uleb128 0x3a
+ .uleb128 0xb
+ .uleb128 0x3b
+ .uleb128 0xb
+ .uleb128 0x11
+ .uleb128 0x1
+ .uleb128 0x12
+ .uleb128 0x1
+ .uleb128 0x40
+ .uleb128 0xa
+ .byte 0x0
+ .byte 0x0
+ .byte 0x0
+ .section .debug_pubnames,"",@progbits
+ .long 0x16
+ .value 0x2
+ .long .Ldebug_info0
+ .long 0x72
+ .long 0x57
+ .string "foo"
+ .long 0x0
+ .section .debug_pubtypes,"",@progbits
+ .long 0xe
+ .value 0x2
+ .long .Ldebug_info0
+ .long 0x72
+ .long 0x0
+ .section .debug_aranges,"",@progbits
+ .long 0x2c
+ .value 0x2
+ .long .Ldebug_info0
+ .byte 0x8
+ .byte 0x0
+ .value 0x0
+ .value 0x0
+ .quad .Ltext0
+ .quad .Letext0-.Ltext0
+ .quad 0x0
+ .quad 0x0
+ .section .debug_str,"MS",@progbits,1
+.LASF0:
+ .string "signed char"
+.LASF1:
+ .string "short int"
+.LASF6:
+ .string "compressed1.c"
+.LASF5:
+ .string "GNU C 4.4.4"
+.LASF7:
+ .string "."
+.LASF3:
+ .string "unsigned char"
+.LASF2:
+ .string "long int"
+.LASF4:
+ .string "short unsigned int"
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/discarded1.d b/binutils-2.21/ld/testsuite/ld-x86-64/discarded1.d
new file mode 100644
index 0000000..c892595
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/discarded1.d
@@ -0,0 +1,3 @@
+#as: --64
+#ld: -melf_x86_64 -T discarded1.t
+#error: .*discarded output section: `.got.plt'
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/discarded1.s b/binutils-2.21/ld/testsuite/ld-x86-64/discarded1.s
new file mode 100644
index 0000000..c638ed9
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/discarded1.s
@@ -0,0 +1,13 @@
+ .text
+.globl _start
+ .type _start, @function
+_start:
+ movq x@GOTPCREL(%rip), %rax
+ .size _start, .-_start
+.globl x
+ .data
+ .align 4
+ .type x, @object
+ .size x, 4
+x:
+ .long 2
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/discarded1.t b/binutils-2.21/ld/testsuite/ld-x86-64/discarded1.t
new file mode 100644
index 0000000..a4d617f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/discarded1.t
@@ -0,0 +1,7 @@
+ENTRY(_start)
+SECTIONS
+{
+ .text : {*(.text)}
+ .data : {*(.data)}
+ /DISCARD/ : {*(*)}
+}
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/dwarfreloc.exp b/binutils-2.21/ld/testsuite/ld-x86-64/dwarfreloc.exp
new file mode 100644
index 0000000..8137a3d
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/dwarfreloc.exp
@@ -0,0 +1,86 @@
+# Expect script for DWARF relocation test.
+# Copyright 2008 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program 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 3 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., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+#
+# Written by Jan Kratochvil (jan.kratochvil@redhat.com)
+#
+# Test PR ld/3290 Comment 8+9. DW_FORM_ref_addr used in dwarfreloc2.s was left
+# unrelocated as its target symbol from dwarfreloc1.s became LOCAL due to its
+# `ld -r'.
+#
+# <1><57>: Abbrev Number: 2 (DW_TAG_variable)
+# <58> DW_AT_name : i2
+# ...
+# <5d> DW_AT_type : <0x32>
+# vs.
+# <5d> DW_AT_type : <0x0>
+
+# Only the testcase .s files are arch-dependent, the relocations are cross-arch.
+if { !([istarget "x86_64-*-elf*"]
+ || [istarget "x86_64-*-linux*"]) } {
+ return
+}
+
+set build_tests_ld {
+ {"Build dwarfreloc1x.o"
+ "-r" ""
+ {dwarfreloc1.s} {} "dwarfreloc1x.o"}
+ {"Build dwarfreloc2.o"
+ "-r" ""
+ {dwarfreloc2.s} {} "dwarfreloc2x.o"}
+}
+
+run_ld_link_tests $build_tests_ld
+
+set testname "Link dwarfreloc1x.o and dwarfreloc2x.o to dwarfreloc.o"
+if [ld_simple_link $ld "tmpdir/dwarfreloc.o" "-r tmpdir/dwarfreloc1x.o tmpdir/dwarfreloc2x.o"] {
+ pass $testname
+} else {
+ fail $testname
+}
+
+# The code is copied from `ld-lib.exp'. We cannot use the functions there as
+# they expect source (.s or .c) files while we to check a `ld -r' output (.o).
+
+set testname "Check dwarfreloc.o readelf"
+set dumpfile "dwarfreloc.rd"
+set cmd "$READELF --debug-dump=info tmpdir/dwarfreloc.o"
+set status [remote_exec host [concat sh -c [list "$cmd >dump.out 2>ld.stderr"]] "" "/dev/null"]
+send_log "$cmd\n"
+remote_upload host "ld.stderr"
+set comp_output [prune_warnings [file_contents "ld.stderr"]]
+remote_file host delete "ld.stderr"
+remote_file build delete "ld.stderr"
+
+if ![string match "" $comp_output] then {
+ send_log "$comp_output\n"
+ fail $testname
+} else {
+ remote_upload host "dump.out"
+ if { [regexp_diff "dump.out" "$srcdir/$subdir/$dumpfile"] } then {
+ verbose "output is [file_contents "dump.out"]" 2
+ fail $testname
+ } else {
+ pass $testname
+ }
+ remote_file build delete "dump.out"
+ remote_file host delete "dump.out"
+}
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/dwarfreloc.rd b/binutils-2.21/ld/testsuite/ld-x86-64/dwarfreloc.rd
new file mode 100644
index 0000000..84798ce
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/dwarfreloc.rd
@@ -0,0 +1,17 @@
+# Parenthesized `(...)' is the offset we cross-check.
+# The third parenthesized value was left unrelocated (0x0) before.
+#...
+.*Abbrev Number: .* \(DW_TAG_variable\).*
+#...
+.*DW_AT_type *: *<0x(32)>.*
+#...
+.*<(32)>: Abbrev Number: .* \(DW_TAG_base_type\).*
+#...
+.*Compilation Unit.*
+#...
+.*Abbrev Number: .* \(DW_TAG_compile_unit\).*
+#...
+.*Abbrev Number: .* \(DW_TAG_variable\).*
+#...
+.*DW_AT_type : <0x(32)>.*
+#...
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/dwarfreloc1.s b/binutils-2.21/ld/testsuite/ld-x86-64/dwarfreloc1.s
new file mode 100644
index 0000000..2f46ae2
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/dwarfreloc1.s
@@ -0,0 +1,101 @@
+ .file 1 "dwarfreloc1.c"
+ .comm i1,4,4
+ .section .debug_line,"",@progbits
+.Ldebug_line0:
+ .section .debug_info
+.Ldebug_info0:
+ .long .Ldebug_info_end - .Ldebug_info_start
+.Ldebug_info_start:
+ .value 0x2
+ .long .Ldebug_abbrev0
+ .byte 0x8
+
+ .uleb128 0x1 /* DW_TAG_compile_unit */
+ .long .LASF0 /* DW_AT_producer */
+ .byte 0x1 /* DW_AT_language */
+ .long .LASF1 /* DW_AT_name */
+ .long .LASF2 /* DW_AT_comp_dir */
+ .long .Ldebug_line0 /* DW_AT_stmt_list */
+
+ .uleb128 0x2 /* DW_TAG_variable */
+ .string "i1" /* DW_AT_name */
+ .byte 0x1 /* DW_AT_decl_file */
+ .byte 0x1 /* DW_AT_decl_line */
+ .long .dwarfreloc1.0.2 - .Ldebug_info0 /* DW_AT_type (DW_FORM_ref4) */
+ .byte 0x1 /* DW_AT_external */
+ .byte 0x9 /* DW_AT_location: length */
+ .byte 0x3 /* DW_AT_location: DW_OP_addr */
+ .quad i1 /* DW_AT_location: DW_OP_addr: address */
+
+ /* DWARF3 Page 224 (236/267)
+ <prefix>.<file-designator>.<gid-number>.<die-number> */
+ .globl .dwarfreloc1.0.2
+.dwarfreloc1.0.2:
+ .uleb128 0x3 /* DW_TAG_base_type */
+ .byte 0x4 /* DW_AT_byte_size */
+ .byte 0x5 /* DW_AT_encoding */
+ .string "int" /* DW_AT_name */
+
+ .byte 0x0
+.Ldebug_info_end:
+
+ .section .debug_abbrev
+.Ldebug_abbrev0:
+ .uleb128 0x1
+ .uleb128 0x11
+
+ .byte 0x1
+ .uleb128 0x25 /* DW_AT_producer */
+ .uleb128 0xe /* DW_FORM_strp */
+ .uleb128 0x13 /* DW_AT_language */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0xe /* DW_FORM_strp */
+ .uleb128 0x1b /* DW_AT_comp_dir */
+ .uleb128 0xe /* DW_FORM_strp */
+ .uleb128 0x10 /* DW_AT_stmt_list */
+ .uleb128 0x6 /* DW_FORM_data4 */
+ .byte 0x0
+ .byte 0x0
+
+ .uleb128 0x2
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0x0
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x3a /* DW_AT_decl_file */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x3b /* DW_AT_decl_line */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x3f /* DW_AT_external */
+ .uleb128 0xc /* DW_FORM_flag */
+ .uleb128 0x2 /* DW_AT_location */
+ .uleb128 0xa /* DW_FORM_block1 */
+ .byte 0x0
+ .byte 0x0
+
+ .uleb128 0x3
+ .uleb128 0x24 /* DW_TAG_base_type */
+ .byte 0x0
+ .uleb128 0xb /* DW_AT_byte_size */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x3e /* DW_AT_encoding */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .byte 0x0
+ .byte 0x0
+
+ .byte 0x0
+
+ .section .debug_str,"MS",@progbits,1
+.LASF1:
+ .string "dwarfreloc1.c"
+.LASF0:
+ .string "GNU C 4.3.1 20080801 (Red Hat 4.3.1-6)"
+.LASF2:
+ .string "/"
+ .ident "GCC: (GNU) 4.3.1 20080801 (Red Hat 4.3.1-6)"
+ .section .note.GNU-stack,"",@progbits
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/dwarfreloc2.s b/binutils-2.21/ld/testsuite/ld-x86-64/dwarfreloc2.s
new file mode 100644
index 0000000..dee3b87
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/dwarfreloc2.s
@@ -0,0 +1,94 @@
+ .file 1 "dwarfreloc2.c"
+ .comm i2,4,4
+ .section .debug_line,"",@progbits
+.Ldebug_line0:
+ .section .debug_info
+.Ldebug_info0:
+ .long .Ldebug_info_end - .Ldebug_info_start
+.Ldebug_info_start:
+ .value 0x2
+ .long .Ldebug_abbrev0
+ .byte 0x8
+
+ .uleb128 0x1 /* DW_TAG_compile_unit */
+ .long .LASF0 /* DW_AT_producer */
+ .byte 0x1 /* DW_AT_language */
+ .long .LASF1 /* DW_AT_name */
+ .long .LASF2 /* DW_AT_comp_dir */
+ .long .Ldebug_line0 /* DW_AT_stmt_list */
+
+ .uleb128 0x2 /* DW_TAG_variable */
+ .string "i2" /* DW_AT_name */
+ .byte 0x1 /* DW_AT_decl_file */
+ .byte 0x1 /* DW_AT_decl_line */
+ /* DWARF3 Page 224 (236/267)
+ <prefix>.<file-designator>.<gid-number>.<die-number> */
+ .quad .dwarfreloc1.0.2 /* DW_AT_type (DW_FORM_ref_addr) */
+ .byte 0x1 /* DW_AT_external */
+ .byte 0x9 /* DW_AT_location: length */
+ .byte 0x3 /* DW_AT_location: DW_OP_addr */
+ .quad i2 /* DW_AT_location: DW_OP_addr: address */
+
+ .byte 0x0
+.Ldebug_info_end:
+
+ .section .debug_abbrev
+.Ldebug_abbrev0:
+ .uleb128 0x1
+ .uleb128 0x11
+
+ .byte 0x1
+ .uleb128 0x25 /* DW_AT_producer */
+ .uleb128 0xe /* DW_FORM_strp */
+ .uleb128 0x13 /* DW_AT_language */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0xe /* DW_FORM_strp */
+ .uleb128 0x1b /* DW_AT_comp_dir */
+ .uleb128 0xe /* DW_FORM_strp */
+ .uleb128 0x10 /* DW_AT_stmt_list */
+ .uleb128 0x6 /* DW_FORM_data4 */
+ .byte 0x0
+ .byte 0x0
+
+ .uleb128 0x2
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0x0
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x3a /* DW_AT_decl_file */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x3b /* DW_AT_decl_line */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x10 /* DW_FORM_ref_addr */
+ .uleb128 0x3f /* DW_AT_external */
+ .uleb128 0xc /* DW_FORM_flag */
+ .uleb128 0x2 /* DW_AT_location */
+ .uleb128 0xa /* DW_FORM_block1 */
+ .byte 0x0
+ .byte 0x0
+
+ .uleb128 0x3
+ .uleb128 0x24 /* DW_TAG_base_type */
+ .byte 0x0
+ .uleb128 0xb /* DW_AT_byte_size */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x3e /* DW_AT_encoding */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .byte 0x0
+ .byte 0x0
+
+ .byte 0x0
+
+ .section .debug_str,"MS",@progbits,1
+.LASF1:
+ .string "dwarfreloc2.c"
+.LASF0:
+ .string "GNU C 4.3.1 20080801 (Red Hat 4.3.1-6)"
+.LASF2:
+ .string "/"
+ .ident "GCC: (GNU) 4.3.1 20080801 (Red Hat 4.3.1-6)"
+ .section .note.GNU-stack,"",@progbits
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/hidden1.d b/binutils-2.21/ld/testsuite/ld-x86-64/hidden1.d
new file mode 100644
index 0000000..c4c843b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/hidden1.d
@@ -0,0 +1,3 @@
+#as: --64
+#ld: -shared -melf_x86_64
+#error: .*relocation R_X86_64_PC32 against undefined hidden symbol `foo' can not be used when making a shared object
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/hidden1.s b/binutils-2.21/ld/testsuite/ld-x86-64/hidden1.s
new file mode 100644
index 0000000..ba7f88b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/hidden1.s
@@ -0,0 +1,9 @@
+ .text
+.globl bar
+ .type bar, @function
+bar:
+ leaq foo(%rip), %rax
+ ret
+ .size bar, .-bar
+ .weak foo
+ .hidden foo
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/hidden2.d b/binutils-2.21/ld/testsuite/ld-x86-64/hidden2.d
new file mode 100644
index 0000000..9a29f9a
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/hidden2.d
@@ -0,0 +1,13 @@
+#as: --64
+#ld: -shared -melf_x86_64
+#objdump: -drw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <bar>:
+[ ]*[a-f0-9]+: e8 33 fe ff ff callq 0 .*
+[ ]*[a-f0-9]+: c3 retq
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/hidden2.s b/binutils-2.21/ld/testsuite/ld-x86-64/hidden2.s
new file mode 100644
index 0000000..03e2ce7
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/hidden2.s
@@ -0,0 +1,9 @@
+ .text
+.globl bar
+ .type bar, @function
+bar:
+ call foo
+ ret
+ .size bar, .-bar
+ .weak foo
+ .hidden foo
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/hidden3.d b/binutils-2.21/ld/testsuite/ld-x86-64/hidden3.d
new file mode 100644
index 0000000..c4c843b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/hidden3.d
@@ -0,0 +1,3 @@
+#as: --64
+#ld: -shared -melf_x86_64
+#error: .*relocation R_X86_64_PC32 against undefined hidden symbol `foo' can not be used when making a shared object
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/hidden3.s b/binutils-2.21/ld/testsuite/ld-x86-64/hidden3.s
new file mode 100644
index 0000000..75482aa
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/hidden3.s
@@ -0,0 +1,8 @@
+ .text
+.globl bar
+ .type bar, @function
+bar:
+ leaq foo(%rip), %rax
+ ret
+ .size bar, .-bar
+ .hidden foo
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/line.exp b/binutils-2.21/ld/testsuite/ld-x86-64/line.exp
new file mode 100644
index 0000000..c68daaa
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/line.exp
@@ -0,0 +1,57 @@
+# Test that the linker reports undefined symbol line number correctly.
+#
+# Copyright 2007 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program 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 3 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., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+if { !([istarget "x86_64-*-elf*"]
+ || [istarget "x86_64-*-linux*"]) } {
+ return
+}
+
+set testline "undefined line"
+
+if ![ld_assemble $as "--64 $srcdir/$subdir/undefined.s" tmpdir/undefined.o] {
+ verbose "Unable to assemble test file!" 1
+ unresolved $testline
+ return
+}
+
+remote_file host delete "tmpdir/undefined"
+
+# Using -e start prevents the SunOS linker from trying to build a
+# shared library.
+send_log "$ld -e start -melf_x86_64 -o tmpdir/undefined tmpdir/undefined.o\n"
+set exec_output [run_host_cmd "$ld" "-e start -melf_x86_64 -o tmpdir/undefined tmpdir/undefined.o"]
+
+send_log "$exec_output\n"
+verbose "$exec_output"
+
+proc checkund { string testname } {
+ global exec_output
+
+ if [string match "*$string*" $exec_output] {
+ pass $testname
+ } else {
+ fail $testname
+ }
+}
+
+set ml "undefined.c:9: undefined reference to `*this_function_is_not_defined'"
+
+checkund $ml $testline
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/mixed1a.s b/binutils-2.21/ld/testsuite/ld-x86-64/mixed1a.s
new file mode 100644
index 0000000..07e0ae8
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/mixed1a.s
@@ -0,0 +1,6 @@
+ .text
+.globl _start
+ .type _start, @function
+_start:
+ cmpq $0, foo(%rip)
+ .size _start, .-_start
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/mixed1b.s b/binutils-2.21/ld/testsuite/ld-x86-64/mixed1b.s
new file mode 100644
index 0000000..66bb38f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/mixed1b.s
@@ -0,0 +1,10 @@
+.globl foo
+ .section .rodata.str1.1,"aMS",@progbits,1
+.LC0:
+ .string "Hello"
+ .data
+ .align 4
+ .type foo, @object
+ .size foo, 4
+foo:
+ .long .LC0
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/mixed2a.s b/binutils-2.21/ld/testsuite/ld-x86-64/mixed2a.s
new file mode 100644
index 0000000..a597bb3
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/mixed2a.s
@@ -0,0 +1,7 @@
+ .text
+ .p2align 4,,15
+.globl _start
+ .type _start, @function
+_start:
+ movl foo(%rip), %eax
+ .size _start, .-_start
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/mixed2b.s b/binutils-2.21/ld/testsuite/ld-x86-64/mixed2b.s
new file mode 100644
index 0000000..3cac801
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/mixed2b.s
@@ -0,0 +1,7 @@
+.globl foo
+ .data
+ .align 4
+ .type foo, @object
+ .size foo, 4
+foo:
+ .long 1
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/nogot1.d b/binutils-2.21/ld/testsuite/ld-x86-64/nogot1.d
new file mode 100644
index 0000000..f6c4cf1
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/nogot1.d
@@ -0,0 +1,8 @@
+#ld: --shared -melf_x86_64
+#readelf: -S --wide
+#as: --64
+
+#...
+[ ]*\[.*\][ ]+\.dynamic[ ]+DYNAMIC.*
+[ ]*\[.*\][ ]+.*STRTAB.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/nogot1.s b/binutils-2.21/ld/testsuite/ld-x86-64/nogot1.s
new file mode 100644
index 0000000..d884f6f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/nogot1.s
@@ -0,0 +1,10 @@
+ .type bar, @function
+bar:
+ ret
+ .size bar, .-bar
+.globl foo
+ .type foo, @function
+foo:
+ leaq bar(%rip), %rax
+ ret
+ .size foo, .-foo
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/nogot2.d b/binutils-2.21/ld/testsuite/ld-x86-64/nogot2.d
new file mode 100644
index 0000000..c6123c5
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/nogot2.d
@@ -0,0 +1,7 @@
+#ld: -pie -melf_x86_64
+#readelf: -S --wide
+#as: --64
+
+#...
+[ ]*\[.*\][ ]+.*\.got\.plt.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/nogot2.s b/binutils-2.21/ld/testsuite/ld-x86-64/nogot2.s
new file mode 100644
index 0000000..530e909
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/nogot2.s
@@ -0,0 +1,4 @@
+ .text
+ .globl _start
+_start:
+ movq _GLOBAL_OFFSET_TABLE_(%rip), %rcx
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/pcrel16.d b/binutils-2.21/ld/testsuite/ld-x86-64/pcrel16.d
new file mode 100644
index 0000000..f593657
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/pcrel16.d
@@ -0,0 +1,15 @@
+#name: PCREL16 overflow
+#source: ../ld-i386/pcrel16.s
+#ld: -Ttext 0x0
+#objdump: -drj.text -m i8086
+
+.*: +file format elf64-x86-64
+
+Disassembly of section .text:
+
+0+ <_start>:
+ ...
+ 420: cd 42[ ]+int \$0x42
+ 422: ca 02 00[ ]+lret \$0x2
+ ...
+ f065: e9 b8 13[ ]+jmp 420 <_start\+0x420>
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/pcrel8.d b/binutils-2.21/ld/testsuite/ld-x86-64/pcrel8.d
new file mode 100644
index 0000000..17a3bba
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/pcrel8.d
@@ -0,0 +1,4 @@
+#name: PCREL8 overflow
+#source: ../ld-i386/pcrel8.s
+#ld:
+#error: .*relocation truncated to fit: R_X86_64_PC8 .*
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/protected1.d b/binutils-2.21/ld/testsuite/ld-x86-64/protected1.d
new file mode 100644
index 0000000..783b85a
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/protected1.d
@@ -0,0 +1,3 @@
+#as: --64
+#ld: -shared -melf_x86_64
+#error: .*relocation R_X86_64_PC32 against protected symbol `foo' can not be used when making a shared object
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/protected1.s b/binutils-2.21/ld/testsuite/ld-x86-64/protected1.s
new file mode 100644
index 0000000..31368aa
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/protected1.s
@@ -0,0 +1,13 @@
+ .text
+.globl foo
+ .protected foo
+ .type foo, @function
+foo:
+ ret
+ .size foo, .-foo
+.globl bar
+ .type bar, @function
+bar:
+ leaq foo(%rip), %rax
+ ret
+ .size bar, .-bar
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/protected2-l1om.d b/binutils-2.21/ld/testsuite/ld-x86-64/protected2-l1om.d
new file mode 100644
index 0000000..32311a2
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/protected2-l1om.d
@@ -0,0 +1,17 @@
+#source: protected2.s
+#as: --64 -march=l1om
+#ld: -shared -melf_l1om
+#objdump: -drw --insn-width=7
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+[a-f0-9]+ <foo>:
+[ ]*[a-f0-9]+: c3 retq
+
+0+[a-f0-9]+ <bar>:
+[ ]*[a-f0-9]+: e8 fa ff ff ff callq [a-f0-9]+ <foo>
+[ ]*[a-f0-9]+: c3 retq
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/protected2.d b/binutils-2.21/ld/testsuite/ld-x86-64/protected2.d
new file mode 100644
index 0000000..2e91b17
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/protected2.d
@@ -0,0 +1,16 @@
+#as: --64
+#ld: -shared -melf_x86_64
+#objdump: -drw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+[a-f0-9]+ <foo>:
+[ ]*[a-f0-9]+: c3 retq
+
+0+[a-f0-9]+ <bar>:
+[ ]*[a-f0-9]+: e8 fa ff ff ff callq [a-f0-9]+ <foo>
+[ ]*[a-f0-9]+: c3 retq
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/protected2.s b/binutils-2.21/ld/testsuite/ld-x86-64/protected2.s
new file mode 100644
index 0000000..61e5aec
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/protected2.s
@@ -0,0 +1,13 @@
+ .text
+.globl foo
+ .protected foo
+ .type foo, @function
+foo:
+ ret
+ .size foo, .-foo
+.globl bar
+ .type bar, @function
+bar:
+ call foo
+ ret
+ .size bar, .-bar
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/protected3-l1om.d b/binutils-2.21/ld/testsuite/ld-x86-64/protected3-l1om.d
new file mode 100644
index 0000000..701d4e1
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/protected3-l1om.d
@@ -0,0 +1,16 @@
+#source: protected3.s
+#as: --64 -march=l1om
+#ld: -shared -melf_l1om
+#readelf: -h
+
+ELF Header:
+ Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
+ Class: ELF64
+ Data: 2's complement, little endian
+ Version: 1 \(current\)
+ OS/ABI: UNIX - System V
+ ABI Version: 0
+ Type: DYN \(Shared object file\)
+ Machine: Intel L1OM
+ Version: 0x1
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/protected3.d b/binutils-2.21/ld/testsuite/ld-x86-64/protected3.d
new file mode 100644
index 0000000..897c1cf
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/protected3.d
@@ -0,0 +1,13 @@
+#as: --64
+#ld: -shared -melf_x86_64
+#objdump: -drw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+[a-f0-9]+ <bar>:
+[ ]*[a-f0-9]+: 8b 05 [a-f0-9][a-f0-9] 00 [a-f0-9][a-f0-9] 00 mov 0x[a-f0-9]+\(%rip\),%eax # [a-f0-9]+ <foo>
+[ ]*[a-f0-9]+: c3 retq
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/protected3.s b/binutils-2.21/ld/testsuite/ld-x86-64/protected3.s
new file mode 100644
index 0000000..e4af6e7
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/protected3.s
@@ -0,0 +1,15 @@
+ .protected foo
+.globl foo
+ .data
+ .align 4
+ .type foo, @object
+ .size foo, 4
+foo:
+ .long 1
+ .text
+.globl bar
+ .type bar, @function
+bar:
+ movl foo(%rip), %eax
+ ret
+ .size bar, .-bar
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/split-by-file.rd b/binutils-2.21/ld/testsuite/ld-x86-64/split-by-file.rd
new file mode 100644
index 0000000..7c63aaa
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/split-by-file.rd
@@ -0,0 +1,17 @@
+There are 9 section headers, starting at offset 0x80:
+
+Section Headers:
+ \[Nr\] Name Type Address Off Size ES Flg Lk Inf Al
+ \[ 0\] NULL 0000000000000000 000000 000000 00 0 0 0
+ \[ 1\] .text PROGBITS 0000000000000000 000040 000000 00 AX 0 0 4
+ \[ 2\] .foo PROGBITS 0000000000000000 000040 000003 00 AXl 0 0 1
+ \[ 3\] .data PROGBITS 0000000000000000 000044 000000 00 WA 0 0 4
+ \[ 4\] .bss NOBITS 0000000000000000 000044 000000 00 WA 0 0 4
+ \[ 5\] .foo.0 PROGBITS 0000000000000003 000044 000003 00 AXl 0 0 1
+ \[ 6\] .shstrtab STRTAB 0000000000000000 000047 000038 00 0 0 1
+ \[ 7\] .symtab SYMTAB 0000000000000000 0002c0 0000d8 18 8 6 8
+ \[ 8\] .strtab STRTAB 0000000000000000 000398 000016 00 0 0 1
+Key to Flags:
+ W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\), l \(large\)
+ I \(info\), L \(link order\), G \(group\), T \(TLS\), E \(exclude\), x \(unknown\)
+ O \(extra OS processing required\) o \(OS specific\), p \(processor specific\)
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/split-by-file1.s b/binutils-2.21/ld/testsuite/ld-x86-64/split-by-file1.s
new file mode 100644
index 0000000..81458c0
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/split-by-file1.s
@@ -0,0 +1,7 @@
+ .section ".foo", "axl"
+ .global label1
+label1:
+ nop
+ nop
+ nop
+
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/split-by-file2.s b/binutils-2.21/ld/testsuite/ld-x86-64/split-by-file2.s
new file mode 100644
index 0000000..3e25623
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/split-by-file2.s
@@ -0,0 +1,6 @@
+ .section ".foo", "axl"
+ .global label2
+label2:
+ nop
+ nop
+ nop
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsbin.dd b/binutils-2.21/ld/testsuite/ld-x86-64/tlsbin.dd
new file mode 100644
index 0000000..6d0de98
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsbin.dd
@@ -0,0 +1,310 @@
+#source: tlsbinpic.s
+#source: tlsbin.s
+#as: --64
+#ld: -shared -melf_x86_64
+#objdump: -drj.text
+#target: x86_64-*-*
+
+# PT_TLS layout is:
+# Offset from Offset from Name
+# TCB base TCB end
+# 0x00 -0xa0 sg1..sg8
+# 0x20 -0x80 sl1..sl8
+# 0x40 -0x60 sh1..sh8
+# 0x60 -0x40 bg1..bg8
+# 0x80 -0x20 bl1..bl8
+
+.*: +file format elf64-x86-64
+
+Disassembly of section .text:
+
+0+401000 <fn2>:
+ 401000: 55[ ]+push %rbp
+ 401001: 48 89 e5[ ]+mov %rsp,%rbp
+# GD -> IE because variable is not defined in executable
+ 401004: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
+ 40100b: 00 00 *
+ 40100d: 48 03 05 d4 03 20 00[ ]+add 0x2003d4\(%rip\),%rax +# 6013e8 <.*>
+# -> R_X86_64_TPOFF64 sG1
+ 401014: 90[ ]+nop *
+ 401015: 90[ ]+nop *
+ 401016: 90[ ]+nop *
+ 401017: 90[ ]+nop *
+# GD -> IE because variable is not defined in executable where
+# the variable is referenced through IE too
+ 401018: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
+ 40101f: 00 00 *
+ 401021: 48 03 05 b0 03 20 00[ ]+add 0x2003b0\(%rip\),%rax +# 6013d8 <.*>
+# -> R_X86_64_TPOFF64 sG2
+ 401028: 90[ ]+nop *
+ 401029: 90[ ]+nop *
+ 40102a: 90[ ]+nop *
+ 40102b: 90[ ]+nop *
+# GD -> LE with global variable defined in executable
+ 40102c: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
+ 401033: 00 00 *
+ 401035: 48 8d 80 60 ff ff ff[ ]+lea -0xa0\(%rax\),%rax
+# sg1
+ 40103c: 90[ ]+nop *
+ 40103d: 90[ ]+nop *
+ 40103e: 90[ ]+nop *
+ 40103f: 90[ ]+nop *
+# GD -> LE with local variable defined in executable
+ 401040: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
+ 401047: 00 00 *
+ 401049: 48 8d 80 80 ff ff ff[ ]+lea -0x80\(%rax\),%rax
+# sl1
+ 401050: 90[ ]+nop *
+ 401051: 90[ ]+nop *
+ 401052: 90[ ]+nop *
+ 401053: 90[ ]+nop *
+# GD -> LE with hidden variable defined in executable
+ 401054: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
+ 40105b: 00 00 *
+ 40105d: 48 8d 80 a0 ff ff ff[ ]+lea -0x60\(%rax\),%rax
+# sh1
+ 401064: 90[ ]+nop *
+ 401065: 90[ ]+nop *
+ 401066: 90[ ]+nop *
+ 401067: 90[ ]+nop *
+# LD -> LE
+ 401068: 66 66 66 64 48 8b 04[ ]+data32 data32 data32 mov %fs:0x0,%rax
+ 40106f: 25 00 00 00 00 *
+ 401074: 90[ ]+nop *
+ 401075: 90[ ]+nop *
+ 401076: 48 8d 90 81 ff ff ff[ ]+lea -0x7f\(%rax\),%rdx
+# sl1+1
+ 40107d: 90[ ]+nop *
+ 40107e: 90[ ]+nop *
+ 40107f: 4c 8d 88 86 ff ff ff[ ]+lea -0x7a\(%rax\),%r9
+# sl2+2
+ 401086: 90[ ]+nop *
+ 401087: 90[ ]+nop *
+ 401088: 90[ ]+nop *
+ 401089: 90[ ]+nop *
+# LD -> LE against hidden variables
+ 40108a: 66 66 66 64 48 8b 04[ ]+data32 data32 data32 mov %fs:0x0,%rax
+ 401091: 25 00 00 00 00 *
+ 401096: 90[ ]+nop *
+ 401097: 90[ ]+nop *
+ 401098: 48 8d 90 a0 ff ff ff[ ]+lea -0x60\(%rax\),%rdx
+# sh1
+ 40109f: 90[ ]+nop *
+ 4010a0: 90[ ]+nop *
+ 4010a1: 48 8d 88 a7 ff ff ff[ ]+lea -0x59\(%rax\),%rcx
+# sh2+3
+ 4010a8: 90[ ]+nop *
+ 4010a9: 90[ ]+nop *
+ 4010aa: 90[ ]+nop *
+ 4010ab: 90[ ]+nop *
+# IE against global var
+ 4010ac: 64 4c 8b 0c 25 00 00[ ]+mov %fs:0x0,%r9
+ 4010b3: 00 00 *
+ 4010b5: 90[ ]+nop *
+ 4010b6: 90[ ]+nop *
+ 4010b7: 4c 03 0d 1a 03 20 00[ ]+add 0x20031a\(%rip\),%r9 +# 6013d8 <.*>
+# -> R_X86_64_TPOFF64 sG2
+ 4010be: 90[ ]+nop *
+ 4010bf: 90[ ]+nop *
+ 4010c0: 90[ ]+nop *
+ 4010c1: 90[ ]+nop *
+# IE -> LE against global var defined in exec
+ 4010c2: 64 4c 8b 14 25 00 00[ ]+mov %fs:0x0,%r10
+ 4010c9: 00 00 *
+ 4010cb: 90[ ]+nop *
+ 4010cc: 90[ ]+nop *
+ 4010cd: 4d 8d 92 60 ff ff ff[ ]+lea -0xa0\(%r10\),%r10
+# sg1
+ 4010d4: 90[ ]+nop *
+ 4010d5: 90[ ]+nop *
+ 4010d6: 90[ ]+nop *
+ 4010d7: 90[ ]+nop *
+# IE -> LE against local var
+ 4010d8: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
+ 4010df: 00 00 *
+ 4010e1: 90[ ]+nop *
+ 4010e2: 90[ ]+nop *
+ 4010e3: 48 8d 80 80 ff ff ff[ ]+lea -0x80\(%rax\),%rax
+# sl1
+ 4010ea: 90[ ]+nop *
+ 4010eb: 90[ ]+nop *
+ 4010ec: 90[ ]+nop *
+ 4010ed: 90[ ]+nop *
+# IE -> LE against hidden var
+ 4010ee: 64 48 8b 0c 25 00 00[ ]+mov %fs:0x0,%rcx
+ 4010f5: 00 00 *
+ 4010f7: 90[ ]+nop *
+ 4010f8: 90[ ]+nop *
+ 4010f9: 48 8d 89 a0 ff ff ff[ ]+lea -0x60\(%rcx\),%rcx
+# sh1
+ 401100: 90[ ]+nop *
+ 401101: 90[ ]+nop *
+ 401102: 90[ ]+nop *
+ 401103: 90[ ]+nop *
+# Direct access through %fs
+# IE against global var
+ 401104: 48 8b 0d c5 02 20 00[ ]+mov 0x2002c5\(%rip\),%rcx +# 6013d0 <.*>
+# -> R_X86_64_TPOFF64 sG5
+ 40110b: 90[ ]+nop *
+ 40110c: 90[ ]+nop *
+ 40110d: 64 48 8b 11[ ]+mov %fs:\(%rcx\),%rdx
+ 401111: 90[ ]+nop *
+ 401112: 90[ ]+nop *
+ 401113: 90[ ]+nop *
+ 401114: 90[ ]+nop *
+# IE->LE against local var
+ 401115: 49 c7 c3 90 ff ff ff[ ]+mov \$0xf+90,%r11
+# sl5
+ 40111c: 90[ ]+nop *
+ 40111d: 90[ ]+nop *
+ 40111e: 64 4d 8b 23[ ]+mov %fs:\(%r11\),%r12
+ 401122: 90[ ]+nop *
+ 401123: 90[ ]+nop *
+ 401124: 90[ ]+nop *
+ 401125: 90[ ]+nop *
+# IE->LE against hidden var
+ 401126: 48 c7 c2 b0 ff ff ff[ ]+mov \$0xf+b0,%rdx
+ 40112d: 90[ ]+nop *
+ 40112e: 90[ ]+nop *
+ 40112f: 64 48 8b 12[ ]+mov %fs:\(%rdx\),%rdx
+# sh5
+ 401133: 90[ ]+nop *
+ 401134: 90[ ]+nop *
+ 401135: 90[ ]+nop *
+ 401136: 90[ ]+nop *
+ 401137: c9[ ]+leaveq *
+ 401138: c3[ ]+retq *
+ 401139: 90[ ]+nop *
+ 40113a: 90[ ]+nop *
+ 40113b: 90[ ]+nop *
+
+0+40113c <_start>:
+ 40113c: 55[ ]+push %rbp
+ 40113d: 48 89 e5[ ]+mov %rsp,%rbp
+# IE against global var
+ 401140: 64 4c 8b 1c 25 00 00[ ]+mov %fs:0x0,%r11
+ 401147: 00 00 *
+ 401149: 90[ ]+nop *
+ 40114a: 90[ ]+nop *
+ 40114b: 4c 03 1d 8e 02 20 00[ ]+add 0x20028e\(%rip\),%r11 +# 6013e0 <.*>
+# -> R_X86_64_TPOFF64 sG6
+ 401152: 90[ ]+nop *
+ 401153: 90[ ]+nop *
+ 401154: 90[ ]+nop *
+ 401155: 90[ ]+nop *
+# IE -> LE against global var defined in exec
+ 401156: 64 48 8b 14 25 00 00[ ]+mov %fs:0x0,%rdx
+ 40115d: 00 00 *
+ 40115f: 90[ ]+nop *
+ 401160: 90[ ]+nop *
+ 401161: 48 8d 92 d4 ff ff ff[ ]+lea -0x2c\(%rdx\),%rdx
+# bg6
+ 401168: 90[ ]+nop *
+ 401169: 90[ ]+nop *
+ 40116a: 90[ ]+nop *
+ 40116b: 90[ ]+nop *
+# IE -> LE against local var
+ 40116c: 64 4c 8b 24 25 00 00[ ]+mov %fs:0x0,%r12
+ 401173: 00 00 *
+ 401175: 90[ ]+nop *
+ 401176: 90[ ]+nop *
+ 401177: 49 81 c4 f4 ff ff ff[ ]+add \$0xf+f4,%r12
+# bl6
+ 40117e: 90[ ]+nop *
+ 40117f: 90[ ]+nop *
+ 401180: 90[ ]+nop *
+ 401181: 90[ ]+nop *
+# direct %fs access IE -> LE against local var
+ 401182: 48 c7 c2 fc ff ff ff[ ]+mov \$0xf+fc,%rdx
+# bl8
+ 401189: 90[ ]+nop *
+ 40118a: 90[ ]+nop *
+ 40118b: 64 48 8b 02[ ]+mov %fs:\(%rdx\),%rax
+ 40118f: 90[ ]+nop *
+ 401190: 90[ ]+nop *
+ 401191: 90[ ]+nop *
+ 401192: 90[ ]+nop *
+# IE -> LE against hidden but not local var
+ 401193: 64 48 8b 14 25 00 00[ ]+mov %fs:0x0,%rdx
+ 40119a: 00 00 *
+ 40119c: 90[ ]+nop *
+ 40119d: 90[ ]+nop *
+ 40119e: 48 8d 92 b4 ff ff ff[ ]+lea -0x4c\(%rdx\),%rdx
+# sh6
+ 4011a5: 90[ ]+nop *
+ 4011a6: 90[ ]+nop *
+ 4011a7: 90[ ]+nop *
+ 4011a8: 90[ ]+nop *
+# direct %fs access IE -> LE against hidden but not local var
+ 4011a9: 48 c7 c2 bc ff ff ff[ ]+mov \$0xf+bc,%rdx
+# sh8
+ 4011b0: 90[ ]+nop *
+ 4011b1: 90[ ]+nop *
+ 4011b2: 64 48 8b 02[ ]+mov %fs:\(%rdx\),%rax
+ 4011b6: 90[ ]+nop *
+ 4011b7: 90[ ]+nop *
+ 4011b8: 90[ ]+nop *
+ 4011b9: 90[ ]+nop *
+# LE, global var defined in exec
+ 4011ba: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
+ 4011c1: 00 00 *
+ 4011c3: 90[ ]+nop *
+ 4011c4: 90[ ]+nop *
+ 4011c5: 48 8d 90 64 ff ff ff[ ]+lea -0x9c\(%rax\),%rdx
+# sg2
+ 4011cc: 90[ ]+nop *
+ 4011cd: 90[ ]+nop *
+ 4011ce: 90[ ]+nop *
+ 4011cf: 90[ ]+nop *
+# LE, local var, non-canonical sequence
+ 4011d0: 49 c7 c1 e6 ff ff ff[ ]+mov \$0xf+e6,%r9
+# bl2+2
+ 4011d7: 90[ ]+nop *
+ 4011d8: 90[ ]+nop *
+ 4011d9: 64 48 8b 14 25 00 00[ ]+mov %fs:0x0,%rdx
+ 4011e0: 00 00 *
+ 4011e2: 90[ ]+nop *
+ 4011e3: 90[ ]+nop *
+ 4011e4: 4c 01 ca[ ]+add %r9,%rdx
+ 4011e7: 90[ ]+nop *
+ 4011e8: 90[ ]+nop *
+ 4011e9: 90[ ]+nop *
+ 4011ea: 90[ ]+nop *
+# LE, hidden var defined in exec, non-canonical sequence
+ 4011eb: 64 48 8b 14 25 00 00[ ]+mov %fs:0x0,%rdx
+ 4011f2: 00 00 *
+ 4011f4: 90[ ]+nop *
+ 4011f5: 90[ ]+nop *
+ 4011f6: 48 81 c2 a5 ff ff ff[ ]+add \$0xf+a5,%rdx
+# sh2+1
+ 4011fd: 90[ ]+nop *
+ 4011fe: 90[ ]+nop *
+ 4011ff: 90[ ]+nop *
+ 401200: 90[ ]+nop *
+# Direct %fs access
+# LE, global var defined in exec
+ 401201: 64 48 8b 04 25 68 ff[ ]+mov %fs:0xf+68,%rax
+ 401208: ff ff *
+# sg3
+ 40120a: 90[ ]+nop *
+ 40120b: 90[ ]+nop *
+ 40120c: 90[ ]+nop *
+ 40120d: 90[ ]+nop *
+# LE, local var
+ 40120e: 64 4c 8b 14 25 eb ff[ ]+mov %fs:0xf+eb,%r10
+ 401215: ff ff *
+# bl3+3
+ 401217: 90[ ]+nop *
+ 401218: 90[ ]+nop *
+ 401219: 90[ ]+nop *
+ 40121a: 90[ ]+nop *
+# LE, hidden var defined in exec
+ 40121b: 64 48 8b 14 25 a9 ff[ ]+mov %fs:0xf+a9,%rdx
+ 401222: ff ff *
+# sh3+1
+ 401224: 90[ ]+nop *
+ 401225: 90[ ]+nop *
+ 401226: 90[ ]+nop *
+ 401227: 90[ ]+nop *
+ 401228: c9[ ]+leaveq *
+ 401229: c3[ ]+retq *
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsbin.rd b/binutils-2.21/ld/testsuite/ld-x86-64/tlsbin.rd
new file mode 100644
index 0000000..03e5efc
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsbin.rd
@@ -0,0 +1,147 @@
+#source: tlsbinpic.s
+#source: tlsbin.s
+#as: --64
+#ld: -shared -melf_x86_64
+#readelf: -WSsrl
+#target: x86_64-*-*
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Address +Off +Size +ES Flg Lk Inf Al
+ +\[[ 0-9]+\] +NULL +0+ 0+ 0+ 00 +0 +0 +0
+ +\[[ 0-9]+\] .interp +.*
+ +\[[ 0-9]+\] .hash +.*
+ +\[[ 0-9]+\] .dynsym +.*
+ +\[[ 0-9]+\] .dynstr +.*
+ +\[[ 0-9]+\] .rela.dyn +.*
+ +\[[ 0-9]+\] .rela.plt +.*
+ +\[[ 0-9]+\] .plt +.*
+ +\[[ 0-9]+\] .text +PROGBITS +0+401000 0+1000 0+22a 00 +AX +0 +0 +4096
+ +\[[ 0-9]+\] .tdata +PROGBITS +0+60122a 0+122a 0+60 00 WAT +0 +0 +1
+ +\[[ 0-9]+\] .tbss +NOBITS +0+60128a 0+128a 0+40 00 WAT +0 +0 +1
+ +\[[ 0-9]+\] .dynamic +DYNAMIC +0+601290 0+1290 0+140 10 +WA +4 +0 +8
+ +\[[ 0-9]+\] .got +PROGBITS +0+6013d0 0+13d0 0+20 08 +WA +0 +0 +8
+ +\[[ 0-9]+\] .got.plt +PROGBITS +0+6013f0 0+13f0 0+20 08 +WA +0 +0 +8
+ +\[[ 0-9]+\] .shstrtab +.*
+ +\[[ 0-9]+\] .symtab +.*
+ +\[[ 0-9]+\] .strtab +.*
+Key to Flags:
+.*
+.*
+.*
+
+Elf file type is EXEC \(Executable file\)
+Entry point 0x40113c
+There are [0-9]+ program headers, starting at offset [0-9]+
+
+Program Headers:
+ +Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg Align
+ +PHDR.*
+ +INTERP.*
+.*Requesting program interpreter.*
+ +LOAD +0x0+ 0x0+400000 0x0+400000 0x0+122a 0x0+122a R E 0x200000
+ +LOAD +0x0+122a 0x0+60122a 0x0+60122a 0x0+1e6 0x0+1e6 RW +0x200000
+ +DYNAMIC +0x0+1290 0x0+601290 0x0+601290 0x0+140 0x0+140 RW +0x8
+ +TLS +0x0+122a 0x0+60122a 0x0+60122a 0x0+60 0x0+a0 R +0x1
+
+ Section to Segment mapping:
+ +Segment Sections...
+ +00 *
+ +01 +.interp *
+ +02 +.interp .hash .dynsym .dynstr .rela.dyn .rela.plt .plt .text *
+ +03 +.tdata .dynamic .got .got.plt *
+ +04 +.dynamic *
+ +05 +.tdata .tbss *
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 4 entries:
+ +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
+[0-9a-f ]+R_X86_64_TPOFF64 +0+ sG5 \+ 0
+[0-9a-f ]+R_X86_64_TPOFF64 +0+ sG2 \+ 0
+[0-9a-f ]+R_X86_64_TPOFF64 +0+ sG6 \+ 0
+[0-9a-f ]+R_X86_64_TPOFF64 +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-9a-f ]+R_X86_64_JUMP_SLOT[0-9a-f ]+__tls_get_addr \+ 0
+
+Symbol table '\.dynsym' contains [0-9]+ entries:
+ +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+.* NOTYPE +LOCAL +DEFAULT +UND *
+.* TLS +GLOBAL +DEFAULT +UND sG5
+.* TLS +GLOBAL +DEFAULT +UND sG2
+.* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr
+.* NOTYPE +GLOBAL +DEFAULT +ABS __bss_start
+.* TLS +GLOBAL +DEFAULT +UND sG6
+.* TLS +GLOBAL +DEFAULT +UND sG1
+.* NOTYPE +GLOBAL +DEFAULT +ABS _edata
+.* NOTYPE +GLOBAL +DEFAULT +ABS _end
+
+Symbol table '\.symtab' contains [0-9]+ entries:
+ +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+.* NOTYPE +LOCAL +DEFAULT +UND *
+.* SECTION +LOCAL +DEFAULT +1 *
+.* SECTION +LOCAL +DEFAULT +2 *
+.* SECTION +LOCAL +DEFAULT +3 *
+.* SECTION +LOCAL +DEFAULT +4 *
+.* SECTION +LOCAL +DEFAULT +5 *
+.* SECTION +LOCAL +DEFAULT +6 *
+.* SECTION +LOCAL +DEFAULT +7 *
+.* SECTION +LOCAL +DEFAULT +8 *
+.* SECTION +LOCAL +DEFAULT +9 *
+.* SECTION +LOCAL +DEFAULT +10 *
+.* SECTION +LOCAL +DEFAULT +11 *
+.* SECTION +LOCAL +DEFAULT +12 *
+.* SECTION +LOCAL +DEFAULT +13 *
+.* TLS +LOCAL +DEFAULT +9 sl1
+.* TLS +LOCAL +DEFAULT +9 sl2
+.* TLS +LOCAL +DEFAULT +9 sl3
+.* TLS +LOCAL +DEFAULT +9 sl4
+.* TLS +LOCAL +DEFAULT +9 sl5
+.* TLS +LOCAL +DEFAULT +9 sl6
+.* TLS +LOCAL +DEFAULT +9 sl7
+.* TLS +LOCAL +DEFAULT +9 sl8
+.* TLS +LOCAL +DEFAULT +10 bl1
+.* TLS +LOCAL +DEFAULT +10 bl2
+.* TLS +LOCAL +DEFAULT +10 bl3
+.* TLS +LOCAL +DEFAULT +10 bl4
+.* TLS +LOCAL +DEFAULT +10 bl5
+.* TLS +LOCAL +DEFAULT +10 bl6
+.* TLS +LOCAL +DEFAULT +10 bl7
+.* TLS +LOCAL +DEFAULT +10 bl8
+.* OBJECT +LOCAL +DEFAULT +11 _DYNAMIC
+.* OBJECT +LOCAL +DEFAULT +13 _GLOBAL_OFFSET_TABLE_
+.* TLS +GLOBAL +DEFAULT +9 sg8
+.* TLS +GLOBAL +DEFAULT +10 bg8
+.* TLS +GLOBAL +DEFAULT +10 bg6
+.* TLS +GLOBAL +DEFAULT +UND sG5
+.* TLS +GLOBAL +DEFAULT +10 bg3
+.* TLS +GLOBAL +DEFAULT +9 sg3
+.* TLS +GLOBAL +HIDDEN +9 sh3
+.* TLS +GLOBAL +DEFAULT +UND sG2
+.* TLS +GLOBAL +DEFAULT +9 sg4
+.* TLS +GLOBAL +DEFAULT +9 sg5
+.* TLS +GLOBAL +DEFAULT +10 bg5
+.* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr
+.* TLS +GLOBAL +HIDDEN +9 sh7
+.* TLS +GLOBAL +HIDDEN +9 sh8
+.* TLS +GLOBAL +DEFAULT +9 sg1
+.* FUNC +GLOBAL +DEFAULT +8 _start
+.* TLS +GLOBAL +HIDDEN +9 sh4
+.* TLS +GLOBAL +DEFAULT +10 bg7
+.* TLS +GLOBAL +HIDDEN +9 sh5
+.* NOTYPE +GLOBAL +DEFAULT +ABS __bss_start
+.* TLS +GLOBAL +DEFAULT +UND sG6
+.* FUNC +GLOBAL +DEFAULT +8 fn2
+.* TLS +GLOBAL +DEFAULT +9 sg2
+.* TLS +GLOBAL +DEFAULT +UND sG1
+.* TLS +GLOBAL +HIDDEN +9 sh1
+.* TLS +GLOBAL +DEFAULT +9 sg6
+.* TLS +GLOBAL +DEFAULT +9 sg7
+.* NOTYPE +GLOBAL +DEFAULT +ABS _edata
+.* NOTYPE +GLOBAL +DEFAULT +ABS _end
+.* TLS +GLOBAL +HIDDEN +9 sh2
+.* TLS +GLOBAL +HIDDEN +9 sh6
+.* TLS +GLOBAL +DEFAULT +10 bg2
+.* TLS +GLOBAL +DEFAULT +10 bg1
+.* TLS +GLOBAL +DEFAULT +10 bg4
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsbin.s b/binutils-2.21/ld/testsuite/ld-x86-64/tlsbin.s
new file mode 100644
index 0000000..eb9bfbc
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsbin.s
@@ -0,0 +1,97 @@
+ .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
+ .type _start,@function
+_start:
+ pushq %rbp
+ movq %rsp, %rbp
+
+ /* IE against global var */
+ movq %fs:0, %r11
+ nop;nop
+ addq sG6@gottpoff(%rip), %r11
+ nop;nop;nop;nop
+
+ /* IE -> LE against global var defined in exec */
+ movq %fs:0, %rdx
+ nop;nop
+ addq bg6@gottpoff(%rip), %rdx
+ nop;nop;nop;nop
+
+ /* IE -> LE against local var */
+ movq %fs:0, %r12
+ nop;nop
+ addq bl6@gottpoff(%rip), %r12
+ nop;nop;nop;nop
+
+ /* direct %fs access IE -> LE against local var */
+ movq bl8@gottpoff(%rip), %rdx
+ nop;nop
+ movq %fs:(%rdx), %rax
+ nop;nop;nop;nop
+
+ /* IE -> LE against hidden but not local var */
+ movq %fs:0, %rdx
+ nop;nop
+ addq sh6@gottpoff(%rip), %rdx
+ nop;nop;nop;nop
+
+ /* direct %fs access IE -> LE against hidden but not local var */
+ movq sh8@gottpoff(%rip), %rdx
+ nop;nop
+ movq %fs:(%rdx), %rax
+ nop;nop;nop;nop
+
+ /* LE, global var defined in exec */
+ movq %fs:0, %rax
+ nop;nop
+ leaq sg2@tpoff(%rax), %rdx
+ nop;nop;nop;nop
+
+ /* LE, local var, non-canonical sequence */
+ movq $2+bl2@tpoff, %r9
+ nop;nop
+ movq %fs:0, %rdx
+ nop;nop
+ addq %r9, %rdx
+ nop;nop;nop;nop
+
+ /* LE, hidden var defined in exec, non-canonical sequence */
+ movq %fs:0, %rdx
+ nop;nop
+ addq $sh2@tpoff+1, %rdx
+ nop;nop;nop;nop
+
+ /* Direct %fs access */
+
+ /* LE, global var defined in exec */
+ movq %fs:sg3@tpoff, %rax
+ nop;nop;nop;nop
+
+ /* LE, local var */
+ movq %fs:bl3@tpoff+3, %r10
+ nop;nop;nop;nop
+
+ /* LE, hidden var defined in exec */
+ movq %fs:1+sh3@tpoff, %rdx
+ nop;nop;nop;nop
+
+ leave
+ ret
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsbin.sd b/binutils-2.21/ld/testsuite/ld-x86-64/tlsbin.sd
new file mode 100644
index 0000000..7fbc565
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsbin.sd
@@ -0,0 +1,12 @@
+#source: tlsbinpic.s
+#source: tlsbin.s
+#as: --64
+#ld: -shared -melf_x86_64
+#objdump: -sj.got
+#target: x86_64-*-*
+
+.*: +file format elf64-x86-64
+
+Contents of section .got:
+ 6013d0 00000000 00000000 00000000 00000000 .*
+ 6013e0 00000000 00000000 00000000 00000000 .*
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsbin.td b/binutils-2.21/ld/testsuite/ld-x86-64/tlsbin.td
new file mode 100644
index 0000000..b3851de
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsbin.td
@@ -0,0 +1,16 @@
+#source: tlsbinpic.s
+#source: tlsbin.s
+#as: --64
+#ld: -shared -melf_x86_64
+#objdump: -sj.tdata
+#target: x86_64-*-*
+
+.*: +file format elf64-x86-64
+
+Contents of section .tdata:
+ 60122a 11000000 12000000 13000000 14000000 .*
+ 60123a 15000000 16000000 17000000 18000000 .*
+ 60124a 41000000 42000000 43000000 44000000 .*
+ 60125a 45000000 46000000 47000000 48000000 .*
+ 60126a 01010000 02010000 03010000 04010000 .*
+ 60127a 05010000 06010000 07010000 08010000 .*
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsbindesc.dd b/binutils-2.21/ld/testsuite/ld-x86-64/tlsbindesc.dd
new file mode 100644
index 0000000..9e82eab
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsbindesc.dd
@@ -0,0 +1,301 @@
+#source: tlsbindesc.s
+#source: tlsbin.s
+#as: --64
+#ld: -shared -melf_x86_64
+#objdump: -drj.text
+#target: x86_64-*-*
+
+# PT_TLS layout is:
+# Offset from Offset from Name
+# TCB base TCB end
+# 0x00 -0xa0 sg1..sg8
+# 0x20 -0x80 sl1..sl8
+# 0x40 -0x60 sh1..sh8
+# 0x60 -0x40 bg1..bg8
+# 0x80 -0x20 bl1..bl8
+
+.*: +file format elf64-x86-64
+
+Disassembly of section .text:
+
+0+401000 <fn2>:
+ [0-9a-f]+: 55[ ]+push %rbp
+ [0-9a-f]+: 48 89 e5[ ]+mov %rsp,%rbp
+# GD -> IE because variable is not defined in executable
+ [0-9a-f]+: 48 8b 05 65 03 20 00[ ]+mov 0x200365\(%rip\),%rax +# 601370 <.*>
+# -> R_X86_64_TPOFF64 sG1
+ [0-9a-f]+: 66 90[ ]+xchg %ax,%ax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# GD -> IE because variable is not defined in executable where
+# the variable is referenced through IE too
+ [0-9a-f]+: 48 8b 05 48 03 20 00[ ]+mov 0x200348\(%rip\),%rax +# 601360 <.*>
+# -> R_X86_64_TPOFF64 sG2
+ [0-9a-f]+: 66 90[ ]+xchg %ax,%ax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# GD -> LE with global variable defined in executable
+ [0-9a-f]+: 48 c7 c0 60 ff ff ff[ ]+mov \$0xf+60,%rax
+# sg1
+ [0-9a-f]+: 66 90[ ]+xchg %ax,%ax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# GD -> LE with local variable defined in executable
+ [0-9a-f]+: 48 c7 c0 80 ff ff ff[ ]+mov \$0xf+80,%rax
+# sl1
+ [0-9a-f]+: 66 90[ ]+xchg %ax,%ax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# GD -> LE with hidden variable defined in executable
+ [0-9a-f]+: 48 c7 c0 a0 ff ff ff[ ]+mov \$0xf+a0,%rax
+# sh1
+ [0-9a-f]+: 66 90[ ]+xchg %ax,%ax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# LD -> LE
+ [0-9a-f]+: 48 c7 c0 00 00 00 00[ ]+mov \$0x0,%rax
+ [0-9a-f]+: 66 90[ ]+xchg %ax,%ax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 48 8d 90 81 ff ff ff[ ]+lea -0x7f\(%rax\),%rdx
+# sl1+1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 4c 8d 88 86 ff ff ff[ ]+lea -0x7a\(%rax\),%r9
+# sl2+2
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# LD -> LE against hidden variables
+ [0-9a-f]+: 48 8d 90 a0 ff ff ff[ ]+lea -0x60\(%rax\),%rdx
+# sh1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 48 8d 88 a7 ff ff ff[ ]+lea -0x59\(%rax\),%rcx
+# sh2+3
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# IE against global var
+ [0-9a-f]+: 64 4c 8b 0c 25 00 00[ ]+mov %fs:0x0,%r9
+ [0-9a-f]+: 00 00 *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 4c 03 0d d6 02 20 00[ ]+add 0x2002d6\(%rip\),%r9 +# 601360 <.*>
+# -> R_X86_64_TPOFF64 sG2
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# IE -> LE against global var defined in exec
+ [0-9a-f]+: 64 4c 8b 14 25 00 00[ ]+mov %fs:0x0,%r10
+ [0-9a-f]+: 00 00 *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 4d 8d 92 60 ff ff ff[ ]+lea -0xa0\(%r10\),%r10
+# sg1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# IE -> LE against local var
+ [0-9a-f]+: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
+ [0-9a-f]+: 00 00 *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 48 8d 80 80 ff ff ff[ ]+lea -0x80\(%rax\),%rax
+# sl1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# IE -> LE against hidden var
+ [0-9a-f]+: 64 48 8b 0c 25 00 00[ ]+mov %fs:0x0,%rcx
+ [0-9a-f]+: 00 00 *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 48 8d 89 a0 ff ff ff[ ]+lea -0x60\(%rcx\),%rcx
+# sh1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# Direct access through %fs
+# IE against global var
+ [0-9a-f]+: 48 8b 0d 81 02 20 00[ ]+mov 0x200281\(%rip\),%rcx +# 601358 <.*>
+# -> R_X86_64_TPOFF64 sG5
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 64 48 8b 11[ ]+mov %fs:\(%rcx\),%rdx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# IE->LE against local var
+ [0-9a-f]+: 49 c7 c3 90 ff ff ff[ ]+mov \$0xf+90,%r11
+# sl5
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 64 4d 8b 23[ ]+mov %fs:\(%r11\),%r12
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# IE->LE against hidden var
+ [0-9a-f]+: 48 c7 c2 b0 ff ff ff[ ]+mov \$0xf+b0,%rdx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 64 48 8b 12[ ]+mov %fs:\(%rdx\),%rdx
+# sh5
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: c9[ ]+leaveq *
+ [0-9a-f]+: c3[ ]+retq *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+
+[0-9a-f]+ <_start>:
+ [0-9a-f]+: 55[ ]+push %rbp
+ [0-9a-f]+: 48 89 e5[ ]+mov %rsp,%rbp
+# IE against global var
+ [0-9a-f]+: 64 4c 8b 1c 25 00 00[ ]+mov %fs:0x0,%r11
+ [0-9a-f]+: 00 00 *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 4c 03 1d 4a 02 20 00[ ]+add 0x20024a\(%rip\),%r11 +# 601368 <.*>
+# -> R_X86_64_TPOFF64 sG6
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# IE -> LE against global var defined in exec
+ [0-9a-f]+: 64 48 8b 14 25 00 00[ ]+mov %fs:0x0,%rdx
+ [0-9a-f]+: 00 00 *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 48 8d 92 d4 ff ff ff[ ]+lea -0x2c\(%rdx\),%rdx
+# bg6
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# IE -> LE against local var
+ [0-9a-f]+: 64 4c 8b 24 25 00 00[ ]+mov %fs:0x0,%r12
+ [0-9a-f]+: 00 00 *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 49 81 c4 f4 ff ff ff[ ]+add \$0xf+f4,%r12
+# bl6
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# direct %fs access IE -> LE against local var
+ [0-9a-f]+: 48 c7 c2 fc ff ff ff[ ]+mov \$0xf+fc,%rdx
+# bl8
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 64 48 8b 02[ ]+mov %fs:\(%rdx\),%rax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# IE -> LE against hidden but not local var
+ [0-9a-f]+: 64 48 8b 14 25 00 00[ ]+mov %fs:0x0,%rdx
+ [0-9a-f]+: 00 00 *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 48 8d 92 b4 ff ff ff[ ]+lea -0x4c\(%rdx\),%rdx
+# sh6
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# direct %fs access IE -> LE against hidden but not local var
+ [0-9a-f]+: 48 c7 c2 bc ff ff ff[ ]+mov \$0xf+bc,%rdx
+# sh8
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 64 48 8b 02[ ]+mov %fs:\(%rdx\),%rax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# LE, global var defined in exec
+ [0-9a-f]+: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
+ [0-9a-f]+: 00 00 *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 48 8d 90 64 ff ff ff[ ]+lea -0x9c\(%rax\),%rdx
+# sg2
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# LE, local var, non-canonical sequence
+ [0-9a-f]+: 49 c7 c1 e6 ff ff ff[ ]+mov \$0xf+e6,%r9
+# bl2+2
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 64 48 8b 14 25 00 00[ ]+mov %fs:0x0,%rdx
+ [0-9a-f]+: 00 00 *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 4c 01 ca[ ]+add %r9,%rdx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# LE, hidden var defined in exec, non-canonical sequence
+ [0-9a-f]+: 64 48 8b 14 25 00 00[ ]+mov %fs:0x0,%rdx
+ [0-9a-f]+: 00 00 *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 48 81 c2 a5 ff ff ff[ ]+add \$0xf+a5,%rdx
+# sh2+1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# Direct %fs access
+# LE, global var defined in exec
+ [0-9a-f]+: 64 48 8b 04 25 68 ff[ ]+mov %fs:0xf+68,%rax
+ [0-9a-f]+: ff ff *
+# sg3
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# LE, local var
+ [0-9a-f]+: 64 4c 8b 14 25 eb ff[ ]+mov %fs:0xf+eb,%r10
+ [0-9a-f]+: ff ff *
+# bl3+3
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# LE, hidden var defined in exec
+ [0-9a-f]+: 64 48 8b 14 25 a9 ff[ ]+mov %fs:0xf+a9,%rdx
+ [0-9a-f]+: ff ff *
+# sh3+1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: c9[ ]+leaveq *
+ [0-9a-f]+: c3[ ]+retq *
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsbindesc.rd b/binutils-2.21/ld/testsuite/ld-x86-64/tlsbindesc.rd
new file mode 100644
index 0000000..7e94022
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsbindesc.rd
@@ -0,0 +1,138 @@
+#source: tlsbindesc.s
+#source: tlsbin.s
+#as: --64
+#ld: -shared -melf_x86_64
+#readelf: -WSsrl
+#target: x86_64-*-*
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Address +Off +Size +ES Flg Lk Inf Al
+ +\[[ 0-9]+\] +NULL +0+ 0+ 0+ 00 +0 +0 +0
+ +\[[ 0-9]+\] .interp +.*
+ +\[[ 0-9]+\] .hash +.*
+ +\[[ 0-9]+\] .dynsym +.*
+ +\[[ 0-9]+\] .dynstr +.*
+ +\[[ 0-9]+\] .rela.dyn +.*
+ +\[[ 0-9]+\] .text +PROGBITS +0+401000 0+1000 0+1f6 00 +AX +0 +0 +4096
+ +\[[ 0-9]+\] .tdata +PROGBITS +0+6011f6 0+11f6 0+60 00 WAT +0 +0 +1
+ +\[[ 0-9]+\] .tbss +NOBITS +0+601256 0+1256 0+40 00 WAT +0 +0 +1
+ +\[[ 0-9]+\] .dynamic +DYNAMIC +0+601258 0+1258 0+100 10 +WA +4 +0 +8
+ +\[[ 0-9]+\] .got +PROGBITS +0+601358 0+1358 0+20 08 +WA +0 +0 +8
+ +\[[ 0-9]+\] .got.plt +PROGBITS +0+601378 0+1378 0+18 08 +WA +0 +0 +8
+ +\[[ 0-9]+\] .shstrtab +.*
+ +\[[ 0-9]+\] .symtab +.*
+ +\[[ 0-9]+\] .strtab +.*
+Key to Flags:
+.*
+.*
+.*
+
+Elf file type is EXEC \(Executable file\)
+Entry point 0x401108
+There are [0-9]+ program headers, starting at offset [0-9]+
+
+Program Headers:
+ +Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg Align
+ +PHDR.*
+ +INTERP.*
+.*Requesting program interpreter.*
+ +LOAD +0x0+ 0x0+400000 0x0+400000 0x0+11f6 0x0+11f6 R E 0x200000
+ +LOAD +0x0+11f6 0x0+6011f6 0x0+6011f6 0x0+19a 0x0+19a RW +0x200000
+ +DYNAMIC +0x0+1258 0x0+601258 0x0+601258 0x0+100 0x0+100 RW +0x8
+ +TLS +0x0+11f6 0x0+6011f6 0x0+6011f6 0x0+60 0x0+a0 R +0x1
+
+ Section to Segment mapping:
+ +Segment Sections...
+ +00 *
+ +01 +.interp *
+ +02 +.interp .hash .dynsym .dynstr .rela.dyn .text *
+ +03 +.tdata .dynamic .got .got.plt *
+ +04 +.dynamic *
+ +05 +.tdata .tbss *
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 4 entries:
+ +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
+0+601358 +0+100000012 R_X86_64_TPOFF64 +0+ sG5 \+ 0
+0+601360 +0+200000012 R_X86_64_TPOFF64 +0+ sG2 \+ 0
+0+601368 +0+400000012 R_X86_64_TPOFF64 +0+ sG6 \+ 0
+0+601370 +0+500000012 R_X86_64_TPOFF64 +0+ sG1 \+ 0
+
+Symbol table '\.dynsym' contains [0-9]+ entries:
+ +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+ +[0-9]+: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG5
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG2
+ +[0-9]+: 0+[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS __bss_start
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG6
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG1
+ +[0-9]+: 0+[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _edata
+ +[0-9]+: 0+[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _end
+
+Symbol table '\.symtab' contains [0-9]+ entries:
+ +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+ +[0-9]+: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +1 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +2 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +3 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +4 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +5 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +6 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +7 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +8 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +9 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +10 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +11 *
+ +[0-9]+: 0+20 +0 +TLS +LOCAL +DEFAULT +7 sl1
+ +[0-9]+: 0+24 +0 +TLS +LOCAL +DEFAULT +7 sl2
+ +[0-9]+: 0+28 +0 +TLS +LOCAL +DEFAULT +7 sl3
+ +[0-9]+: 0+2c +0 +TLS +LOCAL +DEFAULT +7 sl4
+ +[0-9]+: 0+30 +0 +TLS +LOCAL +DEFAULT +7 sl5
+ +[0-9]+: 0+34 +0 +TLS +LOCAL +DEFAULT +7 sl6
+ +[0-9]+: 0+38 +0 +TLS +LOCAL +DEFAULT +7 sl7
+ +[0-9]+: 0+3c +0 +TLS +LOCAL +DEFAULT +7 sl8
+ +[0-9]+: 0+80 +0 +TLS +LOCAL +DEFAULT +8 bl1
+ +[0-9]+: 0+84 +0 +TLS +LOCAL +DEFAULT +8 bl2
+ +[0-9]+: 0+88 +0 +TLS +LOCAL +DEFAULT +8 bl3
+ +[0-9]+: 0+8c +0 +TLS +LOCAL +DEFAULT +8 bl4
+ +[0-9]+: 0+90 +0 +TLS +LOCAL +DEFAULT +8 bl5
+ +[0-9]+: 0+94 +0 +TLS +LOCAL +DEFAULT +8 bl6
+ +[0-9]+: 0+98 +0 +TLS +LOCAL +DEFAULT +8 bl7
+ +[0-9]+: 0+9c +0 +TLS +LOCAL +DEFAULT +8 bl8
+ +[0-9]+: 0+a0 +0 +TLS +LOCAL +DEFAULT +7 _TLS_MODULE_BASE_
+ +[0-9]+: 0+601258 +0 +OBJECT +LOCAL +DEFAULT +9 _DYNAMIC
+ +[0-9]+: 0+601378 +0 +OBJECT +LOCAL +DEFAULT +11 _GLOBAL_OFFSET_TABLE_
+ +[0-9]+: 0+1c +0 +TLS +GLOBAL +DEFAULT +7 sg8
+ +[0-9]+: 0+7c +0 +TLS +GLOBAL +DEFAULT +8 bg8
+ +[0-9]+: 0+74 +0 +TLS +GLOBAL +DEFAULT +8 bg6
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG5
+ +[0-9]+: 0+68 +0 +TLS +GLOBAL +DEFAULT +8 bg3
+ +[0-9]+: 0+8 +0 +TLS +GLOBAL +DEFAULT +7 sg3
+ +[0-9]+: 0+48 +0 +TLS +GLOBAL +HIDDEN +7 sh3
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG2
+ +[0-9]+: 0+c +0 +TLS +GLOBAL +DEFAULT +7 sg4
+ +[0-9]+: 0+10 +0 +TLS +GLOBAL +DEFAULT +7 sg5
+ +[0-9]+: 0+70 +0 +TLS +GLOBAL +DEFAULT +8 bg5
+ +[0-9]+: 0+58 +0 +TLS +GLOBAL +HIDDEN +7 sh7
+ +[0-9]+: 0+5c +0 +TLS +GLOBAL +HIDDEN +7 sh8
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +7 sg1
+ +[0-9]+: 0+401108 +0 +FUNC +GLOBAL +DEFAULT +6 _start
+ +[0-9]+: 0+4c +0 +TLS +GLOBAL +HIDDEN +7 sh4
+ +[0-9]+: 0+78 +0 +TLS +GLOBAL +DEFAULT +8 bg7
+ +[0-9]+: 0+50 +0 +TLS +GLOBAL +HIDDEN +7 sh5
+ +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS __bss_start
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG6
+ +[0-9]+: 0+401000 +0 +FUNC +GLOBAL +DEFAULT +6 fn2
+ +[0-9]+: 0+4 +0 +TLS +GLOBAL +DEFAULT +7 sg2
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG1
+ +[0-9]+: 0+40 +0 +TLS +GLOBAL +HIDDEN +7 sh1
+ +[0-9]+: 0+14 +0 +TLS +GLOBAL +DEFAULT +7 sg6
+ +[0-9]+: 0+18 +0 +TLS +GLOBAL +DEFAULT +7 sg7
+ +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _edata
+ +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _end
+ +[0-9]+: 0+44 +0 +TLS +GLOBAL +HIDDEN +7 sh2
+ +[0-9]+: 0+54 +0 +TLS +GLOBAL +HIDDEN +7 sh6
+ +[0-9]+: 0+64 +0 +TLS +GLOBAL +DEFAULT +8 bg2
+ +[0-9]+: 0+60 +0 +TLS +GLOBAL +DEFAULT +8 bg1
+ +[0-9]+: 0+6c +0 +TLS +GLOBAL +DEFAULT +8 bg4
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsbindesc.s b/binutils-2.21/ld/testsuite/ld-x86-64/tlsbindesc.s
new file mode 100644
index 0000000..cbebf02
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsbindesc.s
@@ -0,0 +1,128 @@
+ /* Force .data aligned to 4K, so that .got very likely gets at
+ 0x5021a0 (0x60 bytes .tdata and 0x140 bytes .dynamic) */
+ .data
+ .balign 4096
+ .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
+ /* Force .text aligned to 4K, so it very likely gets at 0x401000. */
+ .text
+ .balign 4096
+ .globl fn2
+ .type fn2,@function
+fn2:
+ pushq %rbp
+ movq %rsp, %rbp
+
+ /* GD -> IE because variable is not defined in executable */
+ leaq sG1@tlsdesc(%rip), %rax
+ call *sG1@tlscall(%rax)
+ nop;nop;nop;nop
+
+ /* GD -> IE because variable is not defined in executable where
+ the variable is referenced through IE too */
+ leaq sG2@tlsdesc(%rip), %rax
+ call *sG2@tlscall(%rax)
+ nop;nop;nop;nop
+
+ /* GD -> LE with global variable defined in executable */
+ leaq sg1@tlsdesc(%rip), %rax
+ call *sg1@tlscall(%rax)
+ nop;nop;nop;nop
+
+ /* GD -> LE with local variable defined in executable */
+ leaq sl1@tlsdesc(%rip), %rax
+ call *sl1@tlscall(%rax)
+ nop;nop;nop;nop
+
+ /* GD -> LE with hidden variable defined in executable */
+ leaq sh1@tlsdesc(%rip), %rax
+ call *sh1@tlscall(%rax)
+ nop;nop;nop;nop
+
+ /* LD -> LE */
+ leaq _TLS_MODULE_BASE_@tlsdesc(%rip), %rax
+ call *_TLS_MODULE_BASE_@tlscall(%rax)
+ nop;nop
+ leaq 1+sl1@dtpoff(%rax), %rdx
+ nop;nop
+ leaq sl2@dtpoff+2(%rax), %r9
+ nop;nop;nop;nop
+
+ /* LD -> LE against hidden variables */
+ leaq sh1@dtpoff(%rax), %rdx
+ nop;nop
+ leaq 3+sh2@dtpoff(%rax), %rcx
+ nop;nop;nop;nop
+
+ /* IE against global var */
+ movq %fs:0, %r9
+ nop;nop
+ addq sG2@gottpoff(%rip), %r9
+ nop;nop;nop;nop
+
+ /* IE -> LE against global var defined in exec */
+ movq %fs:0, %r10
+ nop;nop
+ addq sg1@gottpoff(%rip), %r10
+ nop;nop;nop;nop
+
+ /* IE -> LE against local var */
+ movq %fs:0, %rax
+ nop;nop
+ addq sl1@gottpoff(%rip), %rax
+ nop;nop;nop;nop
+
+ /* IE -> LE against hidden var */
+ movq %fs:0, %rcx
+ nop;nop
+ addq sh1@gottpoff(%rip), %rcx
+ nop;nop;nop;nop
+
+ /* Direct access through %fs */
+
+ /* IE against global var */
+ movq sG5@gottpoff(%rip), %rcx
+ nop;nop
+ movq %fs:(%rcx), %rdx
+ nop;nop;nop;nop
+
+ /* IE->LE against local var */
+ movq sl5@gottpoff(%rip), %r11
+ nop;nop
+ movq %fs:(%r11), %r12
+ nop;nop;nop;nop
+
+ /* IE->LE against hidden var */
+ movq sh5@gottpoff(%rip), %rdx
+ nop;nop
+ movq %fs:(%rdx), %rdx
+ nop;nop;nop;nop
+
+ leave
+ ret
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsbindesc.sd b/binutils-2.21/ld/testsuite/ld-x86-64/tlsbindesc.sd
new file mode 100644
index 0000000..f622bc4
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsbindesc.sd
@@ -0,0 +1,12 @@
+#source: tlsbindesc.s
+#source: tlsbin.s
+#as: --64
+#ld: -shared -melf_x86_64
+#objdump: -sj.got
+#target: x86_64-*-*
+
+.*: +file format elf64-x86-64
+
+Contents of section .got:
+ 601358 00000000 00000000 00000000 00000000 .*
+ 601368 00000000 00000000 00000000 00000000 .*
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsbindesc.td b/binutils-2.21/ld/testsuite/ld-x86-64/tlsbindesc.td
new file mode 100644
index 0000000..b2a3ebe
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsbindesc.td
@@ -0,0 +1,16 @@
+#source: tlsbindesc.s
+#source: tlsbin.s
+#as: --64
+#ld: -shared -melf_x86_64
+#objdump: -sj.tdata
+#target: x86_64-*-*
+
+.*: +file format elf64-x86-64
+
+Contents of section .tdata:
+ 6011f6 11000000 12000000 13000000 14000000 .*
+ 601206 15000000 16000000 17000000 18000000 .*
+ 601216 41000000 42000000 43000000 44000000 .*
+ 601226 45000000 46000000 47000000 48000000 .*
+ 601236 01010000 02010000 03010000 04010000 .*
+ 601246 05010000 06010000 07010000 08010000 .*
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsbinpic.s b/binutils-2.21/ld/testsuite/ld-x86-64/tlsbinpic.s
new file mode 100644
index 0000000..2819a8f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsbinpic.s
@@ -0,0 +1,146 @@
+ /* Force .data aligned to 4K, so that .got very likely gets at
+ 0x5021a0 (0x60 bytes .tdata and 0x140 bytes .dynamic) */
+ .data
+ .balign 4096
+ .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
+ /* Force .text aligned to 4K, so it very likely gets at 0x401000. */
+ .text
+ .balign 4096
+ .globl fn2
+ .type fn2,@function
+fn2:
+ pushq %rbp
+ movq %rsp, %rbp
+
+ /* GD -> IE because variable is not defined in executable */
+ .byte 0x66
+ leaq sG1@tlsgd(%rip), %rdi
+ .word 0x6666
+ rex64
+ call __tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE because variable is not defined in executable where
+ the variable is referenced through IE too */
+ .byte 0x66
+ leaq sG2@tlsgd(%rip), %rdi
+ .word 0x6666
+ rex64
+ call __tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> LE with global variable defined in executable */
+ .byte 0x66
+ leaq sg1@tlsgd(%rip), %rdi
+ .word 0x6666
+ rex64
+ call __tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> LE with local variable defined in executable */
+ .byte 0x66
+ leaq sl1@tlsgd(%rip), %rdi
+ .word 0x6666
+ rex64
+ call __tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> LE with hidden variable defined in executable */
+ .byte 0x66
+ leaq sh1@tlsgd(%rip), %rdi
+ .word 0x6666
+ rex64
+ call __tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* LD -> LE */
+ leaq sl1@tlsld(%rip), %rdi
+ call __tls_get_addr@plt
+ nop;nop
+ leaq 1+sl1@dtpoff(%rax), %rdx
+ nop;nop
+ leaq sl2@dtpoff+2(%rax), %r9
+ nop;nop;nop;nop
+
+ /* LD -> LE against hidden variables */
+ leaq sh1@tlsld(%rip), %rdi
+ call __tls_get_addr@plt
+ nop;nop
+ leaq sh1@dtpoff(%rax), %rdx
+ nop;nop
+ leaq 3+sh2@dtpoff(%rax), %rcx
+ nop;nop;nop;nop
+
+ /* IE against global var */
+ movq %fs:0, %r9
+ nop;nop
+ addq sG2@gottpoff(%rip), %r9
+ nop;nop;nop;nop
+
+ /* IE -> LE against global var defined in exec */
+ movq %fs:0, %r10
+ nop;nop
+ addq sg1@gottpoff(%rip), %r10
+ nop;nop;nop;nop
+
+ /* IE -> LE against local var */
+ movq %fs:0, %rax
+ nop;nop
+ addq sl1@gottpoff(%rip), %rax
+ nop;nop;nop;nop
+
+ /* IE -> LE against hidden var */
+ movq %fs:0, %rcx
+ nop;nop
+ addq sh1@gottpoff(%rip), %rcx
+ nop;nop;nop;nop
+
+ /* Direct access through %fs */
+
+ /* IE against global var */
+ movq sG5@gottpoff(%rip), %rcx
+ nop;nop
+ movq %fs:(%rcx), %rdx
+ nop;nop;nop;nop
+
+ /* IE->LE against local var */
+ movq sl5@gottpoff(%rip), %r11
+ nop;nop
+ movq %fs:(%r11), %r12
+ nop;nop;nop;nop
+
+ /* IE->LE against hidden var */
+ movq sh5@gottpoff(%rip), %rdx
+ nop;nop
+ movq %fs:(%rdx), %rdx
+ nop;nop;nop;nop
+
+ leave
+ ret
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.dd b/binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.dd
new file mode 100644
index 0000000..9b0ae61
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.dd
@@ -0,0 +1,200 @@
+#source: tlsdesc.s
+#source: tlspic2.s
+#as: --64
+#ld: -shared -melf_x86_64
+#objdump: -drj.text
+#target: x86_64-*-*
+
+.*: +file format elf64-x86-64
+
+Disassembly of section .text:
+
+0+[0-9a-f]+ <fn1>:
+ +[0-9a-f]+: 55[ ]+push %rbp
+ +[0-9a-f]+: 48 89 e5[ ]+mov %rsp,%rbp
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# GD
+ +[0-9a-f]+: 48 8d 05 89 03 20 00[ ]+lea 0x200389\(%rip\),%rax +# 201398 <.*>
+# -> R_X86_64_TLSDESC sg1
+ +[0-9a-f]+: ff 10[ ]+callq \*\(%rax\)
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# GD -> IE because variable is referenced through IE too
+ +[0-9a-f]+: 48 8b 05 1c 03 20 00[ ]+mov 0x20031c\(%rip\),%rax +# 201338 <.*>
+# -> R_X86_64_TPOFF64 sg2
+ +[0-9a-f]+: 66 90[ ]+xchg %ax,%ax
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# GD against local variable
+ +[0-9a-f]+: 48 8d 05 3f 03 20 00[ ]+lea 0x20033f\(%rip\),%rax +# 201368 <.*>
+# -> R_X86_64_TLSDESC [0 0x2000000000000000]
+ +[0-9a-f]+: ff 10[ ]+callq \*\(%rax\)
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# GD -> IE against local variable referenced through IE too
+ +[0-9a-f]+: 48 8b 05 d2 02 20 00[ ]+mov 0x2002d2\(%rip\),%rax +# 201308 <.*>
+# -> R_X86_64_TPOFF64 *ABS*+0x24
+ +[0-9a-f]+: 66 90[ ]+xchg %ax,%ax
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# GD against hidden and local variable
+ +[0-9a-f]+: 48 8d 05 65 03 20 00[ ]+lea 0x200365\(%rip\),%rax +# 2013a8 <.*>
+# -> R_X86_64_TLSDESC [0 0x4000000000000000]
+ +[0-9a-f]+: ff 10[ ]+callq \*\(%rax\)
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# GD -> IE against hidden and local variable referenced through IE too
+ +[0-9a-f]+: 48 8b 05 f0 02 20 00[ ]+mov 0x2002f0\(%rip\),%rax +# 201340 <.*>
+# -> R_X86_64_TPOFF64 *ABS*+0x44
+ +[0-9a-f]+: 66 90[ ]+xchg %ax,%ax
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# GD against hidden but not local variable
+ +[0-9a-f]+: 48 8d 05 1b 03 20 00[ ]+lea 0x20031b\(%rip\),%rax +# 201378 <.*>
+# -> R_X86_64_TLSDESC [0 0x6000000000000000]
+ +[0-9a-f]+: ff 10[ ]+callq \*\(%rax\)
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# GD -> IE against hidden but not local variable referenced through IE too
+ +[0-9a-f]+: 48 8b 05 ae 02 20 00[ ]+mov 0x2002ae\(%rip\),%rax +# 201318 <.*>
+# -> R_X86_64_TPOFF64 *ABS*+0x64
+ +[0-9a-f]+: 66 90[ ]+xchg %ax,%ax
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# LD
+ +[0-9a-f]+: 48 8d 05 11 03 20 00[ ]+lea 0x200311\(%rip\),%rax +# 201388 <.*>
+# -> R_X86_64_TLSDESC [0 0x000000000000000]
+ +[0-9a-f]+: ff 10[ ]+callq \*\(%rax\)
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 48 8d 90 20 00 00 00[ ]+lea 0x20\(%rax\),%rdx
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 4c 8d 88 26 00 00 00[ ]+lea 0x26\(%rax\),%r9
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# LD against hidden and local variables
+ +[0-9a-f]+: 48 8d 90 40 00 00 00[ ]+lea 0x40\(%rax\),%rdx
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 48 8d 88 47 00 00 00[ ]+lea 0x47\(%rax\),%rcx
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# LD against hidden but not local variables
+ +[0-9a-f]+: 4c 8d a0 60 00 00 00[ ]+lea 0x60\(%rax\),%r12
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 48 8d 88 65 00 00 00[ ]+lea 0x65\(%rax\),%rcx
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# IE against global var
+ +[0-9a-f]+: 64 48 8b 0c 25 00 00[ ]+mov %fs:0x0,%rcx
+ +[0-9a-f]+: 00 00 *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 48 03 0d 71 02 20 00[ ]+add 0x200271\(%rip\),%rcx +# 201338 <.*>
+# -> R_X86_64_TPOFF64 sg2
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# IE against local var
+ +[0-9a-f]+: 64 4c 8b 34 25 00 00[ ]+mov %fs:0x0,%r14
+ +[0-9a-f]+: 00 00 *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 4c 03 35 2b 02 20 00[ ]+add 0x20022b\(%rip\),%r14 +# 201308 <.*>
+# -> R_X86_64_TPOFF64 *ABS*+0x24
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# IE against hidden and local var
+ +[0-9a-f]+: 64 48 8b 0c 25 00 00[ ]+mov %fs:0x0,%rcx
+ +[0-9a-f]+: 00 00 *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 48 03 0d 4d 02 20 00[ ]+add 0x20024d\(%rip\),%rcx +# 201340 <.*>
+# -> R_X86_64_TPOFF64 *ABS*+0x44
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# IE against hidden but not local var
+ +[0-9a-f]+: 64 48 8b 0c 25 00 00[ ]+mov %fs:0x0,%rcx
+ +[0-9a-f]+: 00 00 *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 48 03 0d 0f 02 20 00[ ]+add 0x20020f\(%rip\),%rcx +# 201318 <.*>
+# -> R_X86_64_TPOFF64 *ABS*+0x64
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# Direct access through %fs
+# IE against global var
+ +[0-9a-f]+: 48 8b 0d 0c 02 20 00[ ]+mov 0x20020c\(%rip\),%rcx +# 201320 <.*>
+# -> R_X86_64_TPOFF64 sg5
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 64 48 8b 11[ ]+mov %fs:\(%rcx\),%rdx
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# IE against local var
+ +[0-9a-f]+: 4c 8b 15 eb 01 20 00[ ]+mov 0x2001eb\(%rip\),%r10 +# 201310 <.*>
+# -> R_X86_64_TPOFF64 *ABS*+0x30
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 64 4d 8b 22[ ]+mov %fs:\(%r10\),%r12
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# IE against hidden and local var
+ +[0-9a-f]+: 48 8b 15 f2 01 20 00[ ]+mov 0x2001f2\(%rip\),%rdx +# 201328 <.*>
+# -> R_X86_64_TPOFF64 *ABS*+0x50
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 64 48 8b 12[ ]+mov %fs:\(%rdx\),%rdx
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# IE against hidden but not local var
+ +[0-9a-f]+: 48 8b 0d e9 01 20 00[ ]+mov 0x2001e9\(%rip\),%rcx +# 201330 <.*>
+# -> R_X86_64_TPOFF64 *ABS*+0x70
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 64 48 8b 11[ ]+mov %fs:\(%rcx\),%rdx
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: c9[ ]+leaveq *
+ +[0-9a-f]+: c3[ ]+retq *
+ +[0-9a-f]+: 90[ ]+nop *
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.pd b/binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.pd
new file mode 100644
index 0000000..bf3bc2f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.pd
@@ -0,0 +1,20 @@
+#source: tlsdesc.s
+#source: tlspic2.s
+#as: --64
+#ld: -shared -melf_x86_64
+#objdump: -drj.plt
+#target: x86_64-*-*
+
+.*: +file format elf64-x86-64
+
+Disassembly of section .plt:
+
+[0-9a-f]+ <.*@plt-0x10>:
+ [0-9a-f]+: ff 35 .. .. 20 00 pushq .*\(%rip\) # 201358 <_GLOBAL_OFFSET_TABLE_\+0x8>
+ [0-9a-f]+: ff 25 .. .. 20 00 jmpq \*.*\(%rip\) # 201360 <_GLOBAL_OFFSET_TABLE_\+0x10>
+ [0-9a-f]+: 0f 1f 40 00 nopl 0x0\(%rax\)
+[0-9a-f]+ <.*@plt>:
+ [0-9a-f]+: ff 35 .. .. 20 00 pushq .*\(%rip\) # 201358 <_GLOBAL_OFFSET_TABLE_\+0x8>
+ [0-9a-f]+: ff 25 .. .. 20 00 jmpq \*.*\(%rip\) # 201348 <_DYNAMIC\+0x190>
+ [0-9a-f]+: 0f 1f 40 00 nopl 0x0\(%rax\)
+
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.rd b/binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.rd
new file mode 100644
index 0000000..662b639
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.rd
@@ -0,0 +1,160 @@
+#source: tlsdesc.s
+#source: tlspic2.s
+#as: --64
+#ld: -shared -melf_x86_64
+#readelf: -WSsrld
+#target: x86_64-*-*
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Address +Off +Size +ES Flg Lk Inf Al
+ +\[[ 0-9]+\] +NULL +0+ 0+ 0+ 00 +0 +0 +0
+ +\[[ 0-9]+\] .hash +.*
+ +\[[ 0-9]+\] .dynsym +.*
+ +\[[ 0-9]+\] .dynstr +.*
+ +\[[ 0-9]+\] .rela.dyn +.*
+ +\[[ 0-9]+\] .rela.plt +.*
+ +\[[ 0-9]+\] .plt +PROGBITS +0+450 0+450 0+20 10 +AX +0 +0 +4
+ +\[[ 0-9]+\] .text +PROGBITS +0+1000 0+1000 0+154 00 +AX +0 +0 4096
+ +\[[ 0-9]+\] .tdata +PROGBITS +0+201154 0+1154 0+60 00 WAT +0 +0 +1
+ +\[[ 0-9]+\] .tbss +NOBITS +0+2011b4 0+11b4 0+20 00 WAT +0 +0 +1
+ +\[[ 0-9]+\] .dynamic +DYNAMIC +0+2011b8 0+11b8 0+150 10 +WA +3 +0 +8
+ +\[[ 0-9]+\] .got +PROGBITS +0+201308 0+1308 0+48 08 +WA +0 +0 +8
+ +\[[ 0-9]+\] .got.plt +PROGBITS +0+201350 0+1350 0+68 08 +WA +0 +0 +8
+ +\[[ 0-9]+\] .shstrtab +.*
+ +\[[ 0-9]+\] .symtab +.*
+ +\[[ 0-9]+\] .strtab +.*
+Key to Flags:
+.*
+.*
+.*
+
+Elf file type is DYN \(Shared object file\)
+Entry point 0x1000
+There are [0-9]+ program headers, starting at offset [0-9]+
+
+Program Headers:
+ +Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg Align
+ +LOAD +0x0+ 0x0+ 0x0+ 0x[0-9a-f]+ 0x[0-9a-f]+ R E 0x200000
+ +LOAD +0x0+1154 0x0+201154 0x0+201154 0x0+264 0x0+264 RW +0x200000
+ +DYNAMIC +0x0+11b8 0x0+2011b8 0x0+2011b8 0x0+150 0x0+150 RW +0x8
+ +TLS +0x0+1154 0x0+201154 0x0+201154 0x0+60 0x0+80 R +0x1
+
+ Section to Segment mapping:
+ +Segment Sections...
+ +00 +.hash .dynsym .dynstr .rela.dyn .rela.plt .plt .text *
+ +01 +.tdata .dynamic .got .got.plt *
+ +02 +.dynamic *
+ +03 +.tdata .tbss *
+
+Dynamic section at offset 0x[0-9a-f]+ contains 16 entries:
+ +Tag +Type +Name/Value
+ 0x[0-9a-f]+ +\(HASH\).*
+ 0x[0-9a-f]+ +\(STRTAB\).*
+ 0x[0-9a-f]+ +\(SYMTAB\).*
+ 0x[0-9a-f]+ +\(STRSZ\).*
+ 0x[0-9a-f]+ +\(SYMENT\).*
+ 0x[0-9a-f]+ +\(PLTGOT\).*
+ 0x[0-9a-f]+ +\(PLTRELSZ\).*
+ 0x[0-9a-f]+ +\(PLTREL\).*
+ 0x[0-9a-f]+ +\(JMPREL\).*
+ 0x[0-9a-f]+ +\(TLSDESC_PLT\) +0x460
+ 0x[0-9a-f]+ +\(TLSDESC_GOT\) +0x201348
+ 0x[0-9a-f]+ +\(RELA\).*
+ 0x[0-9a-f]+ +\(RELASZ\).*
+ 0x[0-9a-f]+ +\(RELAENT\).*
+ 0x[0-9a-f]+ +\(FLAGS\).*
+ 0x[0-9a-f]+ +\(NULL\).*
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 8 entries:
+ +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
+0+201308 +[0-9a-f]+ R_X86_64_TPOFF64 +0+24
+0+201310 +[0-9a-f]+ R_X86_64_TPOFF64 +0+30
+0+201318 +[0-9a-f]+ R_X86_64_TPOFF64 +0+64
+0+201328 +[0-9a-f]+ R_X86_64_TPOFF64 +0+50
+0+201330 +[0-9a-f]+ R_X86_64_TPOFF64 +0+70
+0+201340 +[0-9a-f]+ R_X86_64_TPOFF64 +0+44
+0+201320 +[0-9a-f]+ R_X86_64_TPOFF64 +0+10 sg5 \+ 0
+0+201338 +[0-9a-f]+ R_X86_64_TPOFF64 +0+4 sg2 \+ 0
+
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 5 entries:
+ +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
+0+201398 +[0-9a-f]+ R_X86_64_TLSDESC +0+ sg1 \+ 0
+0+201368 +[0-9a-f]+ R_X86_64_TLSDESC +0+20
+0+2013a8 +[0-9a-f]+ R_X86_64_TLSDESC +0+40
+0+201378 +[0-9a-f]+ R_X86_64_TLSDESC +0+60
+0+201388 +[0-9a-f]+ R_X86_64_TLSDESC +0+
+
+Symbol table '\.dynsym' contains [0-9]+ entries:
+ +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+ +[0-9]+: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +7 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +8 *
+ +[0-9]+: 0+1c +0 +TLS +GLOBAL +DEFAULT +8 sg8
+ +[0-9]+: 0+8 +0 +TLS +GLOBAL +DEFAULT +8 sg3
+ +[0-9]+: 0+c +0 +TLS +GLOBAL +DEFAULT +8 sg4
+ +[0-9]+: 0+10 +0 +TLS +GLOBAL +DEFAULT +8 sg5
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +8 sg1
+ +[0-9]+: 0+1000 +0 +FUNC +GLOBAL +DEFAULT +7 fn1
+ +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS __bss_start
+ +[0-9]+: 0+4 +0 +TLS +GLOBAL +DEFAULT +8 sg2
+ +[0-9]+: 0+14 +0 +TLS +GLOBAL +DEFAULT +8 sg6
+ +[0-9]+: 0+18 +0 +TLS +GLOBAL +DEFAULT +8 sg7
+ +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _edata
+ +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _end
+
+Symbol table '\.symtab' contains [0-9]+ entries:
+ +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+ +[0-9]+: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +1 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +2 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +3 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +4 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +5 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +6 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +7 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +8 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +9 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +10 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +11 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +12 *
+ +[0-9]+: 0+20 +0 +TLS +LOCAL +DEFAULT +8 sl1
+ +[0-9]+: 0+24 +0 +TLS +LOCAL +DEFAULT +8 sl2
+ +[0-9]+: 0+28 +0 +TLS +LOCAL +DEFAULT +8 sl3
+ +[0-9]+: 0+2c +0 +TLS +LOCAL +DEFAULT +8 sl4
+ +[0-9]+: 0+30 +0 +TLS +LOCAL +DEFAULT +8 sl5
+ +[0-9]+: 0+34 +0 +TLS +LOCAL +DEFAULT +8 sl6
+ +[0-9]+: 0+38 +0 +TLS +LOCAL +DEFAULT +8 sl7
+ +[0-9]+: 0+3c +0 +TLS +LOCAL +DEFAULT +8 sl8
+ +[0-9]+: 0+60 +0 +TLS +LOCAL +DEFAULT +9 sH1
+ +[0-9]+: 0+ +0 +TLS +LOCAL +DEFAULT +8 _TLS_MODULE_BASE_
+ +[0-9]+: 0+2011b8 +0 +OBJECT +LOCAL +DEFAULT +ABS _DYNAMIC
+ +[0-9]+: 0+48 +0 +TLS +LOCAL +DEFAULT +8 sh3
+ +[0-9]+: 0+64 +0 +TLS +LOCAL +DEFAULT +9 sH2
+ +[0-9]+: 0+78 +0 +TLS +LOCAL +DEFAULT +9 sH7
+ +[0-9]+: 0+58 +0 +TLS +LOCAL +DEFAULT +8 sh7
+ +[0-9]+: 0+5c +0 +TLS +LOCAL +DEFAULT +8 sh8
+ +[0-9]+: 0+6c +0 +TLS +LOCAL +DEFAULT +9 sH4
+ +[0-9]+: 0+4c +0 +TLS +LOCAL +DEFAULT +8 sh4
+ +[0-9]+: 0+68 +0 +TLS +LOCAL +DEFAULT +9 sH3
+ +[0-9]+: 0+50 +0 +TLS +LOCAL +DEFAULT +8 sh5
+ +[0-9]+: 0+70 +0 +TLS +LOCAL +DEFAULT +9 sH5
+ +[0-9]+: 0+74 +0 +TLS +LOCAL +DEFAULT +9 sH6
+ +[0-9]+: 0+7c +0 +TLS +LOCAL +DEFAULT +9 sH8
+ +[0-9]+: 0+40 +0 +TLS +LOCAL +DEFAULT +8 sh1
+ +[0-9]+: 0+201350 +0 +OBJECT +LOCAL +DEFAULT +ABS _GLOBAL_OFFSET_TABLE_
+ +[0-9]+: 0+44 +0 +TLS +LOCAL +DEFAULT +8 sh2
+ +[0-9]+: 0+54 +0 +TLS +LOCAL +DEFAULT +8 sh6
+ +[0-9]+: 0+1c +0 +TLS +GLOBAL +DEFAULT +8 sg8
+ +[0-9]+: 0+8 +0 +TLS +GLOBAL +DEFAULT +8 sg3
+ +[0-9]+: 0+c +0 +TLS +GLOBAL +DEFAULT +8 sg4
+ +[0-9]+: 0+10 +0 +TLS +GLOBAL +DEFAULT +8 sg5
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +8 sg1
+ +[0-9]+: 0+1000 +0 +FUNC +GLOBAL +DEFAULT +7 fn1
+ +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS __bss_start
+ +[0-9]+: 0+4 +0 +TLS +GLOBAL +DEFAULT +8 sg2
+ +[0-9]+: 0+14 +0 +TLS +GLOBAL +DEFAULT +8 sg6
+ +[0-9]+: 0+18 +0 +TLS +GLOBAL +DEFAULT +8 sg7
+ +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _edata
+ +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _end
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.s b/binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.s
new file mode 100644
index 0000000..ec6d190
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.s
@@ -0,0 +1,157 @@
+ /* Force .data aligned to 4K, so .got very likely gets at 0x102190
+ (0x60 bytes .tdata and 0x130 bytes .dynamic) */
+ .data
+ .balign 4096
+ .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
+ /* Force .text aligned to 4K, so it very likely gets at 0x1000. */
+ .text
+ .balign 4096
+ .globl fn1
+ .type fn1,@function
+fn1:
+ pushq %rbp
+ movq %rsp, %rbp
+ nop;nop;nop;nop
+
+ /* GD */
+ leaq sg1@tlsdesc(%rip), %rax
+ call *sg1@tlscall(%rax)
+ nop;nop;nop;nop
+
+ /* GD -> IE because variable is referenced through IE too */
+ leaq sg2@tlsdesc(%rip), %rax
+ call *sg2@tlscall(%rax)
+ nop;nop;nop;nop
+
+ /* GD against local variable */
+ leaq sl1@tlsdesc(%rip), %rax
+ call *sl1@tlscall(%rax)
+ nop;nop;nop;nop
+
+ /* GD -> IE against local variable referenced through IE too */
+ leaq sl2@tlsdesc(%rip), %rax
+ call *sl2@tlscall(%rax)
+ nop;nop;nop;nop
+
+ /* GD against hidden and local variable */
+ leaq sh1@tlsdesc(%rip), %rax
+ call *sh1@tlscall(%rax)
+ nop;nop;nop;nop
+
+ /* GD -> IE against hidden and local variable referenced through
+ IE too */
+ leaq sh2@tlsdesc(%rip), %rax
+ call *sh2@tlscall(%rax)
+ nop;nop;nop;nop
+
+ /* GD against hidden but not local variable */
+ leaq sH1@tlsdesc(%rip), %rax
+ call *sH1@tlscall(%rax)
+ nop;nop;nop;nop
+
+ /* GD -> IE against hidden but not local variable referenced through
+ IE too */
+ leaq sH2@tlsdesc(%rip), %rax
+ call *sH2@tlscall(%rax)
+ nop;nop;nop;nop
+
+ /* LD */
+ leaq _TLS_MODULE_BASE_@tlsdesc(%rip), %rax
+ call *_TLS_MODULE_BASE_@tlscall(%rax)
+ nop;nop
+ leaq sl1@dtpoff(%rax), %rdx
+ nop;nop
+ leaq 2+sl2@dtpoff(%rax), %r9
+ nop;nop;nop;nop
+
+ /* LD against hidden and local variables */
+ leaq sh1@dtpoff(%rax), %rdx
+ nop;nop
+ leaq sh2@dtpoff+3(%rax), %rcx
+ nop;nop;nop;nop
+
+ /* LD against hidden but not local variables */
+ leaq sH1@dtpoff(%rax), %r12
+ nop;nop
+ leaq sH2@dtpoff+1(%rax), %rcx
+ nop;nop
+
+ /* IE against global var */
+ movq %fs:0, %rcx
+ nop;nop
+ addq sg2@gottpoff(%rip), %rcx
+ nop;nop;nop;nop
+
+ /* IE against local var */
+ movq %fs:0, %r14
+ nop;nop
+ addq sl2@gottpoff(%rip), %r14
+ nop;nop;nop;nop
+
+ /* IE against hidden and local var */
+ movq %fs:0, %rcx
+ nop;nop
+ addq sh2@gottpoff(%rip), %rcx
+ nop;nop;nop;nop
+
+ /* IE against hidden but not local var */
+ movq %fs:0, %rcx
+ nop;nop
+ addq sH2@gottpoff(%rip), %rcx
+ nop;nop;nop;nop
+
+ /* Direct access through %fs */
+
+ /* IE against global var */
+ movq sg5@gottpoff(%rip), %rcx
+ nop;nop
+ movq %fs:(%rcx), %rdx
+ nop;nop;nop;nop
+
+ /* IE against local var */
+ movq sl5@gottpoff(%rip), %r10
+ nop;nop
+ movq %fs:(%r10), %r12
+ nop;nop;nop;nop
+
+ /* IE against hidden and local var */
+ movq sh5@gottpoff(%rip), %rdx
+ nop;nop
+ movq %fs:(%rdx), %rdx
+ nop;nop;nop;nop
+
+ /* IE against hidden but not local var */
+ movq sH5@gottpoff(%rip), %rcx
+ nop;nop
+ movq %fs:(%rcx), %rdx
+ nop;nop;nop;nop
+
+ leave
+ ret
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.sd b/binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.sd
new file mode 100644
index 0000000..7eb474a
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.sd
@@ -0,0 +1,23 @@
+#source: tlsdesc.s
+#source: tlspic2.s
+#as: --64
+#ld: -shared -melf_x86_64
+#objdump: -s -j.got -j.got.plt
+#target: x86_64-*-*
+
+.*: +file format elf64-x86-64
+
+Contents of section \.got:
+ 201308 00000000 00000000 00000000 00000000 .*
+ 201318 00000000 00000000 00000000 00000000 .*
+ 201328 00000000 00000000 00000000 00000000 .*
+ 201338 00000000 00000000 00000000 00000000 .*
+ 201348 00000000 00000000 .*
+Contents of section \.got\.plt:
+ 201350 b8112000 00000000 00000000 00000000 .*
+ 201360 00000000 00000000 00000000 00000000 .*
+ 201370 00000000 00000000 00000000 00000000 .*
+ 201380 00000000 00000000 00000000 00000000 .*
+ 201390 00000000 00000000 00000000 00000000 .*
+ 2013a0 00000000 00000000 00000000 00000000 .*
+ 2013b0 00000000 00000000 .*
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.td b/binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.td
new file mode 100644
index 0000000..6b8098c
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsdesc.td
@@ -0,0 +1,16 @@
+#source: tlsdesc.s
+#source: tlspic2.s
+#as: --64
+#ld: -shared -melf_x86_64
+#objdump: -sj.tdata
+#target: x86_64-*-*
+
+.*: +file format elf64-x86-64
+
+Contents of section .tdata:
+ 201154 11000000 12000000 13000000 14000000 .*
+ 201164 15000000 16000000 17000000 18000000 .*
+ 201174 41000000 42000000 43000000 44000000 .*
+ 201184 45000000 46000000 47000000 48000000 .*
+ 201194 01010000 02010000 03010000 04010000 .*
+ 2011a4 05010000 06010000 07010000 08010000 .*
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsg.s b/binutils-2.21/ld/testsuite/ld-x86-64/tlsg.s
new file mode 100644
index 0000000..048e98f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsg.s
@@ -0,0 +1,12 @@
+ .section .tbss,"awT",@nobits
+ .align 4
+ .skip 24
+ .type a,@object
+ .size a,4
+a:
+ .zero 4
+ .text
+ .globl _start
+_start:
+ .section .debug_foobar
+ .long a@dtpoff, 0
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsg.sd b/binutils-2.21/ld/testsuite/ld-x86-64/tlsg.sd
new file mode 100644
index 0000000..4eaf3cd
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsg.sd
@@ -0,0 +1,10 @@
+#source: tlsg.s
+#as: --64
+#ld: -melf_x86_64
+#objdump: -sj.debug_foobar
+#target: x86_64-*-*
+
+.*: +file format elf64-x86-64
+
+Contents of section .debug_foobar:
+ 0+ 18000000 0+ +.*
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsgd1.dd b/binutils-2.21/ld/testsuite/ld-x86-64/tlsgd1.dd
new file mode 100644
index 0000000..b4f3c99
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsgd1.dd
@@ -0,0 +1,14 @@
+#source: tlsgd1.s
+#as: --64
+#ld: -melf_x86_64 tmpdir/tlsgd1
+#objdump: -drw
+#target: x86_64-*-linux*
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: 64 48 8b 04 25 00 00 00 00 mov %fs:0x0,%rax
+[ ]*[a-f0-9]+: 48 8d 80 fc ff ff ff lea -0x4\(%rax\),%rax
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsgd1.s b/binutils-2.21/ld/testsuite/ld-x86-64/tlsgd1.s
new file mode 100644
index 0000000..e5f52ed
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsgd1.s
@@ -0,0 +1,15 @@
+ .text
+ .globl _start
+_start:
+ .byte 0x66
+ leaq foo@TLSGD(%rip), %rdi
+ .word 0x6666
+ rex64
+ call __tls_get_addr
+ .globl foo
+ .section .tdata,"awT",@progbits
+ .align 4
+ .type foo, @object
+ .size foo, 4
+foo:
+ .long 100
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsgd2.d b/binutils-2.21/ld/testsuite/ld-x86-64/tlsgd2.d
new file mode 100644
index 0000000..494560b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsgd2.d
@@ -0,0 +1,4 @@
+#name: TLS GD->IE transition check
+#as: --64
+#ld: -melf_x86_64
+#error: .*TLS transition from R_X86_64_TLSGD to R_X86_64_GOTTPOFF against `foo'.*failed.*
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsgd2.s b/binutils-2.21/ld/testsuite/ld-x86-64/tlsgd2.s
new file mode 100644
index 0000000..f583c85
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsgd2.s
@@ -0,0 +1,5 @@
+ .text
+ .globl _start
+_start:
+ leaq foo@TLSGD(%rip), %rdi
+ call __tls_get_addr
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsgd3.d b/binutils-2.21/ld/testsuite/ld-x86-64/tlsgd3.d
new file mode 100644
index 0000000..a8830e9
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsgd3.d
@@ -0,0 +1,4 @@
+#name: TLS GD->LE transition check
+#as: --64
+#ld: -melf_x86_64
+#error: .*TLS transition from R_X86_64_TLSGD to R_X86_64_TPOFF32 against `foo'.*failed.*
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsgd3.s b/binutils-2.21/ld/testsuite/ld-x86-64/tlsgd3.s
new file mode 100644
index 0000000..e1e7e60
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsgd3.s
@@ -0,0 +1,11 @@
+ .text
+ .globl _start
+_start:
+ leaq foo@TLSGD(%rip), %rdi
+ call __tls_get_addr
+ .section .tdata,"awT",@progbits
+ .align 4
+ .type foo, @object
+ .size foo, 4
+foo:
+ .long 100
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsgdesc.dd b/binutils-2.21/ld/testsuite/ld-x86-64/tlsgdesc.dd
new file mode 100644
index 0000000..75e8da4
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsgdesc.dd
@@ -0,0 +1,163 @@
+#source: tlsgdesc.s
+#as: --64
+#ld: -shared -melf_x86_64
+#objdump: -drj.text
+#target: x86_64-*-*
+
+.*: +file format elf64-x86-64
+
+Disassembly of section .text:
+
+0+[0-9a-f]+ <fc1>:
+ +[0-9a-f]+: 55[ ]+push %rbp
+ +[0-9a-f]+: 48 89 e5[ ]+mov %rsp,%rbp
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# IE
+ +[0-9a-f]+: 64 48 8b 0c 25 00 00[ ]+mov %fs:0x0,%rcx
+ +[0-9a-f]+: 00 00 *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 48 03 0d 5e 02 20 00[ ]+add 0x20025e\(%rip\),%rcx +# 200660 <.*>
+# -> R_X86_64_TPOFF64 sG3
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# IE
+ +[0-9a-f]+: 64 48 8b 0c 25 00 00[ ]+mov %fs:0x0,%rcx
+ +[0-9a-f]+: 00 00 *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 48 03 0d 68 02 20 00[ ]+add 0x200268\(%rip\),%rcx +# 200680 <.*>
+# -> R_X86_64_TPOFF64 sG4
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# GD, gd first
+ +[0-9a-f]+: 66 48 8d 3d 6c 02 20[ ]+data32 lea 0x20026c\(%rip\),%rdi +# 200690 <.*>
+ +[0-9a-f]+: 00 *
+# -> R_X86_64_DTPMOD64 sG1
+ +[0-9a-f]+: 66 66 48 e8 9c ff ff[ ]+data32 data32 callq [0-9a-f]+ <.*>
+ +[0-9a-f]+: ff[ ]+
+# -> R_X86_64_JUMP_SLOT __tls_get_addr
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 48 8d 05 a1 02 20 00[ ]+lea 0x2002a1\(%rip\),%rax +# 2006d8 <.*>
+# -> R_X86_64_TLSDESC sG1
+ +[0-9a-f]+: ff 10[ ]+callq \*\(%rax\)
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# GD, desc first
+ +[0-9a-f]+: 48 8d 05 84 02 20 00[ ]+lea 0x200284\(%rip\),%rax +# 2006c8 <.*>
+# -> R_X86_64_TLSDESC sG2
+ +[0-9a-f]+: ff 10[ ]+callq \*\(%rax\)
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 66 48 8d 3d 1e 02 20[ ]+data32 lea 0x20021e\(%rip\),%rdi +# 200670 <.*>
+ +[0-9a-f]+: 00 *
+# -> R_X86_64_DTPMOD64 sG2
+ +[0-9a-f]+: 66 66 48 e8 6e ff ff[ ]+data32 data32 callq [0-9a-f]+ <.*>
+ +[0-9a-f]+: ff[ ]+
+# -> R_X86_64_JUMP_SLOT __tls_get_addr
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# GD -> IE, gd first, after IE use
+ +[0-9a-f]+: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
+ +[0-9a-f]+: 00 00 *
+ +[0-9a-f]+: 48 03 05 f2 01 20 00[ ]+add 0x2001f2\(%rip\),%rax +# 200660 <.*>
+# -> R_X86_64_TPOFF64 sG3
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 48 8b 05 e7 01 20 00[ ]+mov 0x2001e7\(%rip\),%rax +# 200660 <.*>
+# -> R_X86_64_TPOFF64 sG3
+ +[0-9a-f]+: 66 90[ ]+xchg %ax,%ax
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# GD -> IE, desc first, after IE use
+ +[0-9a-f]+: 48 8b 05 fa 01 20 00[ ]+mov 0x2001fa\(%rip\),%rax +# 200680 <.*>
+# -> R_X86_64_TPOFF64 sG4
+ +[0-9a-f]+: 66 90[ ]+xchg %ax,%ax
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
+ +[0-9a-f]+: 00 00 *
+ +[0-9a-f]+: 48 03 05 e4 01 20 00[ ]+add 0x2001e4\(%rip\),%rax +# 200680 <.*>
+# -> R_X86_64_TPOFF64 sG4
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# GD -> IE, gd first, before IE use
+ +[0-9a-f]+: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
+ +[0-9a-f]+: 00 00 *
+ +[0-9a-f]+: 48 03 05 b8 01 20 00[ ]+add 0x2001b8\(%rip\),%rax +# 200668 <.*>
+# -> R_X86_64_TPOFF64 sG5
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 48 8b 05 ad 01 20 00[ ]+mov 0x2001ad\(%rip\),%rax +# 200668 <.*>
+# -> R_X86_64_TPOFF64 sG5
+ +[0-9a-f]+: 66 90[ ]+xchg %ax,%ax
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# GD -> IE, desc first, before IE use
+ +[0-9a-f]+: 48 8b 05 c0 01 20 00[ ]+mov 0x2001c0\(%rip\),%rax +# 200688 <.*>
+# -> R_X86_64_TPOFF64 sG6
+ +[0-9a-f]+: 66 90[ ]+xchg %ax,%ax
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
+ +[0-9a-f]+: 00 00 *
+ +[0-9a-f]+: 48 03 05 aa 01 20 00[ ]+add 0x2001aa\(%rip\),%rax +# 200688 <.*>
+# -> R_X86_64_TPOFF64 sG6
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# IE
+ +[0-9a-f]+: 64 48 8b 0c 25 00 00[ ]+mov %fs:0x0,%rcx
+ +[0-9a-f]+: 00 00 *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 48 03 0d 74 01 20 00[ ]+add 0x200174\(%rip\),%rcx +# 200668 <.*>
+# -> R_X86_64_TPOFF64 sG5
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+# IE
+ +[0-9a-f]+: 64 48 8b 0c 25 00 00[ ]+mov %fs:0x0,%rcx
+ +[0-9a-f]+: 00 00 *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 48 03 0d 7e 01 20 00[ ]+add 0x20017e\(%rip\),%rcx +# 200688 <.*>
+# -> R_X86_64_TPOFF64 sG6
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: 90[ ]+nop *
+ +[0-9a-f]+: c9[ ]+leaveq *
+ +[0-9a-f]+: c3[ ]+retq *
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsgdesc.rd b/binutils-2.21/ld/testsuite/ld-x86-64/tlsgdesc.rd
new file mode 100644
index 0000000..61d2fa8
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsgdesc.rd
@@ -0,0 +1,104 @@
+#source: tlsgdesc.s
+#as: --64
+#ld: -shared -melf64_x86_64
+#readelf: -WSsrl
+#target: x86_64-*-*
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Address +Off +Size +ES Flg Lk Inf Al
+ +\[[ 0-9]+\] +NULL +0+ 0+ 0+ 0+ +0 +0 +0
+ +\[[ 0-9]+\] \.hash +.*
+ +\[[ 0-9]+\] \.dynsym +.*
+ +\[[ 0-9]+\] \.dynstr +.*
+ +\[[ 0-9]+\] \.rela.dyn +.*
+ +\[[ 0-9]+\] \.rela.plt +.*
+ +\[[ 0-9]+\] \.plt +.*
+ +\[[ 0-9]+\] \.text +.*
+ +\[[ 0-9]+\] \.dynamic +.*
+ +\[[ 0-9]+\] \.got +.*
+ +\[[ 0-9]+\] \.got.plt +.*
+ +\[[ 0-9]+\] \.shstrtab +.*
+ +\[[ 0-9]+\] \.symtab +.*
+ +\[[ 0-9]+\] \.strtab +.*
+Key to Flags:
+.*
+.*
+.*
+
+Elf file type is DYN \(Shared object file\)
+Entry point 0x[0-9a-f]+
+There are [0-9]+ program headers, starting at offset [0-9]+
+
+Program Headers:
+ +Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg Align
+ +LOAD.*
+ +LOAD.*
+ +DYNAMIC.*
+
+ Section to Segment mapping:
+ +Segment Sections...
+ +00 +.hash .dynsym .dynstr .rela.dyn .rela.plt .plt .text *
+ +01 +.dynamic .got .got.plt *
+ +02 +.dynamic *
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 8 entries:
+ +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
+[0-9a-f]+ +0+200000012 R_X86_64_TPOFF64 +0+ sG3 \+ 0
+[0-9a-f]+ +0+300000012 R_X86_64_TPOFF64 +0+ sG5 \+ 0
+[0-9a-f]+ +0+400000010 R_X86_64_DTPMOD64 +0+ sG2 \+ 0
+[0-9a-f]+ +0+400000011 R_X86_64_DTPOFF64 +0+ sG2 \+ 0
+[0-9a-f]+ +0+500000012 R_X86_64_TPOFF64 +0+ sG4 \+ 0
+[0-9a-f]+ +0+800000012 R_X86_64_TPOFF64 +0+ sG6 \+ 0
+[0-9a-f]+ +0+a00000010 R_X86_64_DTPMOD64 +0+ sG1 \+ 0
+[0-9a-f]+ +0+a00000011 R_X86_64_DTPOFF64 +0+ sG1 \+ 0
+
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 3 entries:
+ +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
+[0-9a-f]+ +0+600000007 R_X86_64_JUMP_SLOT +0+ __tls_get_addr \+ 0
+[0-9a-f]+ +0+a00000024 R_X86_64_TLSDESC +0+ sG1 \+ 0
+[0-9a-f]+ +0+400000024 R_X86_64_TLSDESC +0+ sG2 \+ 0
+
+Symbol table '\.dynsym' contains [0-9]+ entries:
+ +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+ +[0-9]+: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +7 *
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG3
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG5
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG2
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG4
+ +[0-9]+: 0+ +0 +NOTYPE +GLOBAL +DEFAULT +UND __tls_get_addr
+ +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS __bss_start
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG6
+ +[0-9]+: [0-9a-f]+ +0 +FUNC +GLOBAL +DEFAULT +7 fc1
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG1
+ +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _edata
+ +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _end
+
+Symbol table '\.symtab' contains [0-9]+ entries:
+ +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+ +[0-9]+: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +1 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +2 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +3 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +4 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +5 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +6 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +7 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +8 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +9 *
+ +[0-9]+: [0-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +10 *
+ +[0-9]+: [0-9a-f]+ +0 +OBJECT +LOCAL +DEFAULT +ABS _DYNAMIC
+ +[0-9]+: [0-9a-f]+ +0 +OBJECT +LOCAL +DEFAULT +ABS _GLOBAL_OFFSET_TABLE_
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG3
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG5
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG2
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG4
+ +[0-9]+: 0+ +0 +NOTYPE +GLOBAL +DEFAULT +UND __tls_get_addr
+ +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS __bss_start
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG6
+ +[0-9]+: [0-9a-f]+ +0 +FUNC +GLOBAL +DEFAULT +7 fc1
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG1
+ +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _edata
+ +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _end
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsgdesc.s b/binutils-2.21/ld/testsuite/ld-x86-64/tlsgdesc.s
new file mode 100644
index 0000000..6657e72
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsgdesc.s
@@ -0,0 +1,106 @@
+ .text
+ .globl fc1
+ .type fc1,@function
+fc1:
+ pushq %rbp
+ movq %rsp, %rbp
+ nop;nop;nop;nop
+
+ /* IE against global var. */
+ movq %fs:0, %rcx
+ nop;nop
+ addq sG3@gottpoff(%rip), %rcx
+ nop;nop;nop;nop
+
+ /* IE against global var. */
+ movq %fs:0, %rcx
+ nop;nop
+ addq sG4@gottpoff(%rip), %rcx
+ nop;nop;nop;nop
+
+ /* GD, gd first. */
+ .byte 0x66
+ leaq sG1@tlsgd(%rip), %rdi
+ .word 0x6666
+ rex64
+ call __tls_get_addr@plt
+ nop;nop;nop;nop
+
+ leaq sG1@tlsdesc(%rip), %rax
+ call *sG1@tlscall(%rax)
+ nop;nop;nop;nop
+
+ /* GD, desc first. */
+ leaq sG2@tlsdesc(%rip), %rax
+ call *sG2@tlscall(%rax)
+ nop;nop;nop;nop
+
+ .byte 0x66
+ leaq sG2@tlsgd(%rip), %rdi
+ .word 0x6666
+ rex64
+ call __tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE, gd first, after IE use. */
+ .byte 0x66
+ leaq sG3@tlsgd(%rip), %rdi
+ .word 0x6666
+ rex64
+ call __tls_get_addr@plt
+ nop;nop;nop;nop
+
+ leaq sG3@tlsdesc(%rip), %rax
+ call *sG3@tlscall(%rax)
+ nop;nop;nop;nop
+
+ /* GD -> IE, desc first, after IE use. */
+ leaq sG4@tlsdesc(%rip), %rax
+ call *sG4@tlscall(%rax)
+ nop;nop;nop;nop
+
+ .byte 0x66
+ leaq sG4@tlsgd(%rip), %rdi
+ .word 0x6666
+ rex64
+ call __tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE, gd first, before IE use. */
+ .byte 0x66
+ leaq sG5@tlsgd(%rip), %rdi
+ .word 0x6666
+ rex64
+ call __tls_get_addr@plt
+ nop;nop;nop;nop
+
+ leaq sG5@tlsdesc(%rip), %rax
+ call *sG5@tlscall(%rax)
+ nop;nop;nop;nop
+
+ /* GD -> IE, desc first, before IE use. */
+ leaq sG6@tlsdesc(%rip), %rax
+ call *sG6@tlscall(%rax)
+ nop;nop;nop;nop
+
+ .byte 0x66
+ leaq sG6@tlsgd(%rip), %rdi
+ .word 0x6666
+ rex64
+ call __tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* IE against global var. */
+ movq %fs:0, %rcx
+ nop;nop
+ addq sG5@gottpoff(%rip), %rcx
+ nop;nop;nop;nop
+
+ /* IE against global var. */
+ movq %fs:0, %rcx
+ nop;nop
+ addq sG6@gottpoff(%rip), %rcx
+ nop;nop;nop;nop
+
+ leave
+ ret
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsie1.dd b/binutils-2.21/ld/testsuite/ld-x86-64/tlsie1.dd
new file mode 100644
index 0000000..74dc39b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsie1.dd
@@ -0,0 +1,16 @@
+#source: tlsie1.s
+#as: --64
+#ld: -melf_x86_64 tmpdir/tlsie1
+#objdump: -drw
+#target: x86_64-*-linux*
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: 48 c7 c0 fc ff ff ff mov \$0xfffffffffffffffc,%rax
+[ ]*[a-f0-9]+: 48 8d 80 fc ff ff ff lea -0x4\(%rax\),%rax
+[ ]*[a-f0-9]+: 49 c7 c4 fc ff ff ff mov \$0xfffffffffffffffc,%r12
+[ ]*[a-f0-9]+: 49 81 c4 fc ff ff ff add \$0xfffffffffffffffc,%r12
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsie1.s b/binutils-2.21/ld/testsuite/ld-x86-64/tlsie1.s
new file mode 100644
index 0000000..c7722b1
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsie1.s
@@ -0,0 +1,14 @@
+ .text
+ .globl _start
+_start:
+ movq foo@GOTTPOFF(%rip), %rax
+ addq foo@GOTTPOFF(%rip), %rax
+ movq foo@GOTTPOFF(%rip), %r12
+ addq foo@GOTTPOFF(%rip), %r12
+ .globl foo
+ .section .tdata,"awT",@progbits
+ .align 4
+ .type foo, @object
+ .size foo, 4
+foo:
+ .long 100
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsie2.d b/binutils-2.21/ld/testsuite/ld-x86-64/tlsie2.d
new file mode 100644
index 0000000..97dcc28
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsie2.d
@@ -0,0 +1,4 @@
+#name: TLS IE->LE transition check
+#as: --64
+#ld: -melf_x86_64
+#error: .*TLS transition from R_X86_64_GOTTPOFF to R_X86_64_TPOFF32 against `foo'.*failed.*
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsie2.s b/binutils-2.21/ld/testsuite/ld-x86-64/tlsie2.s
new file mode 100644
index 0000000..c9b9bfb
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsie2.s
@@ -0,0 +1,12 @@
+ .text
+ .globl _start
+_start:
+ leaq foo@GOTTPOFF(%rip), %rax
+ movq (%rax), %rax
+ .globl foo
+ .section .tdata,"awT",@progbits
+ .align 4
+ .type foo, @object
+ .size foo, 4
+foo:
+ .long 100
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsie3.d b/binutils-2.21/ld/testsuite/ld-x86-64/tlsie3.d
new file mode 100644
index 0000000..8c982a6
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsie3.d
@@ -0,0 +1,4 @@
+#name: TLS IE->LE transition check (%r12)
+#as: --64
+#ld: -melf_x86_64
+#error: .*TLS transition from R_X86_64_GOTTPOFF to R_X86_64_TPOFF32 against `foo'.*failed.*
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsie3.s b/binutils-2.21/ld/testsuite/ld-x86-64/tlsie3.s
new file mode 100644
index 0000000..13faf34
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsie3.s
@@ -0,0 +1,12 @@
+ .text
+ .globl _start
+_start:
+ leaq foo@GOTTPOFF(%rip), %r12
+ movq (%r12), %r12
+ .globl foo
+ .section .tdata,"awT",@progbits
+ .align 4
+ .type foo, @object
+ .size foo, 4
+foo:
+ .long 100
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsld1.dd b/binutils-2.21/ld/testsuite/ld-x86-64/tlsld1.dd
new file mode 100644
index 0000000..e91ce08
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsld1.dd
@@ -0,0 +1,13 @@
+#source: tlsld1.s
+#as: --64
+#ld: -melf_x86_64 tmpdir/tlsld1
+#objdump: -drw
+#target: x86_64-*-linux*
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: 66 66 66 64 48 8b 04 25 00 00 00 00 data32 data32 data32 mov %fs:0x0,%rax
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsld1.s b/binutils-2.21/ld/testsuite/ld-x86-64/tlsld1.s
new file mode 100644
index 0000000..6dcdd69
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsld1.s
@@ -0,0 +1,12 @@
+ .text
+ .globl _start
+_start:
+ leaq foo@TLSLD(%rip), %rdi
+ call __tls_get_addr
+ .globl foo
+ .section .tdata,"awT",@progbits
+ .align 4
+ .type foo, @object
+ .size foo, 4
+foo:
+ .long 100
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsle1.d b/binutils-2.21/ld/testsuite/ld-x86-64/tlsle1.d
new file mode 100644
index 0000000..2142ef5
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsle1.d
@@ -0,0 +1,6 @@
+#name: TLS LE with PIE
+#as: --64
+#ld: -melf_x86_64 -pie
+#readelf: -r
+
+There are no relocations in this file.
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlsle1.s b/binutils-2.21/ld/testsuite/ld-x86-64/tlsle1.s
new file mode 100644
index 0000000..4346a5d
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlsle1.s
@@ -0,0 +1,11 @@
+ .text
+ .globl _start
+_start:
+ movl $0, %fs:foo@TPOFF
+ .globl foo
+ .section .tdata,"awT",@progbits
+ .align 4
+ .type foo, @object
+ .size foo, 4
+foo:
+ .long 100
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlslib.s b/binutils-2.21/ld/testsuite/ld-x86-64/tlslib.s
new file mode 100644
index 0000000..9eccc08
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlslib.s
@@ -0,0 +1,18 @@
+ .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
+ .type __tls_get_addr,@function
+__tls_get_addr:
+ movq %rdi, %rax
+ ret
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlspic.dd b/binutils-2.21/ld/testsuite/ld-x86-64/tlspic.dd
new file mode 100644
index 0000000..e1b64fc
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlspic.dd
@@ -0,0 +1,230 @@
+#source: tlspic1.s
+#source: tlspic2.s
+#as: --64
+#ld: -shared -melf_x86_64
+#objdump: -drj.text
+#target: x86_64-*-*
+
+.*: +file format elf64-x86-64
+
+Disassembly of section .text:
+
+0+1000 <fn1>:
+ +1000: 55[ ]+push %rbp
+ +1001: 48 89 e5[ ]+mov %rsp,%rbp
+ +1004: 90[ ]+nop *
+ +1005: 90[ ]+nop *
+ +1006: 90[ ]+nop *
+ +1007: 90[ ]+nop *
+# GD
+ +1008: 66 48 8d 3d 80 03 20[ ]+data32 lea 0x200380\(%rip\),%rdi +# 201390 <.*>
+ +100f: 00 *
+# -> R_X86_64_DTPMOD64 sg1
+ +1010: 66 66 48 e8 [0-9a-f ]+data32 data32 callq [0-9a-f]+ <.*>
+# -> R_X86_64_JUMP_SLOT __tls_get_addr
+ +1017: [0-9a-f ]+
+ +1018: 90[ ]+nop *
+ +1019: 90[ ]+nop *
+ +101a: 90[ ]+nop *
+ +101b: 90[ ]+nop *
+# GD -> IE because variable is referenced through IE too
+ +101c: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
+ +1023: 00 00 *
+ +1025: 48 03 05 84 03 20 00[ ]+add 0x200384\(%rip\),%rax +# 2013b0 <.*>
+# -> R_X86_64_TPOFF64 sg2
+ +102c: 90[ ]+nop *
+ +102d: 90[ ]+nop *
+ +102e: 90[ ]+nop *
+ +102f: 90[ ]+nop *
+# GD against local variable
+ +1030: 66 48 8d 3d 08 03 20[ ]+data32 lea 0x200308\(%rip\),%rdi +# 201340 <.*>
+ +1037: 00 *
+# -> R_X86_64_DTPMOD64 [0 0x2000000000000000]
+ +1038: 66 66 48 e8 [0-9a-f ]+data32 data32 callq [0-9a-f]+ <.*>
+# -> R_X86_64_JUMP_SLOT __tls_get_addr
+ +103f: [0-9a-f ]+
+ +1040: 90[ ]+nop *
+ +1041: 90[ ]+nop *
+ +1042: 90[ ]+nop *
+ +1043: 90[ ]+nop *
+# GD -> IE against local variable referenced through IE too
+ +1044: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
+ +104b: 00 00 *
+ +104d: 48 03 05 fc 02 20 00[ ]+add 0x2002fc\(%rip\),%rax +# 201350 <.*>
+# -> R_X86_64_TPOFF64 *ABS*+0x24
+ +1054: 90[ ]+nop *
+ +1055: 90[ ]+nop *
+ +1056: 90[ ]+nop *
+ +1057: 90[ ]+nop *
+# GD against hidden and local variable
+ +1058: 66 48 8d 3d 58 03 20[ ]+data32 lea 0x200358\(%rip\),%rdi +# 2013b8 <.*>
+ +105f: 00 *
+# -> R_X86_64_DTPMOD64 [0 0x4000000000000000]
+ +1060: 66 66 48 e8 [0-9a-f ]+data32 data32 callq [0-9a-f]+ <.*>
+# -> R_X86_64_JUMP_SLOT __tls_get_addr
+ +1067: [0-9a-f ]+
+ +1068: 90[ ]+nop *
+ +1069: 90[ ]+nop *
+ +106a: 90[ ]+nop *
+ +106b: 90[ ]+nop *
+# GD -> IE against hidden and local variable referenced through IE too
+ +106c: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
+ +1073: 00 00 *
+ +1075: 48 03 05 4c 03 20 00[ ]+add 0x20034c\(%rip\),%rax +# 2013c8 <.*>
+# -> R_X86_64_TPOFF64 *ABS*+0x44
+ +107c: 90[ ]+nop *
+ +107d: 90[ ]+nop *
+ +107e: 90[ ]+nop *
+ +107f: 90[ ]+nop *
+# GD against hidden but not local variable
+ +1080: 66 48 8d 3d e8 02 20[ ]+data32 lea 0x2002e8\(%rip\),%rdi +# 201370 <.*>
+ +1087: 00 *
+# -> R_X86_64_DTPMOD64 [0 0x6000000000000000]
+ +1088: 66 66 48 e8 [0-9a-f ]+data32 data32 callq [0-9a-f]+ <.*>
+# -> R_X86_64_JUMP_SLOT __tls_get_addr
+ +108f: [0-9a-f ]+
+ +1090: 90[ ]+nop *
+ +1091: 90[ ]+nop *
+ +1092: 90[ ]+nop *
+ +1093: 90[ ]+nop *
+# GD -> IE against hidden but not local variable referenced through IE too
+ +1094: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
+ +109b: 00 00 *
+ +109d: 48 03 05 dc 02 20 00[ ]+add 0x2002dc\(%rip\),%rax +# 201380 <.*>
+# -> R_X86_64_TPOFF64 *ABS*+0x64
+ +10a4: 90[ ]+nop *
+ +10a5: 90[ ]+nop *
+ +10a6: 90[ ]+nop *
+ +10a7: 90[ ]+nop *
+# LD
+ +10a8: 48 8d 3d b1 02 20 00[ ]+lea 0x2002b1\(%rip\),%rdi +# 201360 <.*>
+# -> R_X86_64_DTPMOD64 [0 0x000000000000000]
+ +10af: e8 [0-9a-f ]+callq [0-9a-f]+ <.*>
+# -> R_X86_64_JUMP_SLOT __tls_get_addr
+ +10b4: 90[ ]+nop *
+ +10b5: 90[ ]+nop *
+ +10b6: 48 8d 90 20 00 00 00[ ]+lea 0x20\(%rax\),%rdx
+ +10bd: 90[ ]+nop *
+ +10be: 90[ ]+nop *
+ +10bf: 4c 8d 88 26 00 00 00[ ]+lea 0x26\(%rax\),%r9
+ +10c6: 90[ ]+nop *
+ +10c7: 90[ ]+nop *
+ +10c8: 90[ ]+nop *
+ +10c9: 90[ ]+nop *
+# LD against hidden and local variables
+ +10ca: 48 8d 3d 8f 02 20 00[ ]+lea 0x20028f\(%rip\),%rdi +# 201360 <.*>
+# -> R_X86_64_DTPMOD64 [0 0x000000000000000]
+ +10d1: e8 [0-9a-f ]+callq [0-9a-f]+ <.*>
+# -> R_X86_64_JUMP_SLOT __tls_get_addr
+ +10d6: 90[ ]+nop *
+ +10d7: 90[ ]+nop *
+ +10d8: 48 8d 90 40 00 00 00[ ]+lea 0x40\(%rax\),%rdx
+ +10df: 90[ ]+nop *
+ +10e0: 90[ ]+nop *
+ +10e1: 48 8d 88 47 00 00 00[ ]+lea 0x47\(%rax\),%rcx
+ +10e8: 90[ ]+nop *
+ +10e9: 90[ ]+nop *
+ +10ea: 90[ ]+nop *
+ +10eb: 90[ ]+nop *
+# LD against hidden but not local variables
+ +10ec: 48 8d 3d 6d 02 20 00[ ]+lea 0x20026d\(%rip\),%rdi +# 201360 <.*>
+# -> R_X86_64_DTPMOD64 [0 0x000000000000000]
+ +10f3: e8 [0-9a-f ]+callq [0-9a-f]+ <.*>
+# -> R_X86_64_JUMP_SLOT __tls_get_addr
+ +10f8: 90[ ]+nop *
+ +10f9: 90[ ]+nop *
+ +10fa: 4c 8d a0 60 00 00 00[ ]+lea 0x60\(%rax\),%r12
+ +1101: 90[ ]+nop *
+ +1102: 90[ ]+nop *
+ +1103: 48 8d 88 65 00 00 00[ ]+lea 0x65\(%rax\),%rcx
+ +110a: 90[ ]+nop *
+ +110b: 90[ ]+nop *
+# IE against global var
+ +110c: 64 48 8b 0c 25 00 00[ ]+mov %fs:0x0,%rcx
+ +1113: 00 00 *
+ +1115: 90[ ]+nop *
+ +1116: 90[ ]+nop *
+ +1117: 48 03 0d 92 02 20 00[ ]+add 0x200292\(%rip\),%rcx +# 2013b0 <.*>
+# -> R_X86_64_TPOFF64 sg2
+ +111e: 90[ ]+nop *
+ +111f: 90[ ]+nop *
+ +1120: 90[ ]+nop *
+ +1121: 90[ ]+nop *
+# IE against local var
+ +1122: 64 4c 8b 34 25 00 00[ ]+mov %fs:0x0,%r14
+ +1129: 00 00 *
+ +112b: 90[ ]+nop *
+ +112c: 90[ ]+nop *
+ +112d: 4c 03 35 1c 02 20 00[ ]+add 0x20021c\(%rip\),%r14 +# 201350 <.*>
+# -> R_X86_64_TPOFF64 *ABS*+0x24
+ +1134: 90[ ]+nop *
+ +1135: 90[ ]+nop *
+ +1136: 90[ ]+nop *
+ +1137: 90[ ]+nop *
+# IE against hidden and local var
+ +1138: 64 48 8b 0c 25 00 00[ ]+mov %fs:0x0,%rcx
+ +113f: 00 00 *
+ +1141: 90[ ]+nop *
+ +1142: 90[ ]+nop *
+ +1143: 48 03 0d 7e 02 20 00[ ]+add 0x20027e\(%rip\),%rcx +# 2013c8 <.*>
+# -> R_X86_64_TPOFF64 *ABS*+0x44
+ +114a: 90[ ]+nop *
+ +114b: 90[ ]+nop *
+ +114c: 90[ ]+nop *
+ +114d: 90[ ]+nop *
+# IE against hidden but not local var
+ +114e: 64 48 8b 0c 25 00 00[ ]+mov %fs:0x0,%rcx
+ +1155: 00 00 *
+ +1157: 90[ ]+nop *
+ +1158: 90[ ]+nop *
+ +1159: 48 03 0d 20 02 20 00[ ]+add 0x200220\(%rip\),%rcx +# 201380 <.*>
+# -> R_X86_64_TPOFF64 *ABS*+0x64
+ +1160: 90[ ]+nop *
+ +1161: 90[ ]+nop *
+ +1162: 90[ ]+nop *
+ +1163: 90[ ]+nop *
+# Direct access through %fs
+# IE against global var
+ +1164: 48 8b 0d 1d 02 20 00[ ]+mov 0x20021d\(%rip\),%rcx +# 201388 <.*>
+# -> R_X86_64_TPOFF64 sg5
+ +116b: 90[ ]+nop *
+ +116c: 90[ ]+nop *
+ +116d: 64 48 8b 11[ ]+mov %fs:\(%rcx\),%rdx
+ +1171: 90[ ]+nop *
+ +1172: 90[ ]+nop *
+ +1173: 90[ ]+nop *
+ +1174: 90[ ]+nop *
+# IE against local var
+ +1175: 4c 8b 15 dc 01 20 00[ ]+mov 0x2001dc\(%rip\),%r10 +# 201358 <.*>
+# -> R_X86_64_TPOFF64 *ABS*+0x30
+ +117c: 90[ ]+nop *
+ +117d: 90[ ]+nop *
+ +117e: 64 4d 8b 22[ ]+mov %fs:\(%r10\),%r12
+ +1182: 90[ ]+nop *
+ +1183: 90[ ]+nop *
+ +1184: 90[ ]+nop *
+ +1185: 90[ ]+nop *
+# IE against hidden and local var
+ +1186: 48 8b 15 13 02 20 00[ ]+mov 0x200213\(%rip\),%rdx +# 2013a0 <.*>
+# -> R_X86_64_TPOFF64 *ABS*+0x50
+ +118d: 90[ ]+nop *
+ +118e: 90[ ]+nop *
+ +118f: 64 48 8b 12[ ]+mov %fs:\(%rdx\),%rdx
+ +1193: 90[ ]+nop *
+ +1194: 90[ ]+nop *
+ +1195: 90[ ]+nop *
+ +1196: 90[ ]+nop *
+# IE against hidden but not local var
+ +1197: 48 8b 0d 0a 02 20 00[ ]+mov 0x20020a\(%rip\),%rcx +# 2013a8 <.*>
+# -> R_X86_64_TPOFF64 *ABS*+0x70
+ +119e: 90[ ]+nop *
+ +119f: 90[ ]+nop *
+ +11a0: 64 48 8b 11[ ]+mov %fs:\(%rcx\),%rdx
+ +11a4: 90[ ]+nop *
+ +11a5: 90[ ]+nop *
+ +11a6: 90[ ]+nop *
+ +11a7: 90[ ]+nop *
+ +11a8: c9[ ]+leaveq *
+ +11a9: c3[ ]+retq *
+ +11aa: 90[ ]+nop *
+ +11ab: 90[ ]+nop *
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlspic.rd b/binutils-2.21/ld/testsuite/ld-x86-64/tlspic.rd
new file mode 100644
index 0000000..798703e
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlspic.rd
@@ -0,0 +1,144 @@
+#source: tlspic1.s
+#source: tlspic2.s
+#as: --64
+#ld: -shared -melf_x86_64
+#readelf: -WSsrl
+#target: x86_64-*-*
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Address +Off +Size +ES Flg Lk Inf Al
+ +\[[ 0-9]+\] +NULL +0+ 0+ 0+ 00 +0 +0 +0
+ +\[[ 0-9]+\] .hash +.*
+ +\[[ 0-9]+\] .dynsym +.*
+ +\[[ 0-9]+\] .dynstr +.*
+ +\[[ 0-9]+\] .rela.dyn +.*
+ +\[[ 0-9]+\] .rela.plt +.*
+ +\[[ 0-9]+\] .plt +.*
+ +\[[ 0-9]+\] .text +PROGBITS +0+1000 0+1000 0+1ac 00 +AX +0 +0 4096
+ +\[[ 0-9]+\] .tdata +PROGBITS +0+2011ac 0+11ac 0+60 00 WAT +0 +0 +1
+ +\[[ 0-9]+\] .tbss +NOBITS +0+20120c 0+120c 0+20 00 WAT +0 +0 +1
+ +\[[ 0-9]+\] .dynamic +DYNAMIC +0+201210 0+1210 0+130 10 +WA +3 +0 +8
+ +\[[ 0-9]+\] .got +PROGBITS +0+201340 0+1340 0+90 08 +WA +0 +0 +8
+ +\[[ 0-9]+\] .got.plt +PROGBITS +0+2013d0 0+13d0 0+20 08 +WA +0 +0 +8
+ +\[[ 0-9]+\] .shstrtab +.*
+ +\[[ 0-9]+\] .symtab +.*
+ +\[[ 0-9]+\] .strtab +.*
+Key to Flags:
+.*
+.*
+.*
+
+Elf file type is DYN \(Shared object file\)
+Entry point 0x1000
+There are [0-9]+ program headers, starting at offset [0-9]+
+
+Program Headers:
+ +Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg Align
+ +LOAD +0x0+ 0x0+ 0x0+ 0x[0-9a-f]+ 0x[0-9a-f]+ R E 0x200000
+ +LOAD +0x0+11ac 0x0+2011ac 0x0+2011ac 0x0+244 0x0+244 RW +0x200000
+ +DYNAMIC +0x0+1210 0x0+201210 0x0+201210 0x0+130 0x0+130 RW +0x8
+ +TLS +0x0+11ac 0x0+2011ac 0x0+2011ac 0x0+60 0x0+80 R +0x1
+
+ Section to Segment mapping:
+ +Segment Sections...
+ +00 +.hash .dynsym .dynstr .rela.dyn .rela.plt .plt .text *
+ +01 +.tdata .dynamic .got .got.plt *
+ +02 +.dynamic *
+ +03 +.tdata .tbss *
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 14 entries:
+ +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
+[0-9a-f ]+R_X86_64_DTPMOD64 +0+
+[0-9a-f ]+R_X86_64_TPOFF64 +0+24
+[0-9a-f ]+R_X86_64_TPOFF64 +0+30
+[0-9a-f ]+R_X86_64_DTPMOD64 +0+
+[0-9a-f ]+R_X86_64_DTPMOD64 +0+
+[0-9a-f ]+R_X86_64_TPOFF64 +0+64
+[0-9a-f ]+R_X86_64_TPOFF64 +0+50
+[0-9a-f ]+R_X86_64_TPOFF64 +0+70
+[0-9a-f ]+R_X86_64_DTPMOD64 +0+
+[0-9a-f ]+R_X86_64_TPOFF64 +0+44
+[0-9a-f ]+R_X86_64_TPOFF64 +0+10 sg5 \+ 0
+[0-9a-f ]+R_X86_64_DTPMOD64 +0+ sg1 \+ 0
+[0-9a-f ]+R_X86_64_DTPOFF64 +0+ sg1 \+ 0
+[0-9a-f ]+R_X86_64_TPOFF64 +0+4 sg2 \+ 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-9a-f ]+R_X86_64_JUMP_SLOT +0+ __tls_get_addr \+ 0
+
+Symbol table '\.dynsym' contains [0-9]+ entries:
+ +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+.* NOTYPE +LOCAL +DEFAULT +UND *
+.* SECTION +LOCAL +DEFAULT +7 *
+.* SECTION +LOCAL +DEFAULT +8 *
+.* TLS +GLOBAL +DEFAULT +8 sg8
+.* TLS +GLOBAL +DEFAULT +8 sg3
+.* TLS +GLOBAL +DEFAULT +8 sg4
+.* TLS +GLOBAL +DEFAULT +8 sg5
+.* NOTYPE +GLOBAL +DEFAULT +UND __tls_get_addr
+.* TLS +GLOBAL +DEFAULT +8 sg1
+.* FUNC +GLOBAL +DEFAULT +7 fn1
+.* NOTYPE +GLOBAL +DEFAULT +ABS __bss_start
+.* TLS +GLOBAL +DEFAULT +8 sg2
+.* TLS +GLOBAL +DEFAULT +8 sg6
+.* TLS +GLOBAL +DEFAULT +8 sg7
+.* NOTYPE +GLOBAL +DEFAULT +ABS _edata
+.* NOTYPE +GLOBAL +DEFAULT +ABS _end
+
+Symbol table '\.symtab' contains [0-9]+ entries:
+ +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+.* NOTYPE +LOCAL +DEFAULT +UND *
+.* SECTION +LOCAL +DEFAULT +1 *
+.* SECTION +LOCAL +DEFAULT +2 *
+.* SECTION +LOCAL +DEFAULT +3 *
+.* SECTION +LOCAL +DEFAULT +4 *
+.* SECTION +LOCAL +DEFAULT +5 *
+.* SECTION +LOCAL +DEFAULT +6 *
+.* SECTION +LOCAL +DEFAULT +7 *
+.* SECTION +LOCAL +DEFAULT +8 *
+.* SECTION +LOCAL +DEFAULT +9 *
+.* SECTION +LOCAL +DEFAULT +10 *
+.* SECTION +LOCAL +DEFAULT +11 *
+.* SECTION +LOCAL +DEFAULT +12 *
+.* TLS +LOCAL +DEFAULT +8 sl1
+.* TLS +LOCAL +DEFAULT +8 sl2
+.* TLS +LOCAL +DEFAULT +8 sl3
+.* TLS +LOCAL +DEFAULT +8 sl4
+.* TLS +LOCAL +DEFAULT +8 sl5
+.* TLS +LOCAL +DEFAULT +8 sl6
+.* TLS +LOCAL +DEFAULT +8 sl7
+.* TLS +LOCAL +DEFAULT +8 sl8
+.* TLS +LOCAL +DEFAULT +9 sH1
+.* OBJECT +LOCAL +DEFAULT +ABS _DYNAMIC
+.* TLS +LOCAL +DEFAULT +8 sh3
+.* TLS +LOCAL +DEFAULT +9 sH2
+.* TLS +LOCAL +DEFAULT +9 sH7
+.* TLS +LOCAL +DEFAULT +8 sh7
+.* TLS +LOCAL +DEFAULT +8 sh8
+.* TLS +LOCAL +DEFAULT +9 sH4
+.* TLS +LOCAL +DEFAULT +8 sh4
+.* TLS +LOCAL +DEFAULT +9 sH3
+.* TLS +LOCAL +DEFAULT +8 sh5
+.* TLS +LOCAL +DEFAULT +9 sH5
+.* TLS +LOCAL +DEFAULT +9 sH6
+.* TLS +LOCAL +DEFAULT +9 sH8
+.* TLS +LOCAL +DEFAULT +8 sh1
+.* OBJECT +LOCAL +DEFAULT +ABS _GLOBAL_OFFSET_TABLE_
+.* TLS +LOCAL +DEFAULT +8 sh2
+.* TLS +LOCAL +DEFAULT +8 sh6
+.* TLS +GLOBAL +DEFAULT +8 sg8
+.* TLS +GLOBAL +DEFAULT +8 sg3
+.* TLS +GLOBAL +DEFAULT +8 sg4
+.* TLS +GLOBAL +DEFAULT +8 sg5
+.* NOTYPE +GLOBAL +DEFAULT +UND __tls_get_addr
+.* TLS +GLOBAL +DEFAULT +8 sg1
+.* FUNC +GLOBAL +DEFAULT +7 fn1
+.* NOTYPE +GLOBAL +DEFAULT +ABS __bss_start
+.* TLS +GLOBAL +DEFAULT +8 sg2
+.* TLS +GLOBAL +DEFAULT +8 sg6
+.* TLS +GLOBAL +DEFAULT +8 sg7
+.* NOTYPE +GLOBAL +DEFAULT +ABS _edata
+.* NOTYPE +GLOBAL +DEFAULT +ABS _end
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlspic.sd b/binutils-2.21/ld/testsuite/ld-x86-64/tlspic.sd
new file mode 100644
index 0000000..666c774
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlspic.sd
@@ -0,0 +1,19 @@
+#source: tlspic1.s
+#source: tlspic2.s
+#as: --64
+#ld: -shared -melf_x86_64
+#objdump: -sj.got
+#target: x86_64-*-*
+
+.*: +file format elf64-x86-64
+
+Contents of section .got:
+ 201340 00000000 00000000 20000000 00000000 .*
+ 201350 00000000 00000000 00000000 00000000 .*
+ 201360 00000000 00000000 00000000 00000000 .*
+ 201370 00000000 00000000 60000000 00000000 .*
+ 201380 00000000 00000000 00000000 00000000 .*
+ 201390 00000000 00000000 00000000 00000000 .*
+ 2013a0 00000000 00000000 00000000 00000000 .*
+ 2013b0 00000000 00000000 00000000 00000000 .*
+ 2013c0 40000000 00000000 00000000 00000000 .*
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlspic.td b/binutils-2.21/ld/testsuite/ld-x86-64/tlspic.td
new file mode 100644
index 0000000..67eb4f2
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlspic.td
@@ -0,0 +1,16 @@
+#source: tlspic1.s
+#source: tlspic2.s
+#as: --64
+#ld: -shared -melf_x86_64
+#objdump: -sj.tdata
+#target: x86_64-*-*
+
+.*: +file format elf64-x86-64
+
+Contents of section .tdata:
+ 2011ac 11000000 12000000 13000000 14000000 .*
+ 2011bc 15000000 16000000 17000000 18000000 .*
+ 2011cc 41000000 42000000 43000000 44000000 .*
+ 2011dc 45000000 46000000 47000000 48000000 .*
+ 2011ec 01010000 02010000 03010000 04010000 .*
+ 2011fc 05010000 06010000 07010000 08010000 .*
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlspic1.s b/binutils-2.21/ld/testsuite/ld-x86-64/tlspic1.s
new file mode 100644
index 0000000..5e26f26
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlspic1.s
@@ -0,0 +1,187 @@
+ /* Force .data aligned to 4K, so .got very likely gets at 0x102190
+ (0x60 bytes .tdata and 0x130 bytes .dynamic) */
+ .data
+ .balign 4096
+ .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
+ /* Force .text aligned to 4K, so it very likely gets at 0x1000. */
+ .text
+ .balign 4096
+ .globl fn1
+ .type fn1,@function
+fn1:
+ pushq %rbp
+ movq %rsp, %rbp
+ nop;nop;nop;nop
+
+ /* GD */
+ .byte 0x66
+ leaq sg1@tlsgd(%rip), %rdi
+ .word 0x6666
+ rex64
+ call __tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE because variable is referenced through IE too */
+ .byte 0x66
+ leaq sg2@tlsgd(%rip), %rdi
+ .word 0x6666
+ rex64
+ call __tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD against local variable */
+ .byte 0x66
+ leaq sl1@tlsgd(%rip), %rdi
+ .word 0x6666
+ rex64
+ call __tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE against local variable referenced through IE too */
+ .byte 0x66
+ leaq sl2@tlsgd(%rip), %rdi
+ .word 0x6666
+ rex64
+ call __tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD against hidden and local variable */
+ .byte 0x66
+ leaq sh1@tlsgd(%rip), %rdi
+ .word 0x6666
+ rex64
+ call __tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE against hidden and local variable referenced through
+ IE too */
+ .byte 0x66
+ leaq sh2@tlsgd(%rip), %rdi
+ .word 0x6666
+ rex64
+ call __tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD against hidden but not local variable */
+ .byte 0x66
+ leaq sH1@tlsgd(%rip), %rdi
+ .word 0x6666
+ rex64
+ call __tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE against hidden but not local variable referenced through
+ IE too */
+ .byte 0x66
+ leaq sH2@tlsgd(%rip), %rdi
+ .word 0x6666
+ rex64
+ call __tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* LD */
+ leaq sl1@tlsld(%rip), %rdi
+ call __tls_get_addr@plt
+ nop;nop
+ leaq sl1@dtpoff(%rax), %rdx
+ nop;nop
+ leaq 2+sl2@dtpoff(%rax), %r9
+ nop;nop;nop;nop
+
+ /* LD against hidden and local variables */
+ leaq sh1@tlsld(%rip), %rdi
+ call __tls_get_addr@plt
+ nop;nop
+ leaq sh1@dtpoff(%rax), %rdx
+ nop;nop
+ leaq sh2@dtpoff+3(%rax), %rcx
+ nop;nop;nop;nop
+
+ /* LD against hidden but not local variables */
+ leaq sH1@tlsld(%rip), %rdi
+ call __tls_get_addr@plt
+ nop;nop
+ leaq sH1@dtpoff(%rax), %r12
+ nop;nop
+ leaq sH2@dtpoff+1(%rax), %rcx
+ nop;nop
+
+ /* IE against global var */
+ movq %fs:0, %rcx
+ nop;nop
+ addq sg2@gottpoff(%rip), %rcx
+ nop;nop;nop;nop
+
+ /* IE against local var */
+ movq %fs:0, %r14
+ nop;nop
+ addq sl2@gottpoff(%rip), %r14
+ nop;nop;nop;nop
+
+ /* IE against hidden and local var */
+ movq %fs:0, %rcx
+ nop;nop
+ addq sh2@gottpoff(%rip), %rcx
+ nop;nop;nop;nop
+
+ /* IE against hidden but not local var */
+ movq %fs:0, %rcx
+ nop;nop
+ addq sH2@gottpoff(%rip), %rcx
+ nop;nop;nop;nop
+
+ /* Direct access through %fs */
+
+ /* IE against global var */
+ movq sg5@gottpoff(%rip), %rcx
+ nop;nop
+ movq %fs:(%rcx), %rdx
+ nop;nop;nop;nop
+
+ /* IE against local var */
+ movq sl5@gottpoff(%rip), %r10
+ nop;nop
+ movq %fs:(%r10), %r12
+ nop;nop;nop;nop
+
+ /* IE against hidden and local var */
+ movq sh5@gottpoff(%rip), %rdx
+ nop;nop
+ movq %fs:(%rdx), %rdx
+ nop;nop;nop;nop
+
+ /* IE against hidden but not local var */
+ movq sH5@gottpoff(%rip), %rcx
+ nop;nop
+ movq %fs:(%rcx), %rdx
+ nop;nop;nop;nop
+
+ leave
+ ret
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlspic2.s b/binutils-2.21/ld/testsuite/ld-x86-64/tlspic2.s
new file mode 100644
index 0000000..5513f9b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/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
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlspie1.d b/binutils-2.21/ld/testsuite/ld-x86-64/tlspie1.d
new file mode 100644
index 0000000..e06e8b1
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlspie1.d
@@ -0,0 +1,6 @@
+#name: TLS with PIE
+#as: --64
+#ld: -melf_x86_64 -pie
+#readelf: -r
+
+There are no relocations in this file.
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/tlspie1.s b/binutils-2.21/ld/testsuite/ld-x86-64/tlspie1.s
new file mode 100644
index 0000000..2e9db66
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/tlspie1.s
@@ -0,0 +1,58 @@
+ .text
+ .globl __tls_get_addr
+ .type __tls_get_addr, @function
+__tls_get_addr:
+ ret
+ .size __tls_get_addr, .-__tls_get_addr
+.globl _start
+ .type _start, @function
+_start:
+ movq foo3@GOTTPOFF(%rip), %rax
+ pushq %rbx
+ movl %fs:foo2@TPOFF, %ebx
+ addl %fs:foo1@TPOFF, %ebx
+ addl %fs:(%rax), %ebx
+ leaq foo4@TLSLD(%rip), %rdi
+ call __tls_get_addr@PLT
+ addl foo4@DTPOFF(%rax), %ebx
+ .byte 0x66
+ leaq foo5@TLSGD(%rip), %rdi
+ .value 0x6666
+ rex64
+ call __tls_get_addr@PLT
+ addl (%rax), %ebx
+ movl %ebx, %eax
+ popq %rbx
+ ret
+ .size _start, .-_start
+.globl foo1
+ .section .tbss,"awT",@nobits
+ .align 4
+ .type foo1, @object
+ .size foo1, 4
+foo1:
+ .zero 4
+.globl foo2
+ .align 4
+ .type foo2, @object
+ .size foo2, 4
+foo2:
+ .zero 4
+.globl foo3
+ .align 4
+ .type foo3, @object
+ .size foo3, 4
+foo3:
+ .zero 4
+.globl foo4
+ .align 4
+ .type foo4, @object
+ .size foo4, 4
+foo4:
+ .zero 4
+.globl foo5
+ .align 4
+ .type foo5, @object
+ .size foo5, 4
+foo5:
+ .zero 4
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/undefined.s b/binutils-2.21/ld/testsuite/ld-x86-64/undefined.s
new file mode 100644
index 0000000..60c1c94
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/undefined.s
@@ -0,0 +1,154 @@
+ .file "undefined.c"
+ .section .debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+ .section .debug_info,"",@progbits
+.Ldebug_info0:
+ .section .debug_line,"",@progbits
+.Ldebug_line0:
+ .text
+.Ltext0:
+ .p2align 4,,15
+.globl function
+ .type function, @function
+function:
+.LFB2:
+ .file 1 "undefined.c"
+ .loc 1 8 0
+ .loc 1 9 0
+ xorl %eax, %eax
+ jmp this_function_is_not_defined
+.LFE2:
+ .size function, .-function
+ .section .debug_frame,"",@progbits
+.Lframe0:
+ .long .LECIE0-.LSCIE0
+.LSCIE0:
+ .long 0xffffffff
+ .byte 0x1
+ .string ""
+ .uleb128 0x1
+ .sleb128 -8
+ .byte 0x10
+ .byte 0xc
+ .uleb128 0x7
+ .uleb128 0x8
+ .byte 0x90
+ .uleb128 0x1
+ .align 8
+.LECIE0:
+.LSFDE0:
+ .long .LEFDE0-.LASFDE0
+.LASFDE0:
+ .long .Lframe0
+ .quad .LFB2
+ .quad .LFE2-.LFB2
+ .align 8
+.LEFDE0:
+ .text
+.Letext0:
+ .section .debug_info
+ .long 0x4c
+ .value 0x2
+ .long .Ldebug_abbrev0
+ .byte 0x8
+ .uleb128 0x1
+ .long .Ldebug_line0
+ .quad .Letext0
+ .quad .Ltext0
+ .long .LASF0
+ .byte 0x1
+ .long .LASF1
+ .uleb128 0x2
+ .byte 0x1
+ .long .LASF2
+ .byte 0x1
+ .byte 0x8
+ .long 0x48
+ .quad .LFB2
+ .quad .LFE2
+ .byte 0x2
+ .byte 0x77
+ .sleb128 8
+ .uleb128 0x3
+ .string "int"
+ .byte 0x4
+ .byte 0x5
+ .byte 0x0
+ .section .debug_abbrev
+ .uleb128 0x1
+ .uleb128 0x11
+ .byte 0x1
+ .uleb128 0x10
+ .uleb128 0x6
+ .uleb128 0x12
+ .uleb128 0x1
+ .uleb128 0x11
+ .uleb128 0x1
+ .uleb128 0x25
+ .uleb128 0xe
+ .uleb128 0x13
+ .uleb128 0xb
+ .uleb128 0x3
+ .uleb128 0xe
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x2
+ .uleb128 0x2e
+ .byte 0x0
+ .uleb128 0x3f
+ .uleb128 0xc
+ .uleb128 0x3
+ .uleb128 0xe
+ .uleb128 0x3a
+ .uleb128 0xb
+ .uleb128 0x3b
+ .uleb128 0xb
+ .uleb128 0x49
+ .uleb128 0x13
+ .uleb128 0x11
+ .uleb128 0x1
+ .uleb128 0x12
+ .uleb128 0x1
+ .uleb128 0x40
+ .uleb128 0xa
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x3
+ .uleb128 0x24
+ .byte 0x0
+ .uleb128 0x3
+ .uleb128 0x8
+ .uleb128 0xb
+ .uleb128 0xb
+ .uleb128 0x3e
+ .uleb128 0xb
+ .byte 0x0
+ .byte 0x0
+ .byte 0x0
+ .section .debug_pubnames,"",@progbits
+ .long 0x1b
+ .value 0x2
+ .long .Ldebug_info0
+ .long 0x50
+ .long 0x29
+ .string "function"
+ .long 0x0
+ .section .debug_aranges,"",@progbits
+ .long 0x2c
+ .value 0x2
+ .long .Ldebug_info0
+ .byte 0x8
+ .byte 0x0
+ .value 0x0
+ .value 0x0
+ .quad .Ltext0
+ .quad .Letext0-.Ltext0
+ .quad 0x0
+ .quad 0x0
+ .section .debug_str,"MS",@progbits,1
+.LASF0:
+ .string "GNU C 3.4.6"
+.LASF1:
+ .string "undefined.c"
+.LASF2:
+ .string "function"
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/unique1.d b/binutils-2.21/ld/testsuite/ld-x86-64/unique1.d
new file mode 100644
index 0000000..00afd38
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/unique1.d
@@ -0,0 +1,10 @@
+#name: STB_GNU_UNIQUE with -Bsymbolic
+#as: --64
+#ld: -melf_x86_64 -shared -Bsymbolic
+#readelf: -rs --wide
+
+#...
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_GLOB_DAT +[0-9a-f]+ bar \+ 0
+#...
+ +[0-9]+: +[0-9a-f]+ +8 +OBJECT +UNIQUE +DEFAULT +[0-9]+ bar
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/unique1.s b/binutils-2.21/ld/testsuite/ld-x86-64/unique1.s
new file mode 100644
index 0000000..3def1b3
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/unique1.s
@@ -0,0 +1,9 @@
+ .text
+foo:
+ movq bar@GOTPCREL(%rip), %rbp
+ .weak bar
+ .data
+ .type bar, @gnu_unique_object
+ .size bar, 8
+bar:
+ .quad 8
diff --git a/binutils-2.21/ld/testsuite/ld-x86-64/x86-64.exp b/binutils-2.21/ld/testsuite/ld-x86-64/x86-64.exp
new file mode 100644
index 0000000..12f5cad
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-x86-64/x86-64.exp
@@ -0,0 +1,143 @@
+# Expect script for ld-x86_64 tests
+# Copyright (C) 2002, 2005, 2006, 2007, 2008, 2009 Free Software Foundation
+#
+# This file is part of the GNU Binutils.
+#
+# This program 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 3 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., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+# Test x86_64 linking; all types of relocs. This tests the assembler and
+# tools like objdump as well as the linker.
+
+if { !([istarget "x86_64-*-elf*"]
+ || [istarget "x86_64-*-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 x86_64tests {
+ {"TLS -fpic -shared transitions" "-shared -melf_x86_64"
+ "--64" {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"}
+ {"TLS descriptor -fpic -shared transitions" "-shared -melf_x86_64"
+ "--64" {tlsdesc.s tlspic2.s}
+ {{readelf -WSsrld tlsdesc.rd} {objdump -drj.text tlsdesc.dd}
+ {objdump "-s -j.got -j.got.plt" tlsdesc.sd} {objdump -sj.tdata tlsdesc.td}
+ {objdump -drj.plt tlsdesc.pd}} "libtlsdesc.so"}
+ {"Helper shared library" "-shared -melf_x86_64"
+ "--64" {tlslib.s} {} "libtlslib.so"}
+ {"TLS -fpic and -fno-pic exec transitions"
+ "-melf_x86_64 tmpdir/libtlslib.so" "--64" {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 descriptor -fpic and -fno-pic exec transitions"
+ "-melf_x86_64 tmpdir/libtlslib.so" "--64" {tlsbindesc.s tlsbin.s}
+ {{readelf -WSsrl tlsbindesc.rd} {objdump -drj.text tlsbindesc.dd}
+ {objdump -sj.got tlsbindesc.sd} {objdump -sj.tdata tlsbindesc.td}}
+ "tlsbindesc"}
+ {"TLS with global dynamic and descriptors"
+ "-shared -melf_x86_64" "--64" {tlsgdesc.s}
+ {{readelf -WSsrl tlsgdesc.rd} {objdump -drj.text tlsgdesc.dd}}
+ "libtlsgdesc.so"}
+ {"TLS in debug sections" "-melf_x86_64"
+ "--64" {tlsg.s}
+ {{objdump -sj.debug_foobar tlsg.sd}} "tlsg"}
+ {"TLS GD->LE transition" "-melf_x86_64"
+ "--64" {tlsgd1.s}
+ {{objdump -dwr tlsgd1.dd}} "tlsgd1"}
+ {"TLS LD->LE transition" "-melf_x86_64"
+ "--64" {tlsld1.s}
+ {{objdump -dwr tlsld1.dd}} "tlsld1"}
+ {"TLS IE->LE transition" "-melf_x86_64"
+ "--64" {tlsie1.s}
+ {{objdump -dwr tlsie1.dd}} "tlsie1"}
+ {"Helper 64bit object 1" "-r -melf_x86_64"
+ "--64" {mixed1a.s} {} "libmixe1a.o"}
+ {"Helper 32bit object 1" "-r -melf_i386"
+ "--32" {mixed1b.s} {} "libmixe1b.o"}
+ {"Helper 64bit object 2" "-r -melf_x86_64"
+ "--64" {mixed2a.s} {} "libmixe2a.o"}
+ {"Helper 32bit object 2" "-r -melf_i386"
+ "--32" {mixed2b.s} {} "libmixe2b.o"}
+ {"Split by file with 'l' flag on section." "-split-by-file -r"
+ "--64" {split-by-file1.s split-by-file2.s}
+ {{readelf -SW split-by-file.rd}} "split-by-file.o"}
+}
+
+run_ld_link_tests $x86_64tests
+
+global link_output
+global ld
+
+set test_name "Mixed x86_64 and i386 input test 1"
+set test mixed1
+if { ![ld_simple_link $ld tmpdir/$test "-melf_x86_64 tmpdir/${test}a.o tmpdir/${test}b.o"] } {
+ if [string match "*i386 architecture of input file `tmpdir/${test}b.o' is incompatible with i386:x86-64 output*" $link_output] {
+ pass "$test_name"
+ } {
+ fail "$test_name"
+ }
+}
+
+set test_name "Mixed x86_64 and i386 input test 2"
+set test mixed2
+if { ![ld_simple_link $ld tmpdir/$test "-melf_x86_64 tmpdir/${test}a.o tmpdir/${test}b.o"] } {
+ if [string match "*i386 architecture of input file `tmpdir/${test}b.o' is incompatible with i386:x86-64 output*" $link_output] {
+ pass "$test_name"
+ } {
+ fail "$test_name"
+ }
+}
+
+run_dump_test "abs"
+run_dump_test "abs-l1om"
+run_dump_test "pcrel8"
+run_dump_test "pcrel16"
+run_dump_test "tlsgd2"
+run_dump_test "tlsgd3"
+run_dump_test "tlsie2"
+run_dump_test "tlsie3"
+run_dump_test "hidden1"
+run_dump_test "hidden2"
+run_dump_test "hidden3"
+run_dump_test "protected1"
+run_dump_test "protected2"
+run_dump_test "protected2-l1om"
+run_dump_test "protected3"
+run_dump_test "protected3-l1om"
+run_dump_test "tlsle1"
+run_dump_test "tlspie1"
+run_dump_test "unique1"
+run_dump_test "nogot1"
+run_dump_test "nogot2"
+run_dump_test "discarded1"
+
+if { ![istarget "x86_64-*-linux*"] } {
+ return
+}
+
+run_dump_test "compressed1"