summaryrefslogtreecommitdiffstats
path: root/binutils-2.21/ld/testsuite/ld-i386
diff options
context:
space:
mode:
Diffstat (limited to 'binutils-2.21/ld/testsuite/ld-i386')
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/abs.d11
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/abs.s8
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/alloc.d4
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/alloc.s6
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/alloc.t13
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/combreloc.d17
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/combreloc.s22
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/compressed1.d9
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/compressed1.s186
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/discarded1.d3
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/discarded1.s13
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/discarded1.t7
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/emit-relocs.d8
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/emit-relocs.s1
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/hidden1.d3
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/hidden1.s9
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/hidden2.d13
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/hidden2.s9
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/hidden3.d3
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/hidden3.s8
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/i386.exp201
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/nogot1.d8
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/nogot1.s10
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/nogot2.d7
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/nogot2.s4
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/pcrel16.d15
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/pcrel16.s9
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/pcrel16abs.d12
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/pcrel16abs.s6
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/pcrel8.d4
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/pcrel8.s11
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/protected1.d3
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/protected1.s13
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/protected2.d16
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/protected2.s13
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/protected3.d13
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/protected3.s15
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/reloc.d17
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/reloc.s8
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsbin.dd464
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsbin.rd160
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsbin.s165
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsbin.sd13
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsbin.td16
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsbindesc.dd456
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsbindesc.rd151
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsbindesc.s167
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsbindesc.sd13
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsbindesc.td16
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsbinpic.s172
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsdesc.dd391
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsdesc.rd149
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsdesc.s276
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsdesc.sd20
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsdesc.td16
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsg.s12
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsg.sd10
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsgd1.dd16
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsgd1.s15
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsgd2.d4
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsgd2.s11
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsgdesc.dd156
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsgdesc.rd103
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsgdesc.s100
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsie1.dd18
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsie1.s16
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsie2.d4
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsie2.s12
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsie3.d4
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsie3.s12
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsie4.d4
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsie4.s12
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsie5.d4
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsie5.s12
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsindntpoff.dd16
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsindntpoff.s19
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsld1.dd15
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsld1.s12
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlslib.s17
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsnopic.dd161
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsnopic.rd116
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsnopic.sd12
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsnopic1.s107
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlsnopic2.s7
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlspic.dd411
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlspic.rd154
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlspic.sd18
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlspic.td16
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlspic1.s282
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlspic2.s11
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlspie1.d6
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/tlspie1.s64
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/vxworks1-lib.dd41
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/vxworks1-lib.nd9
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/vxworks1-lib.rd12
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/vxworks1-lib.s31
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/vxworks1-lib.td3
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/vxworks1-static.d4
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/vxworks1.dd38
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/vxworks1.ld30
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/vxworks1.rd20
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/vxworks1.s14
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/vxworks2-static.sd9
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/vxworks2.s5
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/vxworks2.sd13
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/warn1.d4
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/warn1.s5
-rw-r--r--binutils-2.21/ld/testsuite/ld-i386/zero.s2
108 files changed, 5592 insertions, 0 deletions
diff --git a/binutils-2.21/ld/testsuite/ld-i386/abs.d b/binutils-2.21/ld/testsuite/ld-i386/abs.d
new file mode 100644
index 0000000..e660aca
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/abs.d
@@ -0,0 +1,11 @@
+#name: Absolute non-overflowing relocs
+#as: --32
+#source: abs.s
+#source: zero.s
+#ld: -melf_i386
+#objdump: -rs
+
+.*: file format .*
+
+Contents of section \.text:
+[ ][0-9a-f]+ c800fff0 c8000110 c9c3.*
diff --git a/binutils-2.21/ld/testsuite/ld-i386/abs.s b/binutils-2.21/ld/testsuite/ld-i386/abs.s
new file mode 100644
index 0000000..2705950
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/abs.s
@@ -0,0 +1,8 @@
+ .text
+ .global _start
+_start:
+ enter $zero + 0xff00, $zero + 0xf0
+ enter $zero - 0xff00, $zero - 0xf0
+ leave
+ ret
+ .p2align 4,0x90
diff --git a/binutils-2.21/ld/testsuite/ld-i386/alloc.d b/binutils-2.21/ld/testsuite/ld-i386/alloc.d
new file mode 100644
index 0000000..72d8e91
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/alloc.d
@@ -0,0 +1,4 @@
+#name: Invalid allocated section
+#as: --32
+#ld: -melf_i386 -T alloc.t
+#warning: .*section `.foo' can't be allocated in segment 0.*
diff --git a/binutils-2.21/ld/testsuite/ld-i386/alloc.s b/binutils-2.21/ld/testsuite/ld-i386/alloc.s
new file mode 100644
index 0000000..8c4f8fa
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/alloc.s
@@ -0,0 +1,6 @@
+ .section .bar,"ax","progbits"
+ .byte 0
+ .section .foo,"aw","progbits"
+ .byte 0
+ .bss
+ .long 0
diff --git a/binutils-2.21/ld/testsuite/ld-i386/alloc.t b/binutils-2.21/ld/testsuite/ld-i386/alloc.t
new file mode 100644
index 0000000..ea7f48c
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/alloc.t
@@ -0,0 +1,13 @@
+OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
+OUTPUT_ARCH(i386)
+PHDRS {
+ text PT_LOAD FLAGS(5); /* R_E */
+}
+SECTIONS
+{
+ . = 0xC0000000 + ((0x100000 + (0x100000 - 1)) & ~(0x100000 - 1));
+ .bar : AT(ADDR(.bar) - 0xC0000000) { *(.bar) } :text
+ .bss : AT(ADDR(.bss) - 0xC0000000) { *(.bss) }
+ .foo 0 : AT(ADDR(.bss) + SIZEOF(.bss) - 0xC0000000) { *(.foo) } :text
+ /DISCARD/ : { *(.*) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-i386/combreloc.d b/binutils-2.21/ld/testsuite/ld-i386/combreloc.d
new file mode 100644
index 0000000..bbe9134
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/combreloc.d
@@ -0,0 +1,17 @@
+# Test that orphan reloc sections are merged into .rel.dyn with
+# -z combreloc.
+#source: combreloc.s
+#as: --32
+#ld: -shared -melf_i386 -z combreloc
+#readelf: -r
+
+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 4 entries:
+ Offset Info Type Sym.Value Sym. Name
+[0-9a-f]+ [0-9a-f]+06 R_386_GLOB_DAT [0-9a-f]+ _start
+[0-9a-f]+ [0-9a-f]+01 R_386_32 [0-9a-f]+ _start
+[0-9a-f]+ [0-9a-f]+01 R_386_32 [0-9a-f]+ _start
+[0-9a-f]+ [0-9a-f]+01 R_386_32 [0-9a-f]+ _start
+
+Relocation section '.rel.plt' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym.Value Sym. Name
+[0-9a-f]+ [0-9a-f]+07 R_386_JUMP_SLOT [0-9a-f]+ foo
diff --git a/binutils-2.21/ld/testsuite/ld-i386/combreloc.s b/binutils-2.21/ld/testsuite/ld-i386/combreloc.s
new file mode 100644
index 0000000..2a78a7c
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/combreloc.s
@@ -0,0 +1,22 @@
+ .text
+ .globl _start, foo
+ .type _start,@function
+_start:
+ pushl %ebp
+ movl %esp, %ebp
+ pushl %ebx
+ call 1f
+1: popl %ebx
+ addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
+ movl _start@GOT(%ebx), %eax
+ movl (%eax), %eax
+ call foo@PLT
+ movl (%esp), %ebx
+ leave
+foo: ret
+ .data
+ .long _start
+ .section "__libc_subfreeres", "aw", @progbits
+ .long _start
+ .section "__libc_atexit", "aw", @progbits
+ .long _start
diff --git a/binutils-2.21/ld/testsuite/ld-i386/compressed1.d b/binutils-2.21/ld/testsuite/ld-i386/compressed1.d
new file mode 100644
index 0000000..3a57c81
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/compressed1.d
@@ -0,0 +1,9 @@
+#name: undefined symbol with compressed debug sections
+#as: --32
+#ld: -e foo -melf_i386 --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-i386/compressed1.s b/binutils-2.21/ld/testsuite/ld-i386/compressed1.s
new file mode 100644
index 0000000..9d58d0b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/compressed1.s
@@ -0,0 +1,186 @@
+ .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
+ pushl %ebp
+ .cfi_def_cfa_offset 8
+ movl %esp, %ebp
+ .cfi_offset 5, -8
+ .cfi_def_cfa_register 5
+ subl $8, %esp
+ .loc 1 14 0
+ leave
+ .cfi_restore 5
+ .cfi_def_cfa 4, 4
+ .loc 1 13 0
+ jmp bar
+ .cfi_endproc
+.LFE0:
+ .size foo, .-foo
+.Letext0:
+ .section .debug_info
+ .long 0x5e
+ .value 0x3
+ .long .Ldebug_abbrev0
+ .byte 0x4
+ .uleb128 0x1
+ .long .LASF5
+ .byte 0x1
+ .long .LASF6
+ .long .LASF7
+ .long .Ltext0
+ .long .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 0x4
+ .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
+ .long .LFB0
+ .long .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 0x62
+ .long 0x4f
+ .string "foo"
+ .long 0x0
+ .section .debug_pubtypes,"",@progbits
+ .long 0xe
+ .value 0x2
+ .long .Ldebug_info0
+ .long 0x62
+ .long 0x0
+ .section .debug_aranges,"",@progbits
+ .long 0x1c
+ .value 0x2
+ .long .Ldebug_info0
+ .byte 0x4
+ .byte 0x0
+ .value 0x0
+ .value 0x0
+ .long .Ltext0
+ .long .Letext0-.Ltext0
+ .long 0x0
+ .long 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 20100630 (Red Hat 4.4.4-10)"
+.LASF7:
+ .string "."
+.LASF3:
+ .string "unsigned char"
+.LASF2:
+ .string "long int"
+.LASF4:
+ .string "short unsigned int"
diff --git a/binutils-2.21/ld/testsuite/ld-i386/discarded1.d b/binutils-2.21/ld/testsuite/ld-i386/discarded1.d
new file mode 100644
index 0000000..8106db3
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/discarded1.d
@@ -0,0 +1,3 @@
+#as: --32
+#ld: -melf_i386 -T discarded1.t
+#error: .*discarded output section: `.got.plt'
diff --git a/binutils-2.21/ld/testsuite/ld-i386/discarded1.s b/binutils-2.21/ld/testsuite/ld-i386/discarded1.s
new file mode 100644
index 0000000..9b20c87
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/discarded1.s
@@ -0,0 +1,13 @@
+ .text
+.globl _start
+ .type _start, @function
+_start:
+ movl x@GOT(%ecx), %eax
+ .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-i386/discarded1.t b/binutils-2.21/ld/testsuite/ld-i386/discarded1.t
new file mode 100644
index 0000000..a4d617f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/discarded1.t
@@ -0,0 +1,7 @@
+ENTRY(_start)
+SECTIONS
+{
+ .text : {*(.text)}
+ .data : {*(.data)}
+ /DISCARD/ : {*(*)}
+}
diff --git a/binutils-2.21/ld/testsuite/ld-i386/emit-relocs.d b/binutils-2.21/ld/testsuite/ld-i386/emit-relocs.d
new file mode 100644
index 0000000..0c16b94
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/emit-relocs.d
@@ -0,0 +1,8 @@
+
+Relocation section '\.rel\.plt' at offset .* contains 1 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+.* .*07 R_386_JUMP_SLOT 00000000 foo
+
+Relocation section '\.rel\.text' at offset .* contains 1 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+.* .*04 R_386_PLT32 00000000 foo
diff --git a/binutils-2.21/ld/testsuite/ld-i386/emit-relocs.s b/binutils-2.21/ld/testsuite/ld-i386/emit-relocs.s
new file mode 100644
index 0000000..e609a2e
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/emit-relocs.s
@@ -0,0 +1 @@
+ call foo@plt
diff --git a/binutils-2.21/ld/testsuite/ld-i386/hidden1.d b/binutils-2.21/ld/testsuite/ld-i386/hidden1.d
new file mode 100644
index 0000000..5ace20d
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/hidden1.d
@@ -0,0 +1,3 @@
+#as: --32
+#ld: -shared -melf_i386
+#error: .*relocation R_386_GOTOFF against undefined hidden symbol `foo' can not be used when making a shared object
diff --git a/binutils-2.21/ld/testsuite/ld-i386/hidden1.s b/binutils-2.21/ld/testsuite/ld-i386/hidden1.s
new file mode 100644
index 0000000..2c1ce93
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/hidden1.s
@@ -0,0 +1,9 @@
+ .text
+.globl bar
+ .type bar, @function
+bar:
+ leal foo@GOTOFF(%ecx), %eax
+ ret
+ .size bar, .-bar
+ .weak foo
+ .hidden foo
diff --git a/binutils-2.21/ld/testsuite/ld-i386/hidden2.d b/binutils-2.21/ld/testsuite/ld-i386/hidden2.d
new file mode 100644
index 0000000..0d800ce
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/hidden2.d
@@ -0,0 +1,13 @@
+#as: --32
+#ld: -shared -melf_i386
+#objdump: -drw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <bar>:
+[ ]*[a-f0-9]+: e8 cf fe ff ff call 0 .*
+[ ]*[a-f0-9]+: c3 ret
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-i386/hidden2.s b/binutils-2.21/ld/testsuite/ld-i386/hidden2.s
new file mode 100644
index 0000000..03e2ce7
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/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-i386/hidden3.d b/binutils-2.21/ld/testsuite/ld-i386/hidden3.d
new file mode 100644
index 0000000..5ace20d
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/hidden3.d
@@ -0,0 +1,3 @@
+#as: --32
+#ld: -shared -melf_i386
+#error: .*relocation R_386_GOTOFF against undefined hidden symbol `foo' can not be used when making a shared object
diff --git a/binutils-2.21/ld/testsuite/ld-i386/hidden3.s b/binutils-2.21/ld/testsuite/ld-i386/hidden3.s
new file mode 100644
index 0000000..221b159
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/hidden3.s
@@ -0,0 +1,8 @@
+ .text
+.globl bar
+ .type bar, @function
+bar:
+ leal foo@GOTOFF(%ecx), %eax
+ ret
+ .size bar, .-bar
+ .hidden foo
diff --git a/binutils-2.21/ld/testsuite/ld-i386/i386.exp b/binutils-2.21/ld/testsuite/ld-i386/i386.exp
new file mode 100644
index 0000000..6777c5f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/i386.exp
@@ -0,0 +1,201 @@
+# Expect script for ld-i386 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 i386 linking; all types of relocs. This tests the assembler and
+# tools like objdump as well as the linker.
+
+if {[istarget "i?86-*-vxworks"]} {
+ set i386tests {
+ {"VxWorks shared library test 1" "-shared -Tvxworks1.ld"
+ "" {vxworks1-lib.s}
+ {{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd}
+ {readelf --symbols vxworks1-lib.nd} {readelf -d vxworks1-lib.td}}
+ "libvxworks1.so"}
+ {"VxWorks executable test 1 (dynamic)" \
+ "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic"
+ "" {vxworks1.s}
+ {{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}}
+ "vxworks1"}
+ {"VxWorks executable test 2 (dynamic)" \
+ "-Tvxworks1.ld -q --force-dynamic"
+ "" {vxworks2.s}
+ {{readelf --segments vxworks2.sd}}
+ "vxworks2"}
+ {"VxWorks executable test 2 (static)"
+ "-Tvxworks1.ld"
+ "" {vxworks2.s}
+ {{readelf --segments vxworks2-static.sd}}
+ "vxworks2"}
+ }
+ run_ld_link_tests $i386tests
+ run_dump_test "vxworks1-static"
+}
+
+if [istarget "*-*-go32*"] {
+ run_ld_link_tests {{"go32 stub" "" "" {zero.s} {} "go32stub"}}
+
+ set src "tmpdir/go32stub"
+ set dest "tmpdir/go32stub-copy"
+
+ set test "go32 stub patch the source"
+ set fi [open $src r+]
+ fconfigure $fi -translation binary
+ if {[read $fi 2] != "MZ"} {
+ fail $test
+ } else {
+ pass $test
+ seek $fi 0x40
+ puts -nonewline $fi "objcopy-test-go32stub"
+ }
+ close $fi
+
+ set test "go32 stub objcopy"
+ set status [remote_exec build $OBJCOPY "$OBJCOPYFLAGS $src $dest"]
+ set exec_output [lindex $status 1]
+ set exec_output [prune_warnings $exec_output]
+ if [string match "" $exec_output] then {
+ pass $test
+ } else {
+ send_log "$exec_output\n"
+ verbose "$exec_output" 1
+ fail $test
+ }
+
+ # cmp would compare the whole files and some data after the initial exe
+ # stub could differ.
+ set test "go32 stub comparison after objcopy"
+ set fi [open $src]
+ fconfigure $fi -translation binary
+ set src_stub [read $fi 2048]
+ close $fi
+ set fi [open $dest]
+ fconfigure $fi -translation binary
+ set dest_stub [read $fi 2048]
+ close $fi
+ if {$src_stub == $dest_stub} {
+ pass $test
+ } else {
+ fail $test
+ }
+}
+
+if { !([istarget "i?86-*-elf*"]
+ || ([istarget "i?86-*-linux*"]
+ && ![istarget "*-*-*aout*"]
+ && ![istarget "*-*-*oldld*"])
+ || [istarget "x86_64-*-linux*"]
+ || [istarget "amd64-*-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 i386tests {
+ {"TLS -fpic -shared transitions" "-shared -melf_i386"
+ "--32" {tlspic1.s tlspic2.s}
+ {{readelf -Ssrl 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_i386"
+ "--32" {tlsdesc.s tlspic2.s}
+ {{readelf -Ssrl tlsdesc.rd} {objdump -drj.text tlsdesc.dd}
+ {objdump "-s -j.got -j.got.plt" tlsdesc.sd} {objdump -sj.tdata tlsdesc.td}}
+ "libtlsdesc.so"}
+ {"Helper shared library" "-shared -melf_i386"
+ "--32" {tlslib.s} {} "libtlslib.so"}
+ {"TLS -fpic and -fno-pic exec transitions"
+ "-melf_i386 tmpdir/libtlslib.so" "--32" {tlsbinpic.s tlsbin.s}
+ {{readelf -Ssrl 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_i386 tmpdir/libtlslib.so" "--32" {tlsbindesc.s tlsbin.s}
+ {{readelf -Ssrl tlsbindesc.rd} {objdump -drj.text tlsbindesc.dd}
+ {objdump -sj.got tlsbindesc.sd} {objdump -sj.tdata tlsbindesc.td}}
+ "tlsbindesc"}
+ {"TLS -fno-pic -shared" "-shared -melf_i386"
+ "--32" {tlsnopic1.s tlsnopic2.s}
+ {{readelf -Ssrl tlsnopic.rd} {objdump -drj.text tlsnopic.dd}
+ {objdump -sj.got tlsnopic.sd}} "libtlsnopic.so"}
+ {"TLS with global dynamic and descriptors"
+ "-shared -melf_i386" "--32" {tlsgdesc.s}
+ {{readelf -Ssrl tlsgdesc.rd} {objdump -drj.text tlsgdesc.dd}}
+ "libtlsgdesc.so"}
+ {"TLS in debug sections" "-melf_i386"
+ "--32" {tlsg.s}
+ {{objdump -sj.debug_foobar tlsg.sd}} "tlsg"}
+ {"TLS @indntpoff with %eax" "-melf_i386" "--32" {tlsindntpoff.s}
+ {{objdump -drj.text tlsindntpoff.dd}} "tlsindntpoff"}
+ {"Reloc section order" "-shared -melf_i386 -z nocombreloc" "--32"
+ {reloc.s} {{objdump -hw reloc.d}} "reloc.so"}
+ {"Basic --emit-relocs support" "-shared -melf_i386 --emit-relocs" "--32"
+ {emit-relocs.s} {{readelf --relocs emit-relocs.d}} "emit-relocs.so"}
+ {"-z combreloc relocation sections" "-shared -melf_i386 -z combreloc"
+ "--32" {combreloc.s} {{readelf -r combreloc.d}} "combreloc.so"}
+ {"TLS GD->LE transition" "-melf_i386"
+ "--32" {tlsgd1.s}
+ {{objdump -dwr tlsgd1.dd}} "tlsgd1"}
+ {"TLS LD->LE transition" "-melf_i386"
+ "--32" {tlsld1.s}
+ {{objdump -dwr tlsld1.dd}} "tlsld1"}
+ {"TLS IE->LE transition" "-melf_i386"
+ "--32" {tlsie1.s}
+ {{objdump -dwr tlsie1.dd}} "tlsie1"}
+}
+
+run_ld_link_tests $i386tests
+
+run_dump_test "abs"
+run_dump_test "pcrel8"
+run_dump_test "pcrel16"
+run_dump_test "pcrel16abs"
+run_dump_test "alloc"
+run_dump_test "warn1"
+run_dump_test "tlsgd2"
+run_dump_test "tlsie2"
+run_dump_test "tlsie3"
+run_dump_test "tlsie4"
+run_dump_test "tlsie5"
+run_dump_test "hidden1"
+run_dump_test "hidden2"
+run_dump_test "hidden3"
+run_dump_test "protected1"
+run_dump_test "protected2"
+run_dump_test "protected3"
+run_dump_test "tlspie1"
+run_dump_test "nogot1"
+run_dump_test "nogot2"
+run_dump_test "discarded1"
+
+if { !([istarget "i?86-*-linux*"]
+ || [istarget "x86_64-*-linux*"]) } {
+ return
+}
+
+run_dump_test "compressed1"
diff --git a/binutils-2.21/ld/testsuite/ld-i386/nogot1.d b/binutils-2.21/ld/testsuite/ld-i386/nogot1.d
new file mode 100644
index 0000000..a6c8832
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/nogot1.d
@@ -0,0 +1,8 @@
+#ld: --shared -melf_i386
+#readelf: -S --wide
+#as: --32
+
+#...
+[ ]*\[.*\][ ]+\.dynamic[ ]+DYNAMIC.*
+[ ]*\[.*\][ ]+.*STRTAB.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-i386/nogot1.s b/binutils-2.21/ld/testsuite/ld-i386/nogot1.s
new file mode 100644
index 0000000..016e172
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/nogot1.s
@@ -0,0 +1,10 @@
+ .type bar, @function
+bar:
+ ret
+ .size bar, .-bar
+.globl foo
+ .type foo, @function
+foo:
+ leal bar, %eax
+ ret
+ .size foo, .-foo
diff --git a/binutils-2.21/ld/testsuite/ld-i386/nogot2.d b/binutils-2.21/ld/testsuite/ld-i386/nogot2.d
new file mode 100644
index 0000000..a7bb788
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/nogot2.d
@@ -0,0 +1,7 @@
+#ld: -pie -melf_i386
+#readelf: -S --wide
+#as: --32
+
+#...
+[ ]*\[.*\][ ]+.*\.got\.plt.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-i386/nogot2.s b/binutils-2.21/ld/testsuite/ld-i386/nogot2.s
new file mode 100644
index 0000000..e7212cb
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/nogot2.s
@@ -0,0 +1,4 @@
+ .text
+ .globl _start
+_start:
+ movl _GLOBAL_OFFSET_TABLE_, %ecx
diff --git a/binutils-2.21/ld/testsuite/ld-i386/pcrel16.d b/binutils-2.21/ld/testsuite/ld-i386/pcrel16.d
new file mode 100644
index 0000000..3d45afe
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/pcrel16.d
@@ -0,0 +1,15 @@
+#name: PCREL16 overflow
+#as: --32
+#ld: -melf_i386 -Ttext 0x0
+#objdump: -drj.text -m i8086
+
+.*: +file format elf32-i386
+
+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-i386/pcrel16.s b/binutils-2.21/ld/testsuite/ld-i386/pcrel16.s
new file mode 100644
index 0000000..d68a6c6
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/pcrel16.s
@@ -0,0 +1,9 @@
+ .code16
+ .text
+ .globl _start
+_start:
+ .org 0x420
+ int $0x42
+ lret $2
+ .org 0xf065
+ jmp _start+((0x42) << 4)
diff --git a/binutils-2.21/ld/testsuite/ld-i386/pcrel16abs.d b/binutils-2.21/ld/testsuite/ld-i386/pcrel16abs.d
new file mode 100644
index 0000000..f4bfca5
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/pcrel16abs.d
@@ -0,0 +1,12 @@
+#name: PCREL16 absolute reloc
+#as: --32
+#ld: -melf_i386 -Ttext 0xfffffff0
+#objdump: -drj.text -m i8086
+
+.*: +file format elf32-i386
+
+Disassembly of section .text:
+
+f+0 <_start>:
+f+0: e9 0d e0[ ]+jmp[ ]+ffffe000 <SEGMENT_SIZE\+0xfffee000>
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-i386/pcrel16abs.s b/binutils-2.21/ld/testsuite/ld-i386/pcrel16abs.s
new file mode 100644
index 0000000..4bf68a7
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/pcrel16abs.s
@@ -0,0 +1,6 @@
+SEGMENT_SIZE = 0x10000
+RVECTOR = 0x00010
+.code16
+ .globl _start
+_start:
+ jmp SEGMENT_SIZE-(0x1f00 +0xf0 +RVECTOR)
diff --git a/binutils-2.21/ld/testsuite/ld-i386/pcrel8.d b/binutils-2.21/ld/testsuite/ld-i386/pcrel8.d
new file mode 100644
index 0000000..208c64e
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/pcrel8.d
@@ -0,0 +1,4 @@
+#name: PCREL8 overflow
+#as: --32
+#ld: -melf_i386
+#error: .*relocation truncated to fit: R_386_PC8 .*
diff --git a/binutils-2.21/ld/testsuite/ld-i386/pcrel8.s b/binutils-2.21/ld/testsuite/ld-i386/pcrel8.s
new file mode 100644
index 0000000..e624aaf
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/pcrel8.s
@@ -0,0 +1,11 @@
+ .text
+ .code16
+ .global _start, fwd
+_start:
+ jcxz fwd
+ .rept 10
+ testl $0x12345678, %ss:0x76543210(,%eax,4)
+ .endr
+fwd:
+ leave
+ ret
diff --git a/binutils-2.21/ld/testsuite/ld-i386/protected1.d b/binutils-2.21/ld/testsuite/ld-i386/protected1.d
new file mode 100644
index 0000000..a3cb5ce
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/protected1.d
@@ -0,0 +1,3 @@
+#as: --32
+#ld: -shared -melf_i386
+#error: .*relocation R_386_GOTOFF against protected function `foo' can not be used when making a shared object
diff --git a/binutils-2.21/ld/testsuite/ld-i386/protected1.s b/binutils-2.21/ld/testsuite/ld-i386/protected1.s
new file mode 100644
index 0000000..2edaeb2
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/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:
+ leal foo@GOTOFF(%ecx), %eax
+ ret
+ .size bar, .-bar
diff --git a/binutils-2.21/ld/testsuite/ld-i386/protected2.d b/binutils-2.21/ld/testsuite/ld-i386/protected2.d
new file mode 100644
index 0000000..ba53e59
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/protected2.d
@@ -0,0 +1,16 @@
+#as: --32
+#ld: -shared -melf_i386
+#objdump: -drw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+[a-f0-9]+ <foo>:
+[ ]*[a-f0-9]+: c3 ret
+
+0+[a-f0-9]+ <bar>:
+[ ]*[a-f0-9]+: e8 fa ff ff ff call [a-f0-9]+ <foo>
+[ ]*[a-f0-9]+: c3 ret
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-i386/protected2.s b/binutils-2.21/ld/testsuite/ld-i386/protected2.s
new file mode 100644
index 0000000..61e5aec
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/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-i386/protected3.d b/binutils-2.21/ld/testsuite/ld-i386/protected3.d
new file mode 100644
index 0000000..aafa2d8
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/protected3.d
@@ -0,0 +1,13 @@
+#as: --32
+#ld: -shared -melf_i386
+#objdump: -drw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+[a-f0-9]+ <bar>:
+[ ]*[a-f0-9]+: 8b 81 [a-f0-9][a-f0-9] [a-f0-9][a-f0-9] 00 00 mov 0x[a-f0-9]+\(%ecx\),%eax
+[ ]*[a-f0-9]+: c3 ret
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-i386/protected3.s b/binutils-2.21/ld/testsuite/ld-i386/protected3.s
new file mode 100644
index 0000000..7a605a2
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/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@GOTOFF(%ecx), %eax
+ ret
+ .size bar, .-bar
diff --git a/binutils-2.21/ld/testsuite/ld-i386/reloc.d b/binutils-2.21/ld/testsuite/ld-i386/reloc.d
new file mode 100644
index 0000000..e559e53
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/reloc.d
@@ -0,0 +1,17 @@
+# Test that orphan reloc sections are placed before .rel.plt even when
+# .rel.plt is the only reloc section.
+#source: reloc.s
+#as: --32
+#ld: -shared -melf_i386 -z nocombreloc
+#objdump: -hw
+
+.*: +file format elf32-i386
+#...
+.*\.relplatypus.*
+#...
+.*\.rel\.plt.*
+# x86 ld doesn't output non-alloc reloc sections to shared libs, so disable
+# the following two lines for the time being.
+# #...
+# .*\.relechidna.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-i386/reloc.s b/binutils-2.21/ld/testsuite/ld-i386/reloc.s
new file mode 100644
index 0000000..0e3ff1d
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/reloc.s
@@ -0,0 +1,8 @@
+ .section echidna
+ .long .text
+
+ .section platypus,"ax"
+ .long .text
+
+ .text
+ jmp _start@plt
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsbin.dd b/binutils-2.21/ld/testsuite/ld-i386/tlsbin.dd
new file mode 100644
index 0000000..9cf14a5
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsbin.dd
@@ -0,0 +1,464 @@
+#source: tlsbinpic.s
+#source: tlsbin.s
+#as: --32
+#ld: -melf_i386 tmpdir/libtlslib.so
+#objdump: -drj.text
+#target: i?86-*-*
+
+# 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 elf32-i386
+
+Disassembly of section .text:
+
+0+8049000 <fn2>:
+ 8049000: 55[ ]+push %ebp
+ 8049001: 89 e5[ ]+mov %esp,%ebp
+ 8049003: 53[ ]+push %ebx
+ 8049004: 50[ ]+push %eax
+ 8049005: e8 00 00 00 00[ ]+call 804900a <fn2\+0xa>
+ 804900a: 5b[ ]+pop %ebx
+ 804900b: 81 c3 1a 11 00 00[ ]+add \$0x111a,%ebx
+ 8049011: 90[ ]+nop *
+ 8049012: 90[ ]+nop *
+ 8049013: 90[ ]+nop *
+ 8049014: 90[ ]+nop *
+# GD -> IE because variable is not defined in executable
+ 8049015: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 804901b: 2b 83 f8 ff ff ff[ ]+sub -0x8\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 sG1
+ 8049021: 90[ ]+nop *
+ 8049022: 90[ ]+nop *
+ 8049023: 90[ ]+nop *
+ 8049024: 90[ ]+nop *
+# GD -> IE because variable is not defined in executable where
+# the variable is referenced through @gottpoff too
+ 8049025: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 804902b: 2b 83 e8 ff ff ff[ ]+sub -0x18\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 sG2
+ 8049031: 90[ ]+nop *
+ 8049032: 90[ ]+nop *
+ 8049033: 90[ ]+nop *
+ 8049034: 90[ ]+nop *
+# GD -> IE because variable is not defined in executable where
+# the variable is referenced through @gotntpoff too
+ 8049035: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 804903b: 03 83 dc ff ff ff[ ]+add -0x24\(%ebx\),%eax
+# ->R_386_TLS_TPOFF sG3
+ 8049041: 90[ ]+nop *
+ 8049042: 90[ ]+nop *
+ 8049043: 90[ ]+nop *
+ 8049044: 90[ ]+nop *
+# GD -> IE because variable is not defined in executable where
+# the variable is referenced through @gottpoff and @gotntpoff too
+ 8049045: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 804904b: 2b 83 ec ff ff ff[ ]+sub -0x14\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 sG4
+ 8049051: 90[ ]+nop *
+ 8049052: 90[ ]+nop *
+ 8049053: 90[ ]+nop *
+ 8049054: 90[ ]+nop *
+# GD -> LE with global variable defined in executable
+ 8049055: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 804905b: 81 e8 00 10 00 00[ ]+sub \$0x1000,%eax
+# sg1
+ 8049061: 90[ ]+nop *
+ 8049062: 90[ ]+nop *
+ 8049063: 90[ ]+nop *
+ 8049064: 90[ ]+nop *
+# GD -> LE with local variable defined in executable
+ 8049065: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 804906b: 81 e8 e0 0f 00 00[ ]+sub \$0xfe0,%eax
+# sl1
+ 8049071: 90[ ]+nop *
+ 8049072: 90[ ]+nop *
+ 8049073: 90[ ]+nop *
+ 8049074: 90[ ]+nop *
+# GD -> LE with hidden variable defined in executable
+ 8049075: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 804907b: 81 e8 c0 0f 00 00[ ]+sub \$0xfc0,%eax
+# sh1
+ 8049081: 90[ ]+nop *
+ 8049082: 90[ ]+nop *
+ 8049083: 90[ ]+nop *
+ 8049084: 90[ ]+nop *
+# LD -> LE
+ 8049085: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 804908b: 90[ ]+nop *
+ 804908c: 8d 74 26 00[ ]+lea 0x0\(%esi,%eiz,1\),%esi
+ 8049090: 90[ ]+nop *
+ 8049091: 90[ ]+nop *
+ 8049092: 8d 90 20 f0 ff ff[ ]+lea -0xfe0\(%eax\),%edx
+# sl1
+ 8049098: 90[ ]+nop *
+ 8049099: 90[ ]+nop *
+ 804909a: 8d 88 24 f0 ff ff[ ]+lea -0xfdc\(%eax\),%ecx
+# sl2
+ 80490a0: 90[ ]+nop *
+ 80490a1: 90[ ]+nop *
+ 80490a2: 90[ ]+nop *
+ 80490a3: 90[ ]+nop *
+# LD -> LE against hidden variables
+ 80490a4: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 80490aa: 90[ ]+nop *
+ 80490ab: 8d 74 26 00[ ]+lea 0x0\(%esi,%eiz,1\),%esi
+ 80490af: 90[ ]+nop *
+ 80490b0: 90[ ]+nop *
+ 80490b1: 8d 90 40 f0 ff ff[ ]+lea -0xfc0\(%eax\),%edx
+# sh1
+ 80490b7: 90[ ]+nop *
+ 80490b8: 90[ ]+nop *
+ 80490b9: 8d 88 44 f0 ff ff[ ]+lea -0xfbc\(%eax\),%ecx
+# sh2
+ 80490bf: 90[ ]+nop *
+ 80490c0: 90[ ]+nop *
+ 80490c1: 90[ ]+nop *
+ 80490c2: 90[ ]+nop *
+# @gottpoff IE against global var
+ 80490c3: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ 80490ca: 90[ ]+nop *
+ 80490cb: 90[ ]+nop *
+ 80490cc: 2b 8b e8 ff ff ff[ ]+sub -0x18\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF32 sG2
+ 80490d2: 90[ ]+nop *
+ 80490d3: 90[ ]+nop *
+ 80490d4: 90[ ]+nop *
+ 80490d5: 90[ ]+nop *
+# @gottpoff IE against global var
+ 80490d6: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 80490dc: 90[ ]+nop *
+ 80490dd: 90[ ]+nop *
+ 80490de: 2b 83 ec ff ff ff[ ]+sub -0x14\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 sG4
+ 80490e4: 90[ ]+nop *
+ 80490e5: 90[ ]+nop *
+ 80490e6: 90[ ]+nop *
+ 80490e7: 90[ ]+nop *
+# @gotntpoff IE against global var
+ 80490e8: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ 80490ef: 90[ ]+nop *
+ 80490f0: 90[ ]+nop *
+ 80490f1: 03 8b dc ff ff ff[ ]+add -0x24\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF sG3
+ 80490f7: 90[ ]+nop *
+ 80490f8: 90[ ]+nop *
+ 80490f9: 90[ ]+nop *
+ 80490fa: 90[ ]+nop *
+# @gotntpoff IE against global var
+ 80490fb: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 8049101: 90[ ]+nop *
+ 8049102: 90[ ]+nop *
+ 8049103: 03 83 f0 ff ff ff[ ]+add -0x10\(%ebx\),%eax
+# ->R_386_TLS_TPOFF sG4
+ 8049109: 90[ ]+nop *
+ 804910a: 90[ ]+nop *
+ 804910b: 90[ ]+nop *
+ 804910c: 90[ ]+nop *
+# @gottpoff IE -> LE against global var defined in exec
+ 804910d: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ 8049114: 90[ ]+nop *
+ 8049115: 90[ ]+nop *
+ 8049116: 81 e9 00 10 00 00[ ]+sub \$0x1000,%ecx
+# sg1
+ 804911c: 90[ ]+nop *
+ 804911d: 90[ ]+nop *
+ 804911e: 90[ ]+nop *
+ 804911f: 90[ ]+nop *
+# @gotntpoff IE -> LE against local var
+ 8049120: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ 8049127: 90[ ]+nop *
+ 8049128: 90[ ]+nop *
+ 8049129: 81 c0 20 f0 ff ff[ ]+add \$0xfffff020,%eax
+# sl1
+ 804912f: 90[ ]+nop *
+ 8049130: 90[ ]+nop *
+ 8049131: 90[ ]+nop *
+ 8049132: 90[ ]+nop *
+# @gottpoff IE -> LE against hidden var
+ 8049133: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ 804913a: 90[ ]+nop *
+ 804913b: 90[ ]+nop *
+ 804913c: 81 e9 c0 0f 00 00[ ]+sub \$0xfc0,%ecx
+# sh1
+ 8049142: 90[ ]+nop *
+ 8049143: 90[ ]+nop *
+ 8049144: 90[ ]+nop *
+ 8049145: 90[ ]+nop *
+# Direct access through %gs
+# @gotntpoff IE against global var
+ 8049146: 8b 8b e0 ff ff ff[ ]+mov -0x20\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF sG5
+ 804914c: 90[ ]+nop *
+ 804914d: 90[ ]+nop *
+ 804914e: 65 8b 11[ ]+mov %gs:\(%ecx\),%edx
+ 8049151: 90[ ]+nop *
+ 8049152: 90[ ]+nop *
+ 8049153: 90[ ]+nop *
+ 8049154: 90[ ]+nop *
+# @gotntpoff IE->LE against local var
+ 8049155: c7 c0 30 f0 ff ff[ ]+mov \$0xfffff030,%eax
+# sl5
+ 804915b: 90[ ]+nop *
+ 804915c: 90[ ]+nop *
+ 804915d: 65 8b 10[ ]+mov %gs:\(%eax\),%edx
+ 8049160: 90[ ]+nop *
+ 8049161: 90[ ]+nop *
+ 8049162: 90[ ]+nop *
+ 8049163: 90[ ]+nop *
+# @gotntpoff IE->LE against hidden var
+ 8049164: c7 c2 50 f0 ff ff[ ]+mov \$0xfffff050,%edx
+# sh5
+ 804916a: 90[ ]+nop *
+ 804916b: 90[ ]+nop *
+ 804916c: 65 8b 12[ ]+mov %gs:\(%edx\),%edx
+ 804916f: 90[ ]+nop *
+ 8049170: 90[ ]+nop *
+ 8049171: 90[ ]+nop *
+ 8049172: 90[ ]+nop *
+# GD -> IE because variable is not defined in executable
+ 8049173: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 8049179: 2b 83 f8 ff ff ff[ ]+sub -0x8\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 sG1
+ 804917f: 90[ ]+nop *
+ 8049180: 90[ ]+nop *
+ 8049181: 90[ ]+nop *
+ 8049182: 90[ ]+nop *
+ 8049183: 8b 5d fc[ ]+mov -0x4\(%ebp\),%ebx
+ 8049186: c9[ ]+leave *
+ 8049187: c3[ ]+ret *
+
+0+8049188 <_start>:
+ 8049188: 55[ ]+push %ebp
+ 8049189: 89 e5[ ]+mov %esp,%ebp
+ 804918b: e8 00 00 00 00[ ]+call 8049190 <_start\+0x8>
+ 8049190: 59[ ]+pop %ecx
+ 8049191: 81 c1 94 0f 00 00[ ]+add \$0xf94,%ecx
+ 8049197: 90[ ]+nop *
+ 8049198: 90[ ]+nop *
+ 8049199: 90[ ]+nop *
+ 804919a: 90[ ]+nop *
+# @gottpoff IE against global var
+ 804919b: 65 8b 15 00 00 00 00[ ]+mov %gs:0x0,%edx
+ 80491a2: 90[ ]+nop *
+ 80491a3: 90[ ]+nop *
+ 80491a4: 2b 91 f4 ff ff ff[ ]+sub -0xc\(%ecx\),%edx
+# ->R_386_TLS_TPOFF32 sG6
+ 80491aa: 90[ ]+nop *
+ 80491ab: 90[ ]+nop *
+ 80491ac: 90[ ]+nop *
+ 80491ad: 90[ ]+nop *
+# @indntpoff IE against global var
+ 80491ae: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 80491b4: 90[ ]+nop *
+ 80491b5: 90[ ]+nop *
+ 80491b6: 03 05 08 a1 04 08[ ]+add 0x804a108,%eax
+# ->R_386_TLS_TPOFF sG7
+ 80491bc: 90[ ]+nop *
+ 80491bd: 90[ ]+nop *
+ 80491be: 90[ ]+nop *
+ 80491bf: 90[ ]+nop *
+# @indntpoff direct %gs access IE against global var
+ 80491c0: 8b 15 20 a1 04 08[ ]+mov 0x804a120,%edx
+# ->R_386_TLS_TPOFF sG8
+ 80491c6: 90[ ]+nop *
+ 80491c7: 90[ ]+nop *
+ 80491c8: 65 8b 02[ ]+mov %gs:\(%edx\),%eax
+ 80491cb: 90[ ]+nop *
+ 80491cc: 90[ ]+nop *
+ 80491cd: 90[ ]+nop *
+ 80491ce: 90[ ]+nop *
+# @gottpoff IE -> LE against global var defined in exec
+ 80491cf: 65 8b 15 00 00 00 00[ ]+mov %gs:0x0,%edx
+ 80491d6: 90[ ]+nop *
+ 80491d7: 90[ ]+nop *
+ 80491d8: 81 ea 8c 0f 00 00[ ]+sub \$0xf8c,%edx
+# bg6
+ 80491de: 90[ ]+nop *
+ 80491df: 90[ ]+nop *
+ 80491e0: 90[ ]+nop *
+ 80491e1: 90[ ]+nop *
+# @indntpoff IE -> LE against global var defined in exec
+ 80491e2: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 80491e8: 90[ ]+nop *
+ 80491e9: 90[ ]+nop *
+ 80491ea: 81 c0 78 f0 ff ff[ ]+add \$0xfffff078,%eax
+# bg7
+ 80491f0: 90[ ]+nop *
+ 80491f1: 90[ ]+nop *
+ 80491f2: 90[ ]+nop *
+ 80491f3: 90[ ]+nop *
+# @indntpoff direct %gs access IE -> LE against global var defined
+# in exec
+ 80491f4: c7 c2 7c f0 ff ff[ ]+mov \$0xfffff07c,%edx
+# bg8
+ 80491fa: 90[ ]+nop *
+ 80491fb: 90[ ]+nop *
+ 80491fc: 65 8b 02[ ]+mov %gs:\(%edx\),%eax
+ 80491ff: 90[ ]+nop *
+ 8049200: 90[ ]+nop *
+ 8049201: 90[ ]+nop *
+ 8049202: 90[ ]+nop *
+# @gottpoff IE -> LE against local var
+ 8049203: 65 8b 15 00 00 00 00[ ]+mov %gs:0x0,%edx
+ 804920a: 90[ ]+nop *
+ 804920b: 90[ ]+nop *
+ 804920c: 81 ea 6c 0f 00 00[ ]+sub \$0xf6c,%edx
+# bl6
+ 8049212: 90[ ]+nop *
+ 8049213: 90[ ]+nop *
+ 8049214: 90[ ]+nop *
+ 8049215: 90[ ]+nop *
+# @indntpoff IE -> LE against local var
+ 8049216: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 804921c: 90[ ]+nop *
+ 804921d: 90[ ]+nop *
+ 804921e: 81 c0 98 f0 ff ff[ ]+add \$0xfffff098,%eax
+# bl7
+ 8049224: 90[ ]+nop *
+ 8049225: 90[ ]+nop *
+ 8049226: 90[ ]+nop *
+ 8049227: 90[ ]+nop *
+# @indntpoff direct %gs access IE -> LE against local var
+ 8049228: c7 c2 9c f0 ff ff[ ]+mov \$0xfffff09c,%edx
+# bl8
+ 804922e: 90[ ]+nop *
+ 804922f: 90[ ]+nop *
+ 8049230: 65 8b 02[ ]+mov %gs:\(%edx\),%eax
+ 8049233: 90[ ]+nop *
+ 8049234: 90[ ]+nop *
+ 8049235: 90[ ]+nop *
+ 8049236: 90[ ]+nop *
+# @gottpoff IE -> LE against hidden but not local var
+ 8049237: 65 8b 15 00 00 00 00[ ]+mov %gs:0x0,%edx
+ 804923e: 90[ ]+nop *
+ 804923f: 90[ ]+nop *
+ 8049240: 81 ea ac 0f 00 00[ ]+sub \$0xfac,%edx
+# sh6
+ 8049246: 90[ ]+nop *
+ 8049247: 90[ ]+nop *
+ 8049248: 90[ ]+nop *
+ 8049249: 90[ ]+nop *
+# @indntpoff IE -> LE against hidden but not local var
+ 804924a: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 8049250: 90[ ]+nop *
+ 8049251: 90[ ]+nop *
+ 8049252: 81 c0 58 f0 ff ff[ ]+add \$0xfffff058,%eax
+# sh7
+ 8049258: 90[ ]+nop *
+ 8049259: 90[ ]+nop *
+ 804925a: 90[ ]+nop *
+ 804925b: 90[ ]+nop *
+# @indntpoff direct %gs access IE -> LE against hidden but not
+# local var
+ 804925c: c7 c2 5c f0 ff ff[ ]+mov \$0xfffff05c,%edx
+# sh8
+ 8049262: 90[ ]+nop *
+ 8049263: 90[ ]+nop *
+ 8049264: 65 8b 02[ ]+mov %gs:\(%edx\),%eax
+ 8049267: 90[ ]+nop *
+ 8049268: 90[ ]+nop *
+ 8049269: 90[ ]+nop *
+ 804926a: 90[ ]+nop *
+# LE @tpoff, global var defined in exec
+ 804926b: ba 00 10 00 00[ ]+mov \$0x1000,%edx
+# sg1
+ 8049270: 90[ ]+nop *
+ 8049271: 90[ ]+nop *
+ 8049272: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 8049278: 90[ ]+nop *
+ 8049279: 90[ ]+nop *
+ 804927a: 29 d0[ ]+sub %edx,%eax
+ 804927c: 90[ ]+nop *
+ 804927d: 90[ ]+nop *
+ 804927e: 90[ ]+nop *
+ 804927f: 90[ ]+nop *
+# LE @tpoff, local var
+ 8049280: b8 7f 0f 00 00[ ]+mov \$0xf7f,%eax
+# bl1+1
+ 8049285: 90[ ]+nop *
+ 8049286: 90[ ]+nop *
+ 8049287: 65 8b 15 00 00 00 00[ ]+mov %gs:0x0,%edx
+ 804928e: 90[ ]+nop *
+ 804928f: 90[ ]+nop *
+ 8049290: 29 c2[ ]+sub %eax,%edx
+ 8049292: 90[ ]+nop *
+ 8049293: 90[ ]+nop *
+ 8049294: 90[ ]+nop *
+ 8049295: 90[ ]+nop *
+# LE @tpoff, hidden var defined in exec
+ 8049296: b8 bd 0f 00 00[ ]+mov \$0xfbd,%eax
+# sh1+3
+ 804929b: 90[ ]+nop *
+ 804929c: 90[ ]+nop *
+ 804929d: 65 8b 15 00 00 00 00[ ]+mov %gs:0x0,%edx
+ 80492a4: 90[ ]+nop *
+ 80492a5: 90[ ]+nop *
+ 80492a6: 29 c2[ ]+sub %eax,%edx
+ 80492a8: 90[ ]+nop *
+ 80492a9: 90[ ]+nop *
+ 80492aa: 90[ ]+nop *
+ 80492ab: 90[ ]+nop *
+# LE @ntpoff, global var defined in exec
+ 80492ac: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 80492b2: 90[ ]+nop *
+ 80492b3: 90[ ]+nop *
+ 80492b4: 8d 90 04 f0 ff ff[ ]+lea -0xffc\(%eax\),%edx
+# sg2
+ 80492ba: 90[ ]+nop *
+ 80492bb: 90[ ]+nop *
+ 80492bc: 90[ ]+nop *
+ 80492bd: 90[ ]+nop *
+# LE @ntpoff, local var, non-canonical sequence
+ 80492be: b8 86 f0 ff ff[ ]+mov \$0xfffff086,%eax
+# bl2+2
+ 80492c3: 90[ ]+nop *
+ 80492c4: 90[ ]+nop *
+ 80492c5: 65 8b 15 00 00 00 00[ ]+mov %gs:0x0,%edx
+ 80492cc: 90[ ]+nop *
+ 80492cd: 90[ ]+nop *
+ 80492ce: 01 c2[ ]+add %eax,%edx
+ 80492d0: 90[ ]+nop *
+ 80492d1: 90[ ]+nop *
+ 80492d2: 90[ ]+nop *
+ 80492d3: 90[ ]+nop *
+# LE @ntpoff, hidden var defined in exec, non-canonical sequence
+ 80492d4: 65 8b 15 00 00 00 00[ ]+mov %gs:0x0,%edx
+ 80492db: 90[ ]+nop *
+ 80492dc: 90[ ]+nop *
+ 80492dd: 81 c2 45 f0 ff ff[ ]+add \$0xfffff045,%edx
+# sh2+1
+ 80492e3: 90[ ]+nop *
+ 80492e4: 90[ ]+nop *
+ 80492e5: 90[ ]+nop *
+ 80492e6: 90[ ]+nop *
+# LE @ntpoff, global var defined in exec
+ 80492e7: 65 a1 08 f0 ff ff[ ]+mov %gs:0xfffff008,%eax
+# sg3
+ 80492ed: 90[ ]+nop *
+ 80492ee: 90[ ]+nop *
+ 80492ef: 90[ ]+nop *
+ 80492f0: 90[ ]+nop *
+# LE @ntpoff, local var
+ 80492f1: 65 8b 15 8b f0 ff ff[ ]+mov %gs:0xfffff08b,%edx
+# bl3+3
+ 80492f8: 90[ ]+nop *
+ 80492f9: 90[ ]+nop *
+ 80492fa: 90[ ]+nop *
+ 80492fb: 90[ ]+nop *
+# LE @ntpoff, hidden var defined in exec
+ 80492fc: 65 8b 15 49 f0 ff ff[ ]+mov %gs:0xfffff049,%edx
+# sh3+1
+ 8049303: 90[ ]+nop *
+ 8049304: 90[ ]+nop *
+ 8049305: 90[ ]+nop *
+ 8049306: 90[ ]+nop *
+ 8049307: 8b 5d fc[ ]+mov -0x4\(%ebp\),%ebx
+ 804930a: c9[ ]+leave *
+ 804930b: c3[ ]+ret *
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsbin.rd b/binutils-2.21/ld/testsuite/ld-i386/tlsbin.rd
new file mode 100644
index 0000000..84cec78
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsbin.rd
@@ -0,0 +1,160 @@
+#source: tlsbinpic.s
+#source: tlsbin.s
+#as: --32
+#ld: -melf_i386 tmpdir/libtlslib.so
+#readelf: -Ssrl
+#target: i?86-*-*
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Addr +Off +Size +ES Flg Lk Inf Al
+ +\[[ 0-9]+\] +NULL +0+ 0+ 0+ 0+ +0 +0 +0
+ +\[[ 0-9]+\] \.interp +.*
+ +\[[ 0-9]+\] \.hash +.*
+ +\[[ 0-9]+\] \.dynsym +.*
+ +\[[ 0-9]+\] \.dynstr +.*
+ +\[[ 0-9]+\] \.rel.dyn +.*
+ +\[[ 0-9]+\] \.rel.plt +.*
+ +\[[ 0-9]+\] \.plt +.*
+ +\[[ 0-9]+\] \.text +PROGBITS +0+8049000 .*
+ +\[[ 0-9]+\] \.tdata +PROGBITS +0+804a000 [0-9a-f]+ 000060 00 WAT +0 +0 4096
+ +\[[ 0-9]+\] \.tbss +NOBITS +[0-9a-f]+ [0-9a-f]+ 000040 00 WAT +0 +0 +1
+ +\[[ 0-9]+\] \.dynamic +DYNAMIC +0+804a060 .*
+ +\[[ 0-9]+\] \.got +PROGBITS +0+804a100 .*
+ +\[[ 0-9]+\] \.got\.plt +PROGBITS +0+804a124 .*
+ +\[[ 0-9]+\] \.shstrtab +.*
+ +\[[ 0-9]+\] \.symtab +.*
+ +\[[ 0-9]+\] \.strtab +.*
+Key to Flags:
+.*
+.*
+.*
+
+Elf file type is EXEC \(Executable file\)
+Entry point 0x8049188
+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.*
+ +LOAD.*
+ +DYNAMIC.*
+ +TLS +0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x0+60 0x0+a0 R +0x1000
+
+ Section to Segment mapping:
+ +Segment Sections...
+ +00 +
+ +01 +.interp *
+ +02 +.interp .hash .dynsym .dynstr .rel.dyn .rel.plt .plt .text *
+ +03 +.tdata .dynamic .got .got.plt *
+ +04 +.dynamic *
+ +05 +.tdata .tbss *
+
+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 9 entries:
+ Offset +Info +Type +Sym.Value +Sym. Name
+[0-9a-f ]+R_386_TLS_TPOFF +0+ +sG3
+[0-9a-f ]+R_386_TLS_TPOFF +0+ +sG5
+[0-9a-f ]+R_386_TLS_TPOFF +0+ +sG7
+[0-9a-f ]+R_386_TLS_TPOFF32 0+ +sG2
+[0-9a-f ]+R_386_TLS_TPOFF32 0+ +sG4
+[0-9a-f ]+R_386_TLS_TPOFF +0+ +sG4
+[0-9a-f ]+R_386_TLS_TPOFF32 0+ +sG6
+[0-9a-f ]+R_386_TLS_TPOFF32 0+ +sG1
+[0-9a-f ]+R_386_TLS_TPOFF +0+ +sG8
+
+Relocation section '.rel.plt' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset +Info +Type +Sym.Value +Sym. Name
+[0-9a-f ]+R_386_JUMP_SLOT +[0-9a-f]+ +___tls_get_addr
+
+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 sG3
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG5
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG7
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG2
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG4
+ +[0-9]+: [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-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _edata
+ +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _end
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG8
+ +[0-9]+: [0-9a-f]+ +0 +FUNC +GLOBAL +DEFAULT +UND ___tls_get_addr
+
+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-9a-f]+ +0 +SECTION +LOCAL +DEFAULT +13 *
+ +[0-9]+: 00000020 +0 +TLS +LOCAL +DEFAULT +9 sl1
+ +[0-9]+: 00000024 +0 +TLS +LOCAL +DEFAULT +9 sl2
+ +[0-9]+: 00000028 +0 +TLS +LOCAL +DEFAULT +9 sl3
+ +[0-9]+: 0000002c +0 +TLS +LOCAL +DEFAULT +9 sl4
+ +[0-9]+: 00000030 +0 +TLS +LOCAL +DEFAULT +9 sl5
+ +[0-9]+: 00000034 +0 +TLS +LOCAL +DEFAULT +9 sl6
+ +[0-9]+: 00000038 +0 +TLS +LOCAL +DEFAULT +9 sl7
+ +[0-9]+: 0000003c +0 +TLS +LOCAL +DEFAULT +9 sl8
+ +[0-9]+: 00000080 +0 +TLS +LOCAL +DEFAULT +10 bl1
+ +[0-9]+: 00000084 +0 +TLS +LOCAL +DEFAULT +10 bl2
+ +[0-9]+: 00000088 +0 +TLS +LOCAL +DEFAULT +10 bl3
+ +[0-9]+: 0000008c +0 +TLS +LOCAL +DEFAULT +10 bl4
+ +[0-9]+: 00000090 +0 +TLS +LOCAL +DEFAULT +10 bl5
+ +[0-9]+: 00000094 +0 +TLS +LOCAL +DEFAULT +10 bl6
+ +[0-9]+: 00000098 +0 +TLS +LOCAL +DEFAULT +10 bl7
+ +[0-9]+: 0000009c +0 +TLS +LOCAL +DEFAULT +10 bl8
+ +[0-9]+: 0+804a060 +0 +OBJECT +LOCAL +DEFAULT +11 _DYNAMIC
+ +[0-9]+: [0-9a-f]+ +0 +OBJECT +LOCAL +DEFAULT +13 _GLOBAL_OFFSET_TABLE_
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG3
+ +[0-9]+: 0000001c +0 +TLS +GLOBAL +DEFAULT +9 sg8
+ +[0-9]+: 0000007c +0 +TLS +GLOBAL +DEFAULT +10 bg8
+ +[0-9]+: 00000074 +0 +TLS +GLOBAL +DEFAULT +10 bg6
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG5
+ +[0-9]+: 00000068 +0 +TLS +GLOBAL +DEFAULT +10 bg3
+ +[0-9]+: 00000008 +0 +TLS +GLOBAL +DEFAULT +9 sg3
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG7
+ +[0-9]+: 00000048 +0 +TLS +GLOBAL +HIDDEN +9 sh3
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG2
+ +[0-9]+: 0000000c +0 +TLS +GLOBAL +DEFAULT +9 sg4
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG4
+ +[0-9]+: 00000010 +0 +TLS +GLOBAL +DEFAULT +9 sg5
+ +[0-9]+: 00000070 +0 +TLS +GLOBAL +DEFAULT +10 bg5
+ +[0-9]+: 00000058 +0 +TLS +GLOBAL +HIDDEN +9 sh7
+ +[0-9]+: 0000005c +0 +TLS +GLOBAL +HIDDEN +9 sh8
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +9 sg1
+ +[0-9]+: 0+8049188 +0 +FUNC +GLOBAL +DEFAULT +8 _start
+ +[0-9]+: 0000004c +0 +TLS +GLOBAL +HIDDEN +9 sh4
+ +[0-9]+: 00000078 +0 +TLS +GLOBAL +DEFAULT +10 bg7
+ +[0-9]+: 00000050 +0 +TLS +GLOBAL +HIDDEN +9 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+8049000 +0 +FUNC +GLOBAL +DEFAULT +8 fn2
+ +[0-9]+: 00000004 +0 +TLS +GLOBAL +DEFAULT +9 sg2
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG1
+ +[0-9]+: 00000040 +0 +TLS +GLOBAL +HIDDEN +9 sh1
+ +[0-9]+: 00000014 +0 +TLS +GLOBAL +DEFAULT +9 sg6
+ +[0-9]+: 00000018 +0 +TLS +GLOBAL +DEFAULT +9 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]+: 00000044 +0 +TLS +GLOBAL +HIDDEN +9 sh2
+ +[0-9]+: 00000054 +0 +TLS +GLOBAL +HIDDEN +9 sh6
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG8
+ +[0-9]+: 00000064 +0 +TLS +GLOBAL +DEFAULT +10 bg2
+ +[0-9]+: 00000060 +0 +TLS +GLOBAL +DEFAULT +10 bg1
+ +[0-9]+: [0-9a-f]+ +0 +FUNC +GLOBAL +DEFAULT +UND ___tls_get_addr
+ +[0-9]+: 0000006c +0 +TLS +GLOBAL +DEFAULT +10 bg4
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsbin.s b/binutils-2.21/ld/testsuite/ld-i386/tlsbin.s
new file mode 100644
index 0000000..db80e09
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsbin.s
@@ -0,0 +1,165 @@
+ .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:
+ pushl %ebp
+ movl %esp, %ebp
+ /* Set up .GOT pointer for non-pic @gottpoff sequences */
+ call 1f
+1: popl %ecx
+ addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx
+ nop;nop;nop;nop
+
+ /* @gottpoff IE against global var */
+ movl %gs:0, %edx
+ nop;nop
+ subl sG6@gottpoff(%ecx), %edx
+ nop;nop;nop;nop
+
+ /* @indntpoff IE against global var */
+ movl %gs:0, %eax
+ nop;nop
+ addl sG7@indntpoff, %eax
+ nop;nop;nop;nop
+
+ /* @indntpoff direct %gs access IE against global var */
+ movl sG8@indntpoff, %edx
+ nop;nop
+ movl %gs:(%edx), %eax
+ nop;nop;nop;nop
+
+ /* @gottpoff IE -> LE against global var defined in exec */
+ movl %gs:0, %edx
+ nop;nop
+ subl bg6@gottpoff(%ecx), %edx
+ nop;nop;nop;nop
+
+ /* @indntpoff IE -> LE against global var defined in exec */
+ movl %gs:0, %eax
+ nop;nop
+ addl bg7@indntpoff, %eax
+ nop;nop;nop;nop
+
+ /* @indntpoff direct %gs access IE -> LE against global var defined
+ in exec */
+ movl bg8@indntpoff, %edx
+ nop;nop
+ movl %gs:(%edx), %eax
+ nop;nop;nop;nop
+
+ /* @gottpoff IE -> LE against local var */
+ movl %gs:0, %edx
+ nop;nop
+ subl bl6@gottpoff(%ecx), %edx
+ nop;nop;nop;nop
+
+ /* @indntpoff IE -> LE against local var */
+ movl %gs:0, %eax
+ nop;nop
+ addl bl7@indntpoff, %eax
+ nop;nop;nop;nop
+
+ /* @indntpoff direct %gs access IE -> LE against local var */
+ movl bl8@indntpoff, %edx
+ nop;nop
+ movl %gs:(%edx), %eax
+ nop;nop;nop;nop
+
+ /* @gottpoff IE -> LE against hidden but not local var */
+ movl %gs:0, %edx
+ nop;nop
+ subl sh6@gottpoff(%ecx), %edx
+ nop;nop;nop;nop
+
+ /* @indntpoff IE -> LE against hidden but not local var */
+ movl %gs:0, %eax
+ nop;nop
+ addl sh7@indntpoff, %eax
+ nop;nop;nop;nop
+
+ /* @indntpoff direct %gs access IE -> LE against hidden but not
+ local var */
+ movl sh8@indntpoff, %edx
+ nop;nop
+ movl %gs:(%edx), %eax
+ nop;nop;nop;nop
+
+ /* LE @tpoff, global var defined in exec */
+ movl $sg1@tpoff, %edx
+ nop;nop
+ movl %gs:0, %eax
+ nop;nop
+ subl %edx, %eax
+ nop;nop;nop;nop
+
+ /* LE @tpoff, local var */
+ movl $-1+bl1@tpoff, %eax
+ nop;nop
+ movl %gs:0, %edx
+ nop;nop
+ subl %eax, %edx
+ nop;nop;nop;nop
+
+ /* LE @tpoff, hidden var defined in exec */
+ movl $sh1@tpoff-3, %eax
+ nop;nop
+ movl %gs:0, %edx
+ nop;nop
+ subl %eax, %edx
+ nop;nop;nop;nop
+
+ /* LE @ntpoff, global var defined in exec */
+ movl %gs:0, %eax
+ nop;nop
+ leal sg2@ntpoff(%eax), %edx
+ nop;nop;nop;nop
+
+ /* LE @ntpoff, local var, non-canonical sequence */
+ movl $2+bl2@ntpoff, %eax
+ nop;nop
+ movl %gs:0, %edx
+ nop;nop
+ addl %eax, %edx
+ nop;nop;nop;nop
+
+ /* LE @ntpoff, hidden var defined in exec, non-canonical sequence */
+ movl %gs:0, %edx
+ nop;nop
+ addl $sh2@ntpoff+1, %edx
+ nop;nop;nop;nop
+
+ /* Direct %gs access */
+
+ /* LE @ntpoff, global var defined in exec */
+ movl %gs:sg3@ntpoff, %eax
+ nop;nop;nop;nop
+
+ /* LE @ntpoff, local var */
+ movl %gs:bl3@ntpoff+3, %edx
+ nop;nop;nop;nop
+
+ /* LE @ntpoff, hidden var defined in exec */
+ movl %gs:1+sh3@ntpoff, %edx
+ nop;nop;nop;nop
+
+ movl -4(%ebp), %ebx
+ leave
+ ret
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsbin.sd b/binutils-2.21/ld/testsuite/ld-i386/tlsbin.sd
new file mode 100644
index 0000000..2fa7a89
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsbin.sd
@@ -0,0 +1,13 @@
+#source: tlsbinpic.s
+#source: tlsbin.s
+#as: --32
+#ld: -melf_i386 tmpdir/libtlslib.so
+#objdump: -sj.got
+#target: i?86-*-*
+
+.*: file format elf32-i386
+
+Contents of section \.got:
+ 804a100 [0-9a-f]+ 00000000 00000000 [0-9a-f]+ .*
+ 804a110 00000000 00000000 00000000 00000000 .*
+ 804a120 00000000 +.*
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsbin.td b/binutils-2.21/ld/testsuite/ld-i386/tlsbin.td
new file mode 100644
index 0000000..bb29455
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsbin.td
@@ -0,0 +1,16 @@
+#source: tlsbinpic.s
+#source: tlsbin.s
+#as: --32
+#ld: -melf_i386 tmpdir/libtlslib.so
+#objdump: -sj.tdata
+#target: i?86-*-*
+
+.*: file format elf32-i386
+
+Contents of section \.tdata:
+ 804a000 11000000 12000000 13000000 14000000 .*
+ 804a010 15000000 16000000 17000000 18000000 .*
+ 804a020 41000000 42000000 43000000 44000000 .*
+ 804a030 45000000 46000000 47000000 48000000 .*
+ 804a040 01010000 02010000 03010000 04010000 .*
+ 804a050 05010000 06010000 07010000 08010000 .*
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsbindesc.dd b/binutils-2.21/ld/testsuite/ld-i386/tlsbindesc.dd
new file mode 100644
index 0000000..f77d1c8
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsbindesc.dd
@@ -0,0 +1,456 @@
+#source: tlsbindesc.s
+#source: tlsbin.s
+#as: --32
+#ld: -melf_i386 tmpdir/libtlslib.so
+#objdump: -drj.text
+#target: i?86-*-*
+
+# 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 elf32-i386
+
+Disassembly of section .text:
+
+[0-9a-f]+ <fn2>:
+ [0-9a-f]+: 55[ ]+push %ebp
+ [0-9a-f]+: 89 e5[ ]+mov %esp,%ebp
+ [0-9a-f]+: 53[ ]+push %ebx
+ [0-9a-f]+: 50[ ]+push %eax
+ [0-9a-f]+: e8 00 00 00 00[ ]+call [0-9a-f]+ <fn2\+0xa>
+ [0-9a-f]+: 5b[ ]+pop %ebx
+ [0-9a-f]+: 81 c3 fa 10 00 00[ ]+add \$0x10fa,%ebx
+ [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
+ [0-9a-f]+: 8b 83 f8 ff ff ff[ ]+mov -0x8\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 sG1
+ [0-9a-f]+: f7 d8[ ]+neg %eax
+ [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 @gottpoff too
+ [0-9a-f]+: 8b 83 e8 ff ff ff[ ]+mov -0x18\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 sG2
+ [0-9a-f]+: f7 d8[ ]+neg %eax
+ [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 @gotntpoff too
+ [0-9a-f]+: 8b 83 dc ff ff ff[ ]+mov -0x24\(%ebx\),%eax
+# ->R_386_TLS_TPOFF 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 because variable is not defined in executable where
+# the variable is referenced through @gottpoff and @gotntpoff too
+ [0-9a-f]+: 8b 83 f0 ff ff ff[ ]+mov -0x10\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 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 *
+# GD -> LE with global variable defined in executable
+ [0-9a-f]+: 8d 05 00 f0 ff ff[ ]+lea 0xfffff000,%eax
+# 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]+: 8d 05 20 f0 ff ff[ ]+lea 0xfffff020,%eax
+# 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]+: 8d 05 40 f0 ff ff[ ]+lea 0xfffff040,%eax
+# 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]+: 8d 05 00 00 00 00[ ]+lea 0x0,%eax
+ [0-9a-f]+: 66 90[ ]+xchg %ax,%ax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8d 90 20 f0 ff ff[ ]+lea -0xfe0\(%eax\),%edx
+# sl1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8d 88 24 f0 ff ff[ ]+lea -0xfdc\(%eax\),%ecx
+# sl2
+ [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]+: 8d 05 00 00 00 00[ ]+lea 0x0,%eax
+ [0-9a-f]+: 66 90[ ]+xchg %ax,%ax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8d 90 40 f0 ff ff[ ]+lea -0xfc0\(%eax\),%edx
+# sh1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8d 88 44 f0 ff ff[ ]+lea -0xfbc\(%eax\),%ecx
+# sh2
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE against global var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 2b 8b e8 ff ff ff[ ]+sub -0x18\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF32 sG2
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE against global var
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 2b 83 ec ff ff ff[ ]+sub -0x14\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 sG4
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against global var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 03 8b dc ff ff ff[ ]+add -0x24\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF sG3
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against global var
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 03 83 f0 ff ff ff[ ]+add -0x10\(%ebx\),%eax
+# ->R_386_TLS_TPOFF sG4
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE -> LE against global var defined in exec
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 81 e9 00 10 00 00[ ]+sub \$0x1000,%ecx
+# sg1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE -> LE against local var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 81 c0 20 f0 ff ff[ ]+add \$0xfffff020,%eax
+# sl1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE -> LE against hidden var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 81 e9 c0 0f 00 00[ ]+sub \$0xfc0,%ecx
+# sh1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# Direct access through %gs
+# @gotntpoff IE against global var
+ [0-9a-f]+: 8b 8b e0 ff ff ff[ ]+mov -0x20\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF sG5
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 65 8b 11[ ]+mov %gs:\(%ecx\),%edx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE->LE against local var
+ [0-9a-f]+: c7 c0 30 f0 ff ff[ ]+mov \$0xfffff030,%eax
+# sl5
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 65 8b 10[ ]+mov %gs:\(%eax\),%edx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE->LE against hidden var
+ [0-9a-f]+: c7 c2 50 f0 ff ff[ ]+mov \$0xfffff050,%edx
+# sh5
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 65 8b 12[ ]+mov %gs:\(%edx\),%edx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8b 5d fc[ ]+mov -0x4\(%ebp\),%ebx
+ [0-9a-f]+: c9[ ]+leave *
+ [0-9a-f]+: c3[ ]+ret *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+
+[0-9a-f]+ <_start>:
+ [0-9a-f]+: 55[ ]+push %ebp
+ [0-9a-f]+: 89 e5[ ]+mov %esp,%ebp
+ [0-9a-f]+: e8 00 00 00 00[ ]+call [0-9a-f]+ <_start\+0x8>
+ [0-9a-f]+: 59[ ]+pop %ecx
+ [0-9a-f]+: 81 c1 a4 0f 00 00[ ]+add \$0xfa4,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE against global var
+ [0-9a-f]+: 65 8b 15 00 00 00 00[ ]+mov %gs:0x0,%edx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 2b 91 f4 ff ff ff[ ]+sub -0xc\(%ecx\),%edx
+# ->R_386_TLS_TPOFF32 sG6
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @indntpoff IE against global var
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 03 05 e8 a0 04 08[ ]+add 0x804a0e8,%eax
+# ->R_386_TLS_TPOFF sG7
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @indntpoff direct %gs access IE against global var
+ [0-9a-f]+: 8b 15 00 a1 04 08[ ]+mov 0x804a100,%edx
+# ->R_386_TLS_TPOFF sG8
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 65 8b 02[ ]+mov %gs:\(%edx\),%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE -> LE against global var defined in exec
+ [0-9a-f]+: 65 8b 15 00 00 00 00[ ]+mov %gs:0x0,%edx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 81 ea 8c 0f 00 00[ ]+sub \$0xf8c,%edx
+# bg6
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @indntpoff IE -> LE against global var defined in exec
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 81 c0 78 f0 ff ff[ ]+add \$0xfffff078,%eax
+# bg7
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @indntpoff direct %gs access IE -> LE against global var defined
+# in exec
+ [0-9a-f]+: c7 c2 7c f0 ff ff[ ]+mov \$0xfffff07c,%edx
+# bg8
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 65 8b 02[ ]+mov %gs:\(%edx\),%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE -> LE against local var
+ [0-9a-f]+: 65 8b 15 00 00 00 00[ ]+mov %gs:0x0,%edx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 81 ea 6c 0f 00 00[ ]+sub \$0xf6c,%edx
+# bl6
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @indntpoff IE -> LE against local var
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 81 c0 98 f0 ff ff[ ]+add \$0xfffff098,%eax
+# bl7
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @indntpoff direct %gs access IE -> LE against local var
+ [0-9a-f]+: c7 c2 9c f0 ff ff[ ]+mov \$0xfffff09c,%edx
+# bl8
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 65 8b 02[ ]+mov %gs:\(%edx\),%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE -> LE against hidden but not local var
+ [0-9a-f]+: 65 8b 15 00 00 00 00[ ]+mov %gs:0x0,%edx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 81 ea ac 0f 00 00[ ]+sub \$0xfac,%edx
+# sh6
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @indntpoff IE -> LE against hidden but not local var
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 81 c0 58 f0 ff ff[ ]+add \$0xfffff058,%eax
+# sh7
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @indntpoff direct %gs access IE -> LE against hidden but not
+# local var
+ [0-9a-f]+: c7 c2 5c f0 ff ff[ ]+mov \$0xfffff05c,%edx
+# sh8
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 65 8b 02[ ]+mov %gs:\(%edx\),%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# LE @tpoff, global var defined in exec
+ [0-9a-f]+: ba 00 10 00 00[ ]+mov \$0x1000,%edx
+# sg1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 29 d0[ ]+sub %edx,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# LE @tpoff, local var
+ [0-9a-f]+: b8 7f 0f 00 00[ ]+mov \$0xf7f,%eax
+# bl1+1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 65 8b 15 00 00 00 00[ ]+mov %gs:0x0,%edx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 29 c2[ ]+sub %eax,%edx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# LE @tpoff, hidden var defined in exec
+ [0-9a-f]+: b8 bd 0f 00 00[ ]+mov \$0xfbd,%eax
+# sh1+3
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 65 8b 15 00 00 00 00[ ]+mov %gs:0x0,%edx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 29 c2[ ]+sub %eax,%edx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# LE @ntpoff, global var defined in exec
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8d 90 04 f0 ff ff[ ]+lea -0xffc\(%eax\),%edx
+# sg2
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# LE @ntpoff, local var, non-canonical sequence
+ [0-9a-f]+: b8 86 f0 ff ff[ ]+mov \$0xfffff086,%eax
+# bl2+2
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 65 8b 15 00 00 00 00[ ]+mov %gs:0x0,%edx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 01 c2[ ]+add %eax,%edx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# LE @ntpoff, hidden var defined in exec, non-canonical sequence
+ [0-9a-f]+: 65 8b 15 00 00 00 00[ ]+mov %gs:0x0,%edx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 81 c2 45 f0 ff ff[ ]+add \$0xfffff045,%edx
+# sh2+1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# LE @ntpoff, global var defined in exec
+ [0-9a-f]+: 65 a1 08 f0 ff ff[ ]+mov %gs:0xfffff008,%eax
+# sg3
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# LE @ntpoff, local var
+ [0-9a-f]+: 65 8b 15 8b f0 ff ff[ ]+mov %gs:0xfffff08b,%edx
+# bl3+3
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# LE @ntpoff, hidden var defined in exec
+ [0-9a-f]+: 65 8b 15 49 f0 ff ff[ ]+mov %gs:0xfffff049,%edx
+# 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]+: 8b 5d fc[ ]+mov -0x4\(%ebp\),%ebx
+ [0-9a-f]+: c9[ ]+leave *
+ [0-9a-f]+: c3[ ]+ret *
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsbindesc.rd b/binutils-2.21/ld/testsuite/ld-i386/tlsbindesc.rd
new file mode 100644
index 0000000..c2cea19
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsbindesc.rd
@@ -0,0 +1,151 @@
+#source: tlsbindesc.s
+#source: tlsbin.s
+#as: --32
+#ld: -melf_i386 tmpdir/libtlslib.so
+#readelf: -Ssrl
+#target: i?86-*-*
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Addr +Off +Size +ES Flg Lk Inf Al
+ +\[[ 0-9]+\] +NULL +0+ 0+ 0+ 0+ +0 +0 +0
+ +\[[ 0-9]+\] \.interp +.*
+ +\[[ 0-9]+\] \.hash +.*
+ +\[[ 0-9]+\] \.dynsym +.*
+ +\[[ 0-9]+\] \.dynstr +.*
+ +\[[ 0-9]+\] \.rel.dyn +.*
+ +\[[ 0-9]+\] \.text +PROGBITS +0+8049000 .*
+ +\[[ 0-9]+\] \.tdata +PROGBITS +0+804a000 [0-9a-f]+ 000060 00 WAT +0 +0 4096
+ +\[[ 0-9]+\] \.tbss +NOBITS +[0-9a-f]+ [0-9a-f]+ 000040 00 WAT +0 +0 +1
+ +\[[ 0-9]+\] \.dynamic +DYNAMIC +0+804a060 .*
+ +\[[ 0-9]+\] \.got +PROGBITS +0+804a0e0 .*
+ +\[[ 0-9]+\] \.got\.plt +PROGBITS +0+804a104 .*
+ +\[[ 0-9]+\] \.shstrtab +.*
+ +\[[ 0-9]+\] \.symtab +.*
+ +\[[ 0-9]+\] \.strtab +.*
+Key to Flags:
+.*
+.*
+.*
+
+Elf file type is EXEC \(Executable file\)
+Entry point 0x8049158
+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.*
+ +LOAD.*
+ +DYNAMIC.*
+ +TLS +0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x0+60 0x0+a0 R +0x1000
+
+ Section to Segment mapping:
+ +Segment Sections...
+ +00 +
+ +01 +.interp *
+ +02 +.interp .hash .dynsym .dynstr .rel.dyn .text *
+ +03 +.tdata .dynamic .got .got.plt *
+ +04 +.dynamic *
+ +05 +.tdata .tbss *
+
+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 9 entries:
+ Offset +Info +Type +Sym.Value +Sym. Name
+0+804a0e0 +0000010e R_386_TLS_TPOFF +0+ +sG3
+0+804a0e4 +0000020e R_386_TLS_TPOFF +0+ +sG5
+0+804a0e8 +0000030e R_386_TLS_TPOFF +0+ +sG7
+0+804a0ec +00000425 R_386_TLS_TPOFF32 0+ +sG2
+0+804a0f0 +00000525 R_386_TLS_TPOFF32 0+ +sG4
+0+804a0f4 +0000050e R_386_TLS_TPOFF +0+ +sG4
+0+804a0f8 +00000725 R_386_TLS_TPOFF32 0+ +sG6
+0+804a0fc +00000825 R_386_TLS_TPOFF32 0+ +sG1
+0+804a100 +00000b0e R_386_TLS_TPOFF +0+ +sG8
+
+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 sG3
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG5
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG7
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG2
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG4
+ +[0-9]+: [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-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _edata
+ +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS _end
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG8
+
+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]+: 00000020 +0 +TLS +LOCAL +DEFAULT +7 sl1
+ +[0-9]+: 00000024 +0 +TLS +LOCAL +DEFAULT +7 sl2
+ +[0-9]+: 00000028 +0 +TLS +LOCAL +DEFAULT +7 sl3
+ +[0-9]+: 0000002c +0 +TLS +LOCAL +DEFAULT +7 sl4
+ +[0-9]+: 00000030 +0 +TLS +LOCAL +DEFAULT +7 sl5
+ +[0-9]+: 00000034 +0 +TLS +LOCAL +DEFAULT +7 sl6
+ +[0-9]+: 00000038 +0 +TLS +LOCAL +DEFAULT +7 sl7
+ +[0-9]+: 0000003c +0 +TLS +LOCAL +DEFAULT +7 sl8
+ +[0-9]+: 00000080 +0 +TLS +LOCAL +DEFAULT +8 bl1
+ +[0-9]+: 00000084 +0 +TLS +LOCAL +DEFAULT +8 bl2
+ +[0-9]+: 00000088 +0 +TLS +LOCAL +DEFAULT +8 bl3
+ +[0-9]+: 0000008c +0 +TLS +LOCAL +DEFAULT +8 bl4
+ +[0-9]+: 00000090 +0 +TLS +LOCAL +DEFAULT +8 bl5
+ +[0-9]+: 00000094 +0 +TLS +LOCAL +DEFAULT +8 bl6
+ +[0-9]+: 00000098 +0 +TLS +LOCAL +DEFAULT +8 bl7
+ +[0-9]+: 0000009c +0 +TLS +LOCAL +DEFAULT +8 bl8
+ +[0-9]+: 00001000 +0 +TLS +LOCAL +DEFAULT +7 _TLS_MODULE_BASE_
+ +[0-9]+: 0+804a060 +0 +OBJECT +LOCAL +DEFAULT +9 _DYNAMIC
+ +[0-9]+: [0-9a-f]+ +0 +OBJECT +LOCAL +DEFAULT +11 _GLOBAL_OFFSET_TABLE_
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG3
+ +[0-9]+: 0000001c +0 +TLS +GLOBAL +DEFAULT +7 sg8
+ +[0-9]+: 0000007c +0 +TLS +GLOBAL +DEFAULT +8 bg8
+ +[0-9]+: 00000074 +0 +TLS +GLOBAL +DEFAULT +8 bg6
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG5
+ +[0-9]+: 00000068 +0 +TLS +GLOBAL +DEFAULT +8 bg3
+ +[0-9]+: 00000008 +0 +TLS +GLOBAL +DEFAULT +7 sg3
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG7
+ +[0-9]+: 00000048 +0 +TLS +GLOBAL +HIDDEN +7 sh3
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG2
+ +[0-9]+: 0000000c +0 +TLS +GLOBAL +DEFAULT +7 sg4
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG4
+ +[0-9]+: 00000010 +0 +TLS +GLOBAL +DEFAULT +7 sg5
+ +[0-9]+: 00000070 +0 +TLS +GLOBAL +DEFAULT +8 bg5
+ +[0-9]+: 00000058 +0 +TLS +GLOBAL +HIDDEN +7 sh7
+ +[0-9]+: 0000005c +0 +TLS +GLOBAL +HIDDEN +7 sh8
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +7 sg1
+ +[0-9]+: 0+8049158 +0 +FUNC +GLOBAL +DEFAULT +6 _start
+ +[0-9]+: 0000004c +0 +TLS +GLOBAL +HIDDEN +7 sh4
+ +[0-9]+: 00000078 +0 +TLS +GLOBAL +DEFAULT +8 bg7
+ +[0-9]+: 00000050 +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+8049000 +0 +FUNC +GLOBAL +DEFAULT +6 fn2
+ +[0-9]+: 00000004 +0 +TLS +GLOBAL +DEFAULT +7 sg2
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG1
+ +[0-9]+: 00000040 +0 +TLS +GLOBAL +HIDDEN +7 sh1
+ +[0-9]+: 00000014 +0 +TLS +GLOBAL +DEFAULT +7 sg6
+ +[0-9]+: 00000018 +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]+: 00000044 +0 +TLS +GLOBAL +HIDDEN +7 sh2
+ +[0-9]+: 00000054 +0 +TLS +GLOBAL +HIDDEN +7 sh6
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sG8
+ +[0-9]+: 00000064 +0 +TLS +GLOBAL +DEFAULT +8 bg2
+ +[0-9]+: 00000060 +0 +TLS +GLOBAL +DEFAULT +8 bg1
+ +[0-9]+: 0000006c +0 +TLS +GLOBAL +DEFAULT +8 bg4
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsbindesc.s b/binutils-2.21/ld/testsuite/ld-i386/tlsbindesc.s
new file mode 100644
index 0000000..9094d08
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsbindesc.s
@@ -0,0 +1,167 @@
+ /* Force .got aligned to 4K, so it very likely gets at 0x804a100
+ (0x60 bytes .tdata and 0xa0 bytes .dynamic) */
+ .section ".tdata", "awT", @progbits
+ .balign 4096
+ .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 0x8049000. */
+ .text
+ .balign 4096
+ .globl fn2
+ .type fn2,@function
+fn2:
+ pushl %ebp
+ movl %esp, %ebp
+ pushl %ebx
+ pushl %eax
+ call 1f
+1: popl %ebx
+ addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
+ nop;nop;nop;nop
+
+ /* GD -> IE because variable is not defined in executable */
+ leal sG1@tlsdesc(%ebx), %eax
+ call *sG1@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD -> IE because variable is not defined in executable where
+ the variable is referenced through @gottpoff too */
+ leal sG2@tlsdesc(%ebx), %eax
+ call *sG2@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD -> IE because variable is not defined in executable where
+ the variable is referenced through @gotntpoff too */
+ leal sG3@tlsdesc(%ebx), %eax
+ call *sG3@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD -> IE because variable is not defined in executable where
+ the variable is referenced through @gottpoff and @gotntpoff too */
+ leal sG4@tlsdesc(%ebx), %eax
+ call *sG4@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD -> LE with global variable defined in executable */
+ leal sg1@tlsdesc(%ebx), %eax
+ call *sg1@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD -> LE with local variable defined in executable */
+ leal sl1@tlsdesc(%ebx), %eax
+ call *sl1@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD -> LE with hidden variable defined in executable */
+ leal sh1@tlsdesc(%ebx), %eax
+ call *sh1@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* LD -> LE */
+ leal _TLS_MODULE_BASE_@tlsdesc(%ebx), %eax
+ call *_TLS_MODULE_BASE_@tlscall(%eax)
+ nop;nop
+ leal sl1@dtpoff(%eax), %edx
+ nop;nop
+ leal sl2@dtpoff(%eax), %ecx
+ nop;nop;nop;nop
+
+ /* LD -> LE against hidden variables */
+ leal _TLS_MODULE_BASE_@tlsdesc(%ebx), %eax
+ call *_TLS_MODULE_BASE_@tlscall(%eax)
+ nop;nop
+ leal sh1@dtpoff(%eax), %edx
+ nop;nop
+ leal sh2@dtpoff(%eax), %ecx
+ nop;nop;nop;nop
+
+ /* @gottpoff IE against global var */
+ movl %gs:0, %ecx
+ nop;nop
+ subl sG2@gottpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gottpoff IE against global var */
+ movl %gs:0, %eax
+ nop;nop
+ subl sG4@gottpoff(%ebx), %eax
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against global var */
+ movl %gs:0, %ecx
+ nop;nop
+ addl sG3@gotntpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against global var */
+ movl %gs:0, %eax
+ nop;nop
+ addl sG4@gotntpoff(%ebx), %eax
+ nop;nop;nop;nop
+
+ /* @gottpoff IE -> LE against global var defined in exec */
+ movl %gs:0, %ecx
+ nop;nop
+ subl sg1@gottpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE -> LE against local var */
+ movl %gs:0, %ecx
+ nop;nop
+ addl sl1@gotntpoff(%ebx), %eax
+ nop;nop;nop;nop
+
+ /* @gottpoff IE -> LE against hidden var */
+ movl %gs:0, %ecx
+ nop;nop
+ subl sh1@gottpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* Direct access through %gs */
+
+ /* @gotntpoff IE against global var */
+ movl sG5@gotntpoff(%ebx), %ecx
+ nop;nop
+ movl %gs:(%ecx), %edx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE->LE against local var */
+ movl sl5@gotntpoff(%ebx), %eax
+ nop;nop
+ movl %gs:(%eax), %edx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE->LE against hidden var */
+ movl sh5@gotntpoff(%ebx), %edx
+ nop;nop
+ movl %gs:(%edx), %edx
+ nop;nop;nop;nop
+
+ movl -4(%ebp), %ebx
+ leave
+ ret
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsbindesc.sd b/binutils-2.21/ld/testsuite/ld-i386/tlsbindesc.sd
new file mode 100644
index 0000000..a87f5da
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsbindesc.sd
@@ -0,0 +1,13 @@
+#source: tlsbindesc.s
+#source: tlsbin.s
+#as: --32
+#ld: -melf_i386 tmpdir/libtlslib.so
+#objdump: -sj.got
+#target: i?86-*-*
+
+.*: file format elf32-i386
+
+Contents of section \.got:
+ 804a0e0 [0-9a-f]+ 00000000 00000000 [0-9a-f]+ .*
+ 804a0f0 00000000 00000000 00000000 00000000 .*
+ 804a100 00000000 +.*
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsbindesc.td b/binutils-2.21/ld/testsuite/ld-i386/tlsbindesc.td
new file mode 100644
index 0000000..726df3e
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsbindesc.td
@@ -0,0 +1,16 @@
+#source: tlsbindesc.s
+#source: tlsbin.s
+#as: --32
+#ld: -melf_i386 tmpdir/libtlslib.so
+#objdump: -sj.tdata
+#target: i?86-*-*
+
+.*: file format elf32-i386
+
+Contents of section \.tdata:
+ 804a000 11000000 12000000 13000000 14000000 .*
+ 804a010 15000000 16000000 17000000 18000000 .*
+ 804a020 41000000 42000000 43000000 44000000 .*
+ 804a030 45000000 46000000 47000000 48000000 .*
+ 804a040 01010000 02010000 03010000 04010000 .*
+ 804a050 05010000 06010000 07010000 08010000 .*
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsbinpic.s b/binutils-2.21/ld/testsuite/ld-i386/tlsbinpic.s
new file mode 100644
index 0000000..9c8a006
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsbinpic.s
@@ -0,0 +1,172 @@
+ /* Force .got aligned to 4K, so it very likely gets at 0x804a100
+ (0x60 bytes .tdata and 0xa0 bytes .dynamic) */
+ .section ".tdata", "awT", @progbits
+ .balign 4096
+ .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 0x8049000. */
+ .text
+ .balign 4096
+ .globl fn2
+ .type fn2,@function
+fn2:
+ pushl %ebp
+ movl %esp, %ebp
+ pushl %ebx
+ pushl %eax
+ call 1f
+1: popl %ebx
+ addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
+ nop;nop;nop;nop
+
+ /* GD -> IE because variable is not defined in executable */
+ leal sG1@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE because variable is not defined in executable where
+ the variable is referenced through @gottpoff too */
+ leal sG2@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE because variable is not defined in executable where
+ the variable is referenced through @gotntpoff too */
+ leal sG3@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE because variable is not defined in executable where
+ the variable is referenced through @gottpoff and @gotntpoff too */
+ leal sG4@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> LE with global variable defined in executable */
+ leal sg1@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> LE with local variable defined in executable */
+ leal sl1@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> LE with hidden variable defined in executable */
+ leal sh1@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* LD -> LE */
+ leal sl1@tlsldm(%ebx), %eax
+ call ___tls_get_addr@PLT
+ nop;nop
+ leal sl1@dtpoff(%eax), %edx
+ nop;nop
+ leal sl2@dtpoff(%eax), %ecx
+ nop;nop;nop;nop
+
+ /* LD -> LE against hidden variables */
+ leal sh1@tlsldm(%ebx), %eax
+ call ___tls_get_addr@PLT
+ nop;nop
+ leal sh1@dtpoff(%eax), %edx
+ nop;nop
+ leal sh2@dtpoff(%eax), %ecx
+ nop;nop;nop;nop
+
+ /* @gottpoff IE against global var */
+ movl %gs:0, %ecx
+ nop;nop
+ subl sG2@gottpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gottpoff IE against global var */
+ movl %gs:0, %eax
+ nop;nop
+ subl sG4@gottpoff(%ebx), %eax
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against global var */
+ movl %gs:0, %ecx
+ nop;nop
+ addl sG3@gotntpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against global var */
+ movl %gs:0, %eax
+ nop;nop
+ addl sG4@gotntpoff(%ebx), %eax
+ nop;nop;nop;nop
+
+ /* @gottpoff IE -> LE against global var defined in exec */
+ movl %gs:0, %ecx
+ nop;nop
+ subl sg1@gottpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE -> LE against local var */
+ movl %gs:0, %ecx
+ nop;nop
+ addl sl1@gotntpoff(%ebx), %eax
+ nop;nop;nop;nop
+
+ /* @gottpoff IE -> LE against hidden var */
+ movl %gs:0, %ecx
+ nop;nop
+ subl sh1@gottpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* Direct access through %gs */
+
+ /* @gotntpoff IE against global var */
+ movl sG5@gotntpoff(%ebx), %ecx
+ nop;nop
+ movl %gs:(%ecx), %edx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE->LE against local var */
+ movl sl5@gotntpoff(%ebx), %eax
+ nop;nop
+ movl %gs:(%eax), %edx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE->LE against hidden var */
+ movl sh5@gotntpoff(%ebx), %edx
+ nop;nop
+ movl %gs:(%edx), %edx
+ nop;nop;nop;nop
+
+ /* GD -> IE because variable is not defined in executable */
+ leal sG1@tlsgd(%ebx), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop;nop
+
+ movl -4(%ebp), %ebx
+ leave
+ ret
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsdesc.dd b/binutils-2.21/ld/testsuite/ld-i386/tlsdesc.dd
new file mode 100644
index 0000000..bca0090
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsdesc.dd
@@ -0,0 +1,391 @@
+#source: tlsdesc.s
+#source: tlspic2.s
+#as: --32
+#ld: -shared -melf_i386
+#objdump: -drj.text
+#target: i?86-*-*
+
+.*: +file format elf32-i386
+
+Disassembly of section .text:
+
+[0-9a-f]+ <fn1>:
+ [0-9a-f]+: 55[ ]+push %ebp
+ [0-9a-f]+: 89 e5[ ]+mov %esp,%ebp
+ [0-9a-f]+: 53[ ]+push %ebx
+ [0-9a-f]+: 50[ ]+push %eax
+ [0-9a-f]+: e8 00 00 00 00[ ]+call [0-9a-f]+ <fn1\+0xa>
+ [0-9a-f]+: 5b[ ]+pop %ebx
+ [0-9a-f]+: 81 c3 9a 13 00 00[ ]+add \$0x[0-9a-f]+,%ebx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# GDesc
+ [0-9a-f]+: 8d 83 24 00 00 00[ ]+lea 0x24\(%ebx\),%eax
+# ->R_386_TLS_DESC sg1
+ [0-9a-f]+: ff 10[ ]+call \*\(%eax\)
+ [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 @gottpoff too
+ [0-9a-f]+: 8b 83 f8 ff ff ff[ ]+mov -0x8\(%ebx\),%eax
+# ->R_386_TLS_TPOFF sg2
+ [0-9a-f]+: f7 d8[ ]+neg %eax
+ [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 @gotntpoff too
+ [0-9a-f]+: 8b 83 c4 ff ff ff[ ]+mov -0x3c\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 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 because variable is referenced through @gottpoff and
+ [0-9a-f]+: 8b 83 d4 ff ff ff[ ]+mov -0x2c\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 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 *
+# GD against local variable
+ [0-9a-f]+: 8d 83 0c 00 00 00[ ]+lea 0xc\(%ebx\),%eax
+# ->R_386_TLS_DESC sl1
+ [0-9a-f]+: ff 10[ ]+call \*\(%eax\)
+ [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 @gottpoff too
+ [0-9a-f]+: 8b 83 b0 ff ff ff[ ]+mov -0x50\(%ebx\),%eax
+# ->R_386_TLS_TPOFF sl2
+ [0-9a-f]+: f7 d8[ ]+neg %eax
+ [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 @gotntpoff
+ [0-9a-f]+: 8b 83 b4 ff ff ff[ ]+mov -0x4c\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 sl3
+ [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 against local variable referenced through @gottpoff and
+ [0-9a-f]+: 8b 83 bc ff ff ff[ ]+mov -0x44\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 sl4
+ [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]+: 8d 83 2c 00 00 00[ ]+lea 0x2c\(%ebx\),%eax
+# ->R_386_TLS_DESC sh1
+ [0-9a-f]+: ff 10[ ]+call \*\(%eax\)
+ [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 @gottpoff too
+ [0-9a-f]+: 8b 83 fc ff ff ff[ ]+mov -0x4\(%ebx\),%eax
+# ->R_386_TLS_TPOFF sh2
+ [0-9a-f]+: f7 d8[ ]+neg %eax
+ [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 @gotntpoff too
+ [0-9a-f]+: 8b 83 c8 ff ff ff[ ]+mov -0x38\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 sh3
+ [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 against hidden and local variable referenced through @gottpoff and @gotntpoff too
+ [0-9a-f]+: 8b 83 e8 ff ff ff[ ]+mov -0x18\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 sh4
+ [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]+: 8d 83 14 00 00 00[ ]+lea 0x14\(%ebx\),%eax
+# ->R_386_TLS_DESC sH1
+ [0-9a-f]+: ff 10[ ]+call \*\(%eax\)
+ [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
+ [0-9a-f]+: 8b 83 cc ff ff ff[ ]+mov -0x34\(%ebx\),%eax
+# ->R_386_TLS_TPOFF sH2
+ [0-9a-f]+: f7 d8[ ]+neg %eax
+ [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
+ [0-9a-f]+: 8b 83 ec ff ff ff[ ]+mov -0x14\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 sH3
+ [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 against hidden but not local variable referenced through
+ [0-9a-f]+: 8b 83 e0 ff ff ff[ ]+mov -0x20\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 sH4
+ [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]+: 8d 83 1c 00 00 00[ ]+lea 0x1c\(%ebx\),%eax
+# ->R_386_TLS_DESC _TLS_MODULE_BASE_
+ [0-9a-f]+: ff 10[ ]+call \*\(%eax\)
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8d 90 20 00 00 00[ ]+lea 0x20\(%eax\),%edx
+# sl1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8d 88 26 00 00 00[ ]+lea 0x26\(%eax\),%ecx
+# sl2+2
+ [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]+: 8d 90 40 00 00 00[ ]+lea 0x40\(%eax\),%edx
+# sh1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8d 88 47 00 00 00[ ]+lea 0x47\(%eax\),%ecx
+# sh2+3
+ [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]+: 8d 90 60 00 00 00[ ]+lea 0x60\(%eax\),%edx
+# sH1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8d 88 65 00 00 00[ ]+lea 0x65\(%eax\),%ecx
+# sH2+1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE against global var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 2b 8b f8 ff ff ff[ ]+sub -0x8\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF32 sg2
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE against global var
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 2b 83 d0 ff ff ff[ ]+sub -0x30\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 sg4
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against global var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 03 8b c4 ff ff ff[ ]+add -0x3c\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF sg3
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against global var
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 03 83 d4 ff ff ff[ ]+add -0x2c\(%ebx\),%eax
+# ->R_386_TLS_TPOFF sg4
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE against local var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 2b 8b b0 ff ff ff[ ]+sub -0x50\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF32 [0xdcffffff]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE against local var
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 2b 83 b8 ff ff ff[ ]+sub -0x48\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 [0xd4ffffff]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against local var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 03 8b b4 ff ff ff[ ]+add -0x4c\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF [0x28000000]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against local var
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 03 83 bc ff ff ff[ ]+add -0x44\(%ebx\),%eax
+# ->R_386_TLS_TPOFF [0x2c000000]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE against hidden and local var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 2b 8b fc ff ff ff[ ]+sub -0x4\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF32 [0xbcffffff]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE against hidden and local var
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 2b 83 e4 ff ff ff[ ]+sub -0x1c\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 [0xb4ffffff]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against hidden and local var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 03 8b c8 ff ff ff[ ]+add -0x38\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF [0x48000000]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against hidden and local var
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 03 83 e8 ff ff ff[ ]+add -0x18\(%ebx\),%eax
+# ->R_386_TLS_TPOFF [0x4c000000]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE against hidden but not local var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 2b 8b cc ff ff ff[ ]+sub -0x34\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF32 [0x9cffffff]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE against hidden but not local var
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 2b 83 dc ff ff ff[ ]+sub -0x24\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 [0x94ffffff]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against hidden but not local var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 03 8b ec ff ff ff[ ]+add -0x14\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF [0x68000000]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against hidden but not local var
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 03 83 e0 ff ff ff[ ]+add -0x20\(%ebx\),%eax
+# ->R_386_TLS_TPOFF [0x6c000000]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# Direct access through %gs
+# @gotntpoff IE against global var
+ [0-9a-f]+: 8b 8b d8 ff ff ff[ ]+mov -0x28\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF sg5
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 65 8b 11[ ]+mov %gs:\(%ecx\),%edx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against local var
+ [0-9a-f]+: 8b 83 c0 ff ff ff[ ]+mov -0x40\(%ebx\),%eax
+# ->R_386_TLS_TPOFF [0x30000000]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 65 8b 10[ ]+mov %gs:\(%eax\),%edx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against hidden and local var
+ [0-9a-f]+: 8b 93 f0 ff ff ff[ ]+mov -0x10\(%ebx\),%edx
+# ->R_386_TLS_TPOFF [0x50000000]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 65 8b 12[ ]+mov %gs:\(%edx\),%edx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against hidden but not local var
+ [0-9a-f]+: 8b 8b f4 ff ff ff[ ]+mov -0xc\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF [0x70000000]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 65 8b 11[ ]+mov %gs:\(%ecx\),%edx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8b 5d fc[ ]+mov -0x4\(%ebp\),%ebx
+ [0-9a-f]+: c9[ ]+leave *
+ [0-9a-f]+: c3[ ]+ret *
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsdesc.rd b/binutils-2.21/ld/testsuite/ld-i386/tlsdesc.rd
new file mode 100644
index 0000000..42edd44
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsdesc.rd
@@ -0,0 +1,149 @@
+#source: tlsdesc.s
+#source: tlspic2.s
+#as: --32
+#ld: -shared -melf_i386
+#readelf: -Ssrl
+#target: i?86-*-*
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Addr +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]+\] \.rel.dyn +.*
+ +\[[ 0-9]+\] \.rel.plt +.*
+ +\[[ 0-9]+\] \.text +.*
+ +\[[ 0-9]+\] \.tdata +PROGBITS +[0-9a-f]+ [0-9a-f]+ 000060 00 WAT +0 +0 +1
+ +\[[ 0-9]+\] \.tbss +NOBITS +[0-9aa-f]+ [0-9a-f]+ 000020 00 WAT +0 +0 +1
+ +\[[ 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.*
+ +TLS +0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x0+60 0x0+80 R +0x1
+
+ Section to Segment mapping:
+ +Segment Sections...
+ +00 +.hash .dynsym .dynstr .rel.dyn .rel.plt .text *
+ +01 +.tdata .dynamic .got .got.plt *
+ +02 +.dynamic *
+ +03 +.tdata .tbss *
+
+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 20 entries:
+ Offset +Info +Type +Sym.Value +Sym. Name
+[0-9a-f ]+R_386_TLS_TPOFF32
+[0-9a-f ]+R_386_TLS_TPOFF *
+[0-9a-f ]+R_386_TLS_TPOFF32
+[0-9a-f ]+R_386_TLS_TPOFF *
+[0-9a-f ]+R_386_TLS_TPOFF *
+[0-9a-f ]+R_386_TLS_TPOFF *
+[0-9a-f ]+R_386_TLS_TPOFF32
+[0-9a-f ]+R_386_TLS_TPOFF32
+[0-9a-f ]+R_386_TLS_TPOFF *
+[0-9a-f ]+R_386_TLS_TPOFF32
+[0-9a-f ]+R_386_TLS_TPOFF *
+[0-9a-f ]+R_386_TLS_TPOFF *
+[0-9a-f ]+R_386_TLS_TPOFF *
+[0-9a-f ]+R_386_TLS_TPOFF *
+[0-9a-f ]+R_386_TLS_TPOFF32
+[0-9a-f ]+R_386_TLS_TPOFF +0+8 +sg3
+[0-9a-f ]+R_386_TLS_TPOFF32 0+c +sg4
+[0-9a-f ]+R_386_TLS_TPOFF +0+c +sg4
+[0-9a-f ]+R_386_TLS_TPOFF +0+10 +sg5
+[0-9a-f ]+R_386_TLS_TPOFF32 0+4 +sg2
+
+Relocation section '.rel.plt' at offset 0x[0-9a-f]+ contains 5 entries:
+ Offset +Info +Type +Sym.Value +Sym. Name
+[0-9a-f ]+R_386_TLS_DESC * 0+ +sg1
+[0-9a-f ]+R_386_TLS_DESC *
+[0-9a-f ]+R_386_TLS_DESC *
+[0-9a-f ]+R_386_TLS_DESC *
+[0-9a-f ]+R_386_TLS_DESC *
+
+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+1c +0 +TLS +GLOBAL +DEFAULT +7 sg8
+ +[0-9]+: 0+8 +0 +TLS +GLOBAL +DEFAULT +7 sg3
+ +[0-9]+: 0+c +0 +TLS +GLOBAL +DEFAULT +7 sg4
+ +[0-9]+: 0+10 +0 +TLS +GLOBAL +DEFAULT +7 sg5
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +7 sg1
+ +[0-9]+: [0-9a-f]+ +0 +FUNC +GLOBAL +DEFAULT +6 fn1
+ +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS __bss_start
+ +[0-9]+: 0+4 +0 +TLS +GLOBAL +DEFAULT +7 sg2
+ +[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
+
+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+60 +0 +TLS +LOCAL +DEFAULT +8 sH1
+ +[0-9]+: 0+ +0 +TLS +LOCAL +DEFAULT +7 _TLS_MODULE_BASE_
+ +[0-9]+: [0-9a-f]+ +0 +OBJECT +LOCAL +DEFAULT +ABS _DYNAMIC
+ +[0-9]+: 0+48 +0 +TLS +LOCAL +DEFAULT +7 sh3
+ +[0-9]+: 0+64 +0 +TLS +LOCAL +DEFAULT +8 sH2
+ +[0-9]+: 0+78 +0 +TLS +LOCAL +DEFAULT +8 sH7
+ +[0-9]+: 0+58 +0 +TLS +LOCAL +DEFAULT +7 sh7
+ +[0-9]+: 0+5c +0 +TLS +LOCAL +DEFAULT +7 sh8
+ +[0-9]+: 0+6c +0 +TLS +LOCAL +DEFAULT +8 sH4
+ +[0-9]+: 0+4c +0 +TLS +LOCAL +DEFAULT +7 sh4
+ +[0-9]+: 0+68 +0 +TLS +LOCAL +DEFAULT +8 sH3
+ +[0-9]+: 0+50 +0 +TLS +LOCAL +DEFAULT +7 sh5
+ +[0-9]+: 0+70 +0 +TLS +LOCAL +DEFAULT +8 sH5
+ +[0-9]+: 0+74 +0 +TLS +LOCAL +DEFAULT +8 sH6
+ +[0-9]+: 0+7c +0 +TLS +LOCAL +DEFAULT +8 sH8
+ +[0-9]+: 0+40 +0 +TLS +LOCAL +DEFAULT +7 sh1
+ +[0-9]+: [0-9a-f]+ +0 +OBJECT +LOCAL +DEFAULT +ABS _GLOBAL_OFFSET_TABLE_
+ +[0-9]+: 0+44 +0 +TLS +LOCAL +DEFAULT +7 sh2
+ +[0-9]+: 0+54 +0 +TLS +LOCAL +DEFAULT +7 sh6
+ +[0-9]+: 0+1c +0 +TLS +GLOBAL +DEFAULT +7 sg8
+ +[0-9]+: 0+8 +0 +TLS +GLOBAL +DEFAULT +7 sg3
+ +[0-9]+: 0+c +0 +TLS +GLOBAL +DEFAULT +7 sg4
+ +[0-9]+: 0+10 +0 +TLS +GLOBAL +DEFAULT +7 sg5
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +7 sg1
+ +[0-9]+: [0-9a-f]+ +0 +FUNC +GLOBAL +DEFAULT +6 fn1
+ +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS __bss_start
+ +[0-9]+: 0+4 +0 +TLS +GLOBAL +DEFAULT +7 sg2
+ +[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
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsdesc.s b/binutils-2.21/ld/testsuite/ld-i386/tlsdesc.s
new file mode 100644
index 0000000..8377f64
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsdesc.s
@@ -0,0 +1,276 @@
+ .section ".tdata", "awT", @progbits
+ .globl sg1, sg2, sg3, sg4, sg5, sg6, sg7, sg8
+ .globl sh1, sh2, sh3, sh4, sh5, sh6, sh7, sh8
+ .hidden sh1, sh2, sh3, sh4, sh5, sh6, sh7, sh8
+sg1: .long 17
+sg2: .long 18
+sg3: .long 19
+sg4: .long 20
+sg5: .long 21
+sg6: .long 22
+sg7: .long 23
+sg8: .long 24
+sl1: .long 65
+sl2: .long 66
+sl3: .long 67
+sl4: .long 68
+sl5: .long 69
+sl6: .long 70
+sl7: .long 71
+sl8: .long 72
+sh1: .long 257
+sh2: .long 258
+sh3: .long 259
+sh4: .long 260
+sh5: .long 261
+sh6: .long 262
+sh7: .long 263
+sh8: .long 264
+ .text
+ .globl fn1
+ .type fn1,@function
+fn1:
+ pushl %ebp
+ movl %esp, %ebp
+ pushl %ebx
+ pushl %eax
+ call 1f
+1: popl %ebx
+ addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
+ nop;nop;nop;nop
+
+ /* GD */
+ leal sg1@tlsdesc(%ebx), %eax
+ call *sg1@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD -> IE because variable is referenced through @gottpoff too */
+ leal sg2@tlsdesc(%ebx), %eax
+ call *sg2@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD -> IE because variable is referenced through @gotntpoff too */
+ leal sg3@tlsdesc(%ebx), %eax
+ call *sg3@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD -> IE because variable is referenced through @gottpoff and
+ @gotntpoff too */
+ leal sg4@tlsdesc(%ebx), %eax
+ call *sg4@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD against local variable */
+ leal sl1@tlsdesc(%ebx), %eax
+ call *sl1@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD -> IE against local variable referenced through @gottpoff too */
+ leal sl2@tlsdesc(%ebx), %eax
+ call *sl2@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD -> IE against local variable referenced through @gotntpoff
+ too */
+ leal sl3@tlsdesc(%ebx), %eax
+ call *sl3@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD -> IE against local variable referenced through @gottpoff and
+ @gotntpoff too */
+ leal sl4@tlsdesc(%ebx), %eax
+ call *sl4@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD against hidden and local variable */
+ leal sh1@tlsdesc(%ebx), %eax
+ call *sh1@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD -> IE against hidden and local variable referenced through
+ @gottpoff too */
+ leal sh2@tlsdesc(%ebx), %eax
+ call *sh2@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD -> IE against hidden and local variable referenced through
+ @gotntpoff too */
+ leal sh3@tlsdesc(%ebx), %eax
+ call *sh3@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD -> IE against hidden and local variable referenced through
+ @gottpoff and @gotntpoff too */
+ leal sh4@tlsdesc(%ebx), %eax
+ call *sh4@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD against hidden but not local variable */
+ leal sH1@tlsdesc(%ebx), %eax
+ call *sH1@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD -> IE against hidden but not local variable referenced through
+ @gottpoff too */
+ leal sH2@tlsdesc(%ebx), %eax
+ call *sH2@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD -> IE against hidden but not local variable referenced through
+ @gotntpoff too */
+ leal sH3@tlsdesc(%ebx), %eax
+ call *sH3@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD -> IE against hidden but not local variable referenced through
+ @gottpoff and @gotntpoff too */
+ leal sH4@tlsdesc(%ebx), %eax
+ call *sH4@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* LD */
+ leal _TLS_MODULE_BASE_@tlsdesc(%ebx), %eax
+ call *_TLS_MODULE_BASE_@tlscall(%eax)
+ nop;nop
+ leal sl1@dtpoff(%eax), %edx
+ nop;nop
+ leal 2+sl2@dtpoff(%eax), %ecx
+ nop;nop;nop;nop
+
+ /* LD against hidden and local variables */
+ leal sh1@dtpoff(%eax), %edx
+ nop;nop
+ leal sh2@dtpoff+3(%eax), %ecx
+ nop;nop;nop;nop
+
+ /* LD against hidden but not local variables */
+ leal sH1@dtpoff(%eax), %edx
+ nop;nop
+ leal sH2@dtpoff+1(%eax), %ecx
+ nop;nop
+
+ /* @gottpoff IE against global var */
+ movl %gs:0, %ecx
+ nop;nop
+ subl sg2@gottpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gottpoff IE against global var */
+ movl %gs:0, %eax
+ nop;nop
+ subl sg4@gottpoff(%ebx), %eax
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against global var */
+ movl %gs:0, %ecx
+ nop;nop
+ addl sg3@gotntpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against global var */
+ movl %gs:0, %eax
+ nop;nop
+ addl sg4@gotntpoff(%ebx), %eax
+ nop;nop;nop;nop
+
+ /* @gottpoff IE against local var */
+ movl %gs:0, %ecx
+ nop;nop
+ subl sl2@gottpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gottpoff IE against local var */
+ movl %gs:0, %eax
+ nop;nop
+ subl sl4@gottpoff(%ebx), %eax
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against local var */
+ movl %gs:0, %ecx
+ nop;nop
+ addl sl3@gotntpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against local var */
+ movl %gs:0, %eax
+ nop;nop
+ addl sl4@gotntpoff(%ebx), %eax
+ nop;nop;nop;nop
+
+ /* @gottpoff IE against hidden and local var */
+ movl %gs:0, %ecx
+ nop;nop
+ subl sh2@gottpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gottpoff IE against hidden and local var */
+ movl %gs:0, %eax
+ nop;nop
+ subl sh4@gottpoff(%ebx), %eax
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against hidden and local var */
+ movl %gs:0, %ecx
+ nop;nop
+ addl sh3@gotntpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against hidden and local var */
+ movl %gs:0, %eax
+ nop;nop
+ addl sh4@gotntpoff(%ebx), %eax
+ nop;nop;nop;nop
+
+ /* @gottpoff IE against hidden but not local var */
+ movl %gs:0, %ecx
+ nop;nop
+ subl sH2@gottpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gottpoff IE against hidden but not local var */
+ movl %gs:0, %eax
+ nop;nop
+ subl sH4@gottpoff(%ebx), %eax
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against hidden but not local var */
+ movl %gs:0, %ecx
+ nop;nop
+ addl sH3@gotntpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against hidden but not local var */
+ movl %gs:0, %eax
+ nop;nop
+ addl sH4@gotntpoff(%ebx), %eax
+ nop;nop;nop;nop
+
+ /* Direct access through %gs */
+
+ /* @gotntpoff IE against global var */
+ movl sg5@gotntpoff(%ebx), %ecx
+ nop;nop
+ movl %gs:(%ecx), %edx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against local var */
+ movl sl5@gotntpoff(%ebx), %eax
+ nop;nop
+ movl %gs:(%eax), %edx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against hidden and local var */
+ movl sh5@gotntpoff(%ebx), %edx
+ nop;nop
+ movl %gs:(%edx), %edx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against hidden but not local var */
+ movl sH5@gotntpoff(%ebx), %ecx
+ nop;nop
+ movl %gs:(%ecx), %edx
+ nop;nop;nop;nop
+
+ movl -4(%ebp), %ebx
+ leave
+ ret
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsdesc.sd b/binutils-2.21/ld/testsuite/ld-i386/tlsdesc.sd
new file mode 100644
index 0000000..656c409
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsdesc.sd
@@ -0,0 +1,20 @@
+#source: tlsdesc.s
+#source: tlspic2.s
+#as: --32
+#ld: -shared -melf_i386
+#objdump: -s -j.got -j.got.plt
+#target: i?86-*-*
+
+.*: file format elf32-i386
+
+Contents of section \.got:
+ [0-9a-f]+ dcffffff 28000000 d4ffffff 2c000000 .*
+ [0-9a-f]+ 30000000 00000000 48000000 9cffffff .*
+ [0-9a-f]+ 00000000 00000000 00000000 94ffffff .*
+ [0-9a-f]+ 6c000000 b4ffffff 4c000000 68000000 .*
+ [0-9a-f]+ 50000000 70000000 00000000 bcffffff .*
+Contents of section \.got\.plt:
+ [0-9a-f]+ b0150000 00000000 00000000 00000000 .*
+ [0-9a-f]+ 20000000 00000000 60000000 00000000 .*
+ [0-9a-f]+ 00000000 00000000 00000000 00000000 .*
+ [0-9a-f]+ 40000000 +.*
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsdesc.td b/binutils-2.21/ld/testsuite/ld-i386/tlsdesc.td
new file mode 100644
index 0000000..f3612b3
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsdesc.td
@@ -0,0 +1,16 @@
+#source: tlsdesc.s
+#source: tlspic2.s
+#as: --32
+#ld: -shared -melf_i386
+#objdump: -sj.tdata
+#target: i?86-*-*
+
+.*: file format elf32-i386
+
+Contents of section \.tdata:
+ [0-9a-f]+ 11000000 12000000 13000000 14000000 .*
+ [0-9a-f]+ 15000000 16000000 17000000 18000000 .*
+ [0-9a-f]+ 41000000 42000000 43000000 44000000 .*
+ [0-9a-f]+ 45000000 46000000 47000000 48000000 .*
+ [0-9a-f]+ 01010000 02010000 03010000 04010000 .*
+ [0-9a-f]+ 05010000 06010000 07010000 08010000 .*
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsg.s b/binutils-2.21/ld/testsuite/ld-i386/tlsg.s
new file mode 100644
index 0000000..b8e1a5d
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/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
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsg.sd b/binutils-2.21/ld/testsuite/ld-i386/tlsg.sd
new file mode 100644
index 0000000..d794762
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsg.sd
@@ -0,0 +1,10 @@
+#source: tlsg.s
+#as: --32
+#ld: -melf_i386
+#objdump: -sj.debug_foobar
+#target: i?86-*-*
+
+.*: +file format elf32-i386
+
+Contents of section .debug_foobar:
+ 0+ 18000000 +.*
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsgd1.dd b/binutils-2.21/ld/testsuite/ld-i386/tlsgd1.dd
new file mode 100644
index 0000000..9a33132
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsgd1.dd
@@ -0,0 +1,16 @@
+#source: tlsgd1.s
+#as: --32
+#ld: -melf_i386 tmpdir/tlsgd1
+#objdump: -drw
+#target: i?86-*-linux*
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: 65 a1 00 00 00 00 mov %gs:0x0,%eax
+[ ]*[a-f0-9]+: 81 e8 04 00 00 00 sub \$0x4,%eax
+[ ]*[a-f0-9]+: 65 a1 00 00 00 00 mov %gs:0x0,%eax
+[ ]*[a-f0-9]+: 81 e8 04 00 00 00 sub \$0x4,%eax
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsgd1.s b/binutils-2.21/ld/testsuite/ld-i386/tlsgd1.s
new file mode 100644
index 0000000..552ca09
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsgd1.s
@@ -0,0 +1,15 @@
+ .text
+ .globl _start
+_start:
+ leal foo@TLSGD(,%ebx,1), %eax
+ call ___tls_get_addr
+ leal foo@TLSGD(%ebx), %eax
+ call ___tls_get_addr
+ nop
+ .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-i386/tlsgd2.d b/binutils-2.21/ld/testsuite/ld-i386/tlsgd2.d
new file mode 100644
index 0000000..136a8fa
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsgd2.d
@@ -0,0 +1,4 @@
+#name: TLS GD->LE transition check
+#as: --32
+#ld: -melf_i386
+#error: .*TLS transition from R_386_TLS_GD to R_386_TLS_LE_32 against `foo'.*failed.*
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsgd2.s b/binutils-2.21/ld/testsuite/ld-i386/tlsgd2.s
new file mode 100644
index 0000000..29d9339
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsgd2.s
@@ -0,0 +1,11 @@
+ .text
+ .globl _start
+_start:
+ leal foo@TLSGD(%ebx), %eax
+ 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-i386/tlsgdesc.dd b/binutils-2.21/ld/testsuite/ld-i386/tlsgdesc.dd
new file mode 100644
index 0000000..25659de
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsgdesc.dd
@@ -0,0 +1,156 @@
+#source: tlsgdesc.s
+#as: --32
+#ld: -shared -melf_i386
+#objdump: -drj.text
+#target: i?86-*-*
+
+.*: +file format elf32-i386
+
+Disassembly of section .text:
+
+[0-9a-f]+ <fc1>:
+ [0-9a-f]+: 55[ ]+push %ebp
+ [0-9a-f]+: 89 e5[ ]+mov %esp,%ebp
+ [0-9a-f]+: 53[ ]+push %ebx
+ [0-9a-f]+: 50[ ]+push %eax
+ [0-9a-f]+: e8 00 00 00 00[ ]+call [0-9a-f]+ <.*>
+ [0-9a-f]+: 5b[ ]+pop %ebx
+ [0-9a-f]+: 81 c3 be 11 00 00[ ]+add \$0x[0-9a-f]+,%ebx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE against global var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 2b 8b e0 ff ff ff[ ]+sub -0x20\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF32 sG3
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against global var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 03 8b f0 ff ff ff[ ]+add -0x10\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF sG4
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# GD
+ [0-9a-f]+: 8d 04 1d f8 ff ff ff[ ]+lea -0x8\(,%ebx,1\),%eax
+# ->R_386_TLS_DTPMOD32 sG1
+ [0-9a-f]+: e8 a9 ff ff ff[ ]+call [0-9a-f]+ <___tls_get_addr@plt>
+# ->R_386_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]+: 8d 83 18 00 00 00[ ]+lea 0x18\(%ebx\),%eax
+# ->R_386_TLS_DESC sG1
+ [0-9a-f]+: ff 10[ ]+call \*\(%eax\)
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8d 83 10 00 00 00[ ]+lea 0x10\(%ebx\),%eax
+# ->R_386_TLS_DESC sG2
+ [0-9a-f]+: ff 10[ ]+call \*\(%eax\)
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8d 04 1d e8 ff ff ff[ ]+lea -0x18\(,%ebx,1\),%eax
+# ->R_386_TLS_DTPMOD32 sG2
+ [0-9a-f]+: e8 81 ff ff ff[ ]+call [0-9a-f]+ <___tls_get_addr@plt>
+# ->R_386_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 because variable is referenced through @gottpoff too
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 2b 83 e0 ff ff ff[ ]+sub -0x20\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 sG3
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8b 83 e0 ff ff ff[ ]+mov -0x20\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 sG3
+ [0-9a-f]+: f7 d8[ ]+neg %eax
+ [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 @gotntpoff too
+ [0-9a-f]+: 8b 83 f0 ff ff ff[ ]+mov -0x10\(%ebx\),%eax
+# ->R_386_TLS_TPOFF 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]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 03 83 f0 ff ff ff[ ]+add -0x10\(%ebx\),%eax
+# ->R_386_TLS_TPOFF sG4
+ [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 @gotntpoff too
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 03 83 e4 ff ff ff[ ]+add -0x1c\(%ebx\),%eax
+# ->R_386_TLS_TPOFF sG5
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8b 83 e4 ff ff ff[ ]+mov -0x1c\(%ebx\),%eax
+# ->R_386_TLS_TPOFF 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 because variable is referenced through @gottpoff too
+ [0-9a-f]+: 8b 83 f4 ff ff ff[ ]+mov -0xc\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 sG6
+ [0-9a-f]+: f7 d8[ ]+neg %eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 2b 83 f4 ff ff ff[ ]+sub -0xc\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 sG6
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against global var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 03 8b e4 ff ff ff[ ]+add -0x1c\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF sG5
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE against global var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 2b 8b f4 ff ff ff[ ]+sub -0xc\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF32 sG6
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8b 5d fc[ ]+mov -0x4\(%ebp\),%ebx
+ [0-9a-f]+: c9[ ]+leave *
+ [0-9a-f]+: c3[ ]+ret *
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsgdesc.rd b/binutils-2.21/ld/testsuite/ld-i386/tlsgdesc.rd
new file mode 100644
index 0000000..3a224a2
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsgdesc.rd
@@ -0,0 +1,103 @@
+#source: tlsgdesc.s
+#as: --32
+#ld: -shared -melf_i386
+#readelf: -Ssrl
+#target: i?86-*-*
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Addr +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]+\] \.rel.dyn +.*
+ +\[[ 0-9]+\] \.rel.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 .rel.dyn .rel.plt .plt .text *
+ +01 +.dynamic .got .got.plt *
+ +02 +.dynamic *
+
+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 8 entries:
+ Offset +Info +Type +Sym.Value +Sym. Name
+[0-9a-f ]+R_386_TLS_TPOFF32 0+ +sG3
+[0-9a-f ]+R_386_TLS_TPOFF +0+ +sG5
+[0-9a-f ]+R_386_TLS_DTPMOD3 0+ +sG2
+[0-9a-f ]+R_386_TLS_DTPOFF3 0+ +sG2
+[0-9a-f ]+R_386_TLS_TPOFF +0+ +sG4
+[0-9a-f ]+R_386_TLS_TPOFF32 0+ +sG6
+[0-9a-f ]+R_386_TLS_DTPMOD3 0+ +sG1
+[0-9a-f ]+R_386_TLS_DTPOFF3 0+ +sG1
+
+Relocation section '.rel.plt' at offset 0x[0-9a-f]+ contains 3 entries:
+ Offset +Info +Type +Sym.Value +Sym. Name
+[0-9a-f ]+R_386_JUMP_SLOT +0+ +___tls_get_addr
+[0-9a-f ]+R_386_TLS_DESC +0+ +sG1
+[0-9a-f ]+R_386_TLS_DESC +0+ +sG2
+
+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 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-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
+ +[0-9]+: 0+ +0 +NOTYPE +GLOBAL +DEFAULT +UND ___tls_get_addr
+
+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-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
+ +[0-9]+: 0+ +0 +NOTYPE +GLOBAL +DEFAULT +UND ___tls_get_addr
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsgdesc.s b/binutils-2.21/ld/testsuite/ld-i386/tlsgdesc.s
new file mode 100644
index 0000000..9502a10
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsgdesc.s
@@ -0,0 +1,100 @@
+ .text
+ .globl fc1
+ .type fc1,@function
+fc1:
+ pushl %ebp
+ movl %esp, %ebp
+ pushl %ebx
+ pushl %eax
+ call 1f
+1: popl %ebx
+ addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
+ nop;nop;nop;nop
+
+ /* @gottpoff IE against global var */
+ movl %gs:0, %ecx
+ nop;nop
+ subl sG3@gottpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against global var */
+ movl %gs:0, %ecx
+ nop;nop
+ addl sG4@gotntpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* GD */
+ leal sG1@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD */
+ leal sG1@tlsdesc(%ebx), %eax
+ call *sG1@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD */
+ leal sG2@tlsdesc(%ebx), %eax
+ call *sG2@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD */
+ leal sG2@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE tpoff */
+ leal sG3@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE tpoff */
+ leal sG3@tlsdesc(%ebx), %eax
+ call *sG3@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD -> IE ntpoff */
+ leal sG4@tlsdesc(%ebx), %eax
+ call *sG4@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD -> IE ntpoff */
+ leal sG4@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE ntpoff */
+ leal sG5@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE ntpoff */
+ leal sG5@tlsdesc(%ebx), %eax
+ call *sG5@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD -> IE tpoff */
+ leal sG6@tlsdesc(%ebx), %eax
+ call *sG6@tlscall(%eax)
+ nop;nop;nop;nop
+
+ /* GD -> IE tpoff */
+ leal sG6@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against global var */
+ movl %gs:0, %ecx
+ nop;nop
+ addl sG5@gotntpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gottpoff IE against global var */
+ movl %gs:0, %ecx
+ nop;nop
+ subl sG6@gottpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ movl -4(%ebp), %ebx
+ leave
+ ret
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsie1.dd b/binutils-2.21/ld/testsuite/ld-i386/tlsie1.dd
new file mode 100644
index 0000000..2cebc70
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsie1.dd
@@ -0,0 +1,18 @@
+#source: tlsie1.s
+#as: --32
+#ld: -melf_i386 tmpdir/tlsld1
+#objdump: -drw
+#target: i?86-*-linux*
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: 81 c1 fc ff ff ff add \$0xfffffffc,%ecx
+[ ]*[a-f0-9]+: 81 c1 fc ff ff ff add \$0xfffffffc,%ecx
+[ ]*[a-f0-9]+: c7 c0 fc ff ff ff mov \$0xfffffffc,%eax
+[ ]*[a-f0-9]+: c7 c1 fc ff ff ff mov \$0xfffffffc,%ecx
+[ ]*[a-f0-9]+: b8 fc ff ff ff mov \$0xfffffffc,%eax
+[ ]*[a-f0-9]+: c7 c1 fc ff ff ff mov \$0xfffffffc,%ecx
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsie1.s b/binutils-2.21/ld/testsuite/ld-i386/tlsie1.s
new file mode 100644
index 0000000..d4ad569
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsie1.s
@@ -0,0 +1,16 @@
+ .text
+ .globl _start
+_start:
+ addl foo@gotntpoff(%ebx), %ecx
+ addl foo@indntpoff, %ecx
+ movl foo@gotntpoff(%ebx), %eax
+ movl foo@gotntpoff(%ebx), %ecx
+ movl foo@indntpoff, %eax
+ movl foo@indntpoff, %ecx
+ .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-i386/tlsie2.d b/binutils-2.21/ld/testsuite/ld-i386/tlsie2.d
new file mode 100644
index 0000000..ebb85fd
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsie2.d
@@ -0,0 +1,4 @@
+#name: TLS IE->LE transition check (R_386_TLS_GOTIE with %eax)
+#as: --32
+#ld: -melf_i386
+#error: .*TLS transition from R_386_TLS_GOTIE to R_386_TLS_LE_32 against `foo'.*failed.*
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsie2.s b/binutils-2.21/ld/testsuite/ld-i386/tlsie2.s
new file mode 100644
index 0000000..72df617
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsie2.s
@@ -0,0 +1,12 @@
+ .text
+ .globl _start
+_start:
+ leal foo@gotntpoff(%ebx), %eax
+ movl (%eax), %eax
+ .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-i386/tlsie3.d b/binutils-2.21/ld/testsuite/ld-i386/tlsie3.d
new file mode 100644
index 0000000..d993f30
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsie3.d
@@ -0,0 +1,4 @@
+#name: TLS IE->LE transition check (R_386_TLS_GOTIE)
+#as: --32
+#ld: -melf_i386
+#error: .*TLS transition from R_386_TLS_GOTIE to R_386_TLS_LE_32 against `foo'.*failed.*
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsie3.s b/binutils-2.21/ld/testsuite/ld-i386/tlsie3.s
new file mode 100644
index 0000000..865156d
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsie3.s
@@ -0,0 +1,12 @@
+ .text
+ .globl _start
+_start:
+ leal foo@gotntpoff(%ebx), %ecx
+ movl (%ecx), %ecx
+ .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-i386/tlsie4.d b/binutils-2.21/ld/testsuite/ld-i386/tlsie4.d
new file mode 100644
index 0000000..3ca8fdd
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsie4.d
@@ -0,0 +1,4 @@
+#name: TLS IE->LE transition check (R_386_TLS_IE with %eax)
+#as: --32
+#ld: -melf_i386
+#error: .*TLS transition from R_386_TLS_IE to R_386_TLS_LE_32 against `foo'.*failed.*
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsie4.s b/binutils-2.21/ld/testsuite/ld-i386/tlsie4.s
new file mode 100644
index 0000000..3469f29
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsie4.s
@@ -0,0 +1,12 @@
+ .text
+ .globl _start
+_start:
+ leal foo@indntpoff(%ebx), %eax
+ movl (%eax), %eax
+ .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-i386/tlsie5.d b/binutils-2.21/ld/testsuite/ld-i386/tlsie5.d
new file mode 100644
index 0000000..3febeb1
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsie5.d
@@ -0,0 +1,4 @@
+#name: TLS IE->LE transition check (R_386_TLS_IE)
+#as: --32
+#ld: -melf_i386
+#error: .*TLS transition from R_386_TLS_IE to R_386_TLS_LE_32 against `foo'.*failed.*
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsie5.s b/binutils-2.21/ld/testsuite/ld-i386/tlsie5.s
new file mode 100644
index 0000000..affee31
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsie5.s
@@ -0,0 +1,12 @@
+ .text
+ .globl _start
+_start:
+ leal foo@indntpoff, %ecx
+ movl (%ecx), %ecx
+ .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-i386/tlsindntpoff.dd b/binutils-2.21/ld/testsuite/ld-i386/tlsindntpoff.dd
new file mode 100644
index 0000000..db20de1
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsindntpoff.dd
@@ -0,0 +1,16 @@
+#source: tlsindntpoff.s
+#as: --32
+#ld: -melf_i386
+#objdump: -drj.text
+#target: i?86-*-*
+
+.*: +file format elf32-i386
+
+Disassembly of section .text:
+
+[0-9a-f]+000 <_start>:
+ [0-9a-f]+000: 39 d8[ ]+cmp %ebx,%eax
+ [0-9a-f]+002: 73 08[ ]+jae [0-9a-f]+00c <_start\+0xc>
+ [0-9a-f]+004: b8 fc ff ff ff[ ]+mov \$0xfffffffc,%eax
+ [0-9a-f]+009: 65 8b 00[ ]+mov %gs:\(%eax\),%eax
+ [0-9a-f]+00c: c3[ ]+ret *
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsindntpoff.s b/binutils-2.21/ld/testsuite/ld-i386/tlsindntpoff.s
new file mode 100644
index 0000000..4bc93f6
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsindntpoff.s
@@ -0,0 +1,19 @@
+ /* Force .got aligned to 4K, so it very likely gets at 0x804a100
+ (0x60 bytes .tdata and 0xa0 bytes .dynamic) */
+ .data
+ .balign 4096
+ .section ".tdata", "awT", @progbits
+ .globl foo
+foo: .long 27
+
+ /* Force .text aligned to 4K, so it very likely gets at 0x8049000. */
+ .text
+ .balign 4096
+ .globl _start
+ .type _start,@function
+_start:
+ cmp %ebx, %eax
+ jae 1f
+ movl foo@indntpoff, %eax
+ movl %gs:(%eax), %eax
+1: ret
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsld1.dd b/binutils-2.21/ld/testsuite/ld-i386/tlsld1.dd
new file mode 100644
index 0000000..52ab10c
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsld1.dd
@@ -0,0 +1,15 @@
+#source: tlsld1.s
+#as: --32
+#ld: -melf_i386 tmpdir/tlsld1
+#objdump: -drw
+#target: i?86-*-linux*
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: 65 a1 00 00 00 00 mov %gs:0x0,%eax
+[ ]*[a-f0-9]+: 90 nop
+[ ]*[a-f0-9]+: 8d 74 26 00 lea 0x0\(%esi,%eiz,1\),%esi
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsld1.s b/binutils-2.21/ld/testsuite/ld-i386/tlsld1.s
new file mode 100644
index 0000000..5d57e35
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsld1.s
@@ -0,0 +1,12 @@
+ .text
+ .globl _start
+_start:
+ leal foo@TLSLDM(%ebx), %eax
+ 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-i386/tlslib.s b/binutils-2.21/ld/testsuite/ld-i386/tlslib.s
new file mode 100644
index 0000000..22e1f8d
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlslib.s
@@ -0,0 +1,17 @@
+ .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:
+ ret
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsnopic.dd b/binutils-2.21/ld/testsuite/ld-i386/tlsnopic.dd
new file mode 100644
index 0000000..a0a8853
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsnopic.dd
@@ -0,0 +1,161 @@
+#source: tlsnopic1.s
+#source: tlsnopic2.s
+#as: --32
+#ld: -shared -melf_i386
+#objdump: -drj.text
+#target: i?86-*-*
+
+.*: +file format elf32-i386
+
+Disassembly of section .text:
+
+0+1000 <fn3>:
+ 1000: 55[ ]+push %ebp
+ 1001: 89 e5[ ]+mov %esp,%ebp
+# @indntpoff IE against global var
+ 1003: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 1009: 90[ ]+nop *
+ 100a: 90[ ]+nop *
+ 100b: 03 05 7c 21 00 00[ ]+add 0x217c,%eax
+# ->R_386_TLS_TPOFF sg1
+ 1011: 90[ ]+nop *
+ 1012: 90[ ]+nop *
+ 1013: 90[ ]+nop *
+ 1014: 90[ ]+nop *
+# @indntpoff direct %gs access IE against global var
+ 1015: 8b 15 80 21 00 00[ ]+mov 0x2180,%edx
+# ->R_386_TLS_TPOFF sg2
+ 101b: 90[ ]+nop *
+ 101c: 90[ ]+nop *
+ 101d: 65 8b 02[ ]+mov %gs:\(%edx\),%eax
+ 1020: 90[ ]+nop *
+ 1021: 90[ ]+nop *
+ 1022: 90[ ]+nop *
+ 1023: 90[ ]+nop *
+# @indntpoff IE against hidden var
+ 1024: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 102a: 90[ ]+nop *
+ 102b: 90[ ]+nop *
+ 102c: 03 05 84 21 00 00[ ]+add 0x2184,%eax
+# ->R_386_TLS_TPOFF [0x14000000]
+ 1032: 90[ ]+nop *
+ 1033: 90[ ]+nop *
+ 1034: 90[ ]+nop *
+ 1035: 90[ ]+nop *
+# @indntpoff direct %gs access IE against hidden var
+ 1036: 8b 15 88 21 00 00[ ]+mov 0x2188,%edx
+# ->R_386_TLS_TPOFF [0x18000000]
+ 103c: 90[ ]+nop *
+ 103d: 90[ ]+nop *
+ 103e: 65 8b 02[ ]+mov %gs:\(%edx\),%eax
+ 1041: 90[ ]+nop *
+ 1042: 90[ ]+nop *
+ 1043: 90[ ]+nop *
+ 1044: 90[ ]+nop *
+# @indntpoff IE against local var
+ 1045: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 104b: 90[ ]+nop *
+ 104c: 90[ ]+nop *
+ 104d: 03 05 74 21 00 00[ ]+add 0x2174,%eax
+# ->R_386_TLS_TPOFF [0x00000000]
+ 1053: 90[ ]+nop *
+ 1054: 90[ ]+nop *
+ 1055: 90[ ]+nop *
+ 1056: 90[ ]+nop *
+# @indntpoff direct %gs access IE against local var
+ 1057: 8b 15 78 21 00 00[ ]+mov 0x2178,%edx
+# ->R_386_TLS_TPOFF [0x04000000]
+ 105d: 90[ ]+nop *
+ 105e: 90[ ]+nop *
+ 105f: 65 8b 02[ ]+mov %gs:\(%edx\),%eax
+ 1062: 90[ ]+nop *
+ 1063: 90[ ]+nop *
+ 1064: 90[ ]+nop *
+ 1065: 90[ ]+nop *
+# LE @tpoff, global var
+ 1066: ba fd ff ff ff[ ]+mov \$0xfffffffd,%edx
+# R_386_TLS_TPOFF32 sg3
+ 106b: 90[ ]+nop *
+ 106c: 90[ ]+nop *
+ 106d: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 1073: 90[ ]+nop *
+ 1074: 90[ ]+nop *
+ 1075: 29 d0[ ]+sub %edx,%eax
+ 1077: 90[ ]+nop *
+ 1078: 90[ ]+nop *
+ 1079: 90[ ]+nop *
+ 107a: 90[ ]+nop *
+# LE @tpoff, local var
+ 107b: b8 f7 ff ff ff[ ]+mov \$0xfffffff7,%eax
+# R_386_TLS_TPOFF32
+ 1080: 90[ ]+nop *
+ 1081: 90[ ]+nop *
+ 1082: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
+ 1089: 90[ ]+nop *
+ 108a: 90[ ]+nop *
+ 108b: 29 c2[ ]+sub %eax,%edx
+ 108d: 90[ ]+nop *
+ 108e: 90[ ]+nop *
+ 108f: 90[ ]+nop *
+ 1090: 90[ ]+nop *
+# LE @ntpoff, global var
+ 1091: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ 1097: 90[ ]+nop *
+ 1098: 90[ ]+nop *
+ 1099: 8d 90 02 00 00 00[ ]+lea 0x2\(%eax\),%edx
+# R_386_TLS_TPOFF sg4
+ 109f: 90[ ]+nop *
+ 10a0: 90[ ]+nop *
+ 10a1: 90[ ]+nop *
+ 10a2: 90[ ]+nop *
+# LE @ntpoff, hidden var, non-canonical sequence
+ 10a3: b8 1c 00 00 00[ ]+mov \$0x1c,%eax
+# R_386_TLS_TPOFF
+ 10a8: 90[ ]+nop *
+ 10a9: 90[ ]+nop *
+ 10aa: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
+ 10b1: 90[ ]+nop *
+ 10b2: 90[ ]+nop *
+ 10b3: 01 c2[ ]+add %eax,%edx
+ 10b5: 90[ ]+nop *
+ 10b6: 90[ ]+nop *
+ 10b7: 90[ ]+nop *
+ 10b8: 90[ ]+nop *
+# LE @ntpoff, local var, non-canonical sequence
+ 10b9: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
+ 10c0: 90[ ]+nop *
+ 10c1: 90[ ]+nop *
+ 10c2: 81 c2 0d 00 00 00[ ]+add \$0xd,%edx
+# R_386_TLS_TPOFF
+ 10c8: 90[ ]+nop *
+ 10c9: 90[ ]+nop *
+ 10ca: 90[ ]+nop *
+ 10cb: 90[ ]+nop *
+# Direct %gs access
+# LE @ntpoff, global var
+ 10cc: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+# R_386_TLS_TPOFF sg5
+ 10d2: 90[ ]+nop *
+ 10d3: 90[ ]+nop *
+ 10d4: 90[ ]+nop *
+ 10d5: 90[ ]+nop *
+# LE @ntpoff, local var
+ 10d6: 65 8b 15 13 00 00 00 mov %gs:0x13,%edx
+# R_386_TLS_TPOFF
+ 10dd: 90[ ]+nop *
+ 10de: 90[ ]+nop *
+ 10df: 90[ ]+nop *
+ 10e0: 90[ ]+nop *
+# LE @ntpoff, hidden var
+ 10e1: 65 8b 15 21 00 00 00 mov %gs:0x21,%edx
+# R_386_TLS_TPOFF
+ 10e8: 90[ ]+nop *
+ 10e9: 90[ ]+nop *
+ 10ea: 90[ ]+nop *
+ 10eb: 90[ ]+nop *
+ 10ec: 8b 5d fc[ ]+mov -0x4\(%ebp\),%ebx
+ 10ef: c9[ ]+leave *
+ 10f0: c3[ ]+ret *
+ 10f1: 90[ ]+nop *
+ 10f2: 90[ ]+nop *
+ 10f3: 90[ ]+nop *
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsnopic.rd b/binutils-2.21/ld/testsuite/ld-i386/tlsnopic.rd
new file mode 100644
index 0000000..2590a9f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsnopic.rd
@@ -0,0 +1,116 @@
+#source: tlsnopic1.s
+#source: tlsnopic2.s
+#as: --32
+#ld: -shared -melf_i386
+#readelf: -Ssrl
+#target: i?86-*-*
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Addr +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]+\] \.rel.dyn +.*
+ +\[[ 0-9]+\] \.text +PROGBITS +0+1000 .*
+ +\[[ 0-9]+\] \.tbss +NOBITS +[0-9a-f]+ [0-9a-f]+ 000024 00 WAT +0 +0 +1
+ +\[[ 0-9]+\] \.dynamic +DYNAMIC +0+20f4 .*
+ +\[[ 0-9]+\] \.got +PROGBITS +0+2174 .*
+ +\[[ 0-9]+\] \.got.plt +PROGBITS +0+218c .*
+ +\[[ 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.*
+ +LOAD.*
+ +DYNAMIC.*
+ +TLS +0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x0+ 0x0+24 R +0x1
+
+ Section to Segment mapping:
+ +Segment Sections...
+ +00 +.hash .dynsym .dynstr .rel.dyn .text *
+ +01 +.dynamic .got .got.plt *
+ +02 +.dynamic *
+ +03 +.tbss *
+
+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 20 entries:
+ Offset +Info +Type +Sym.Value +Sym. Name
+[0-9a-f ]+R_386_RELATIVE +
+[0-9a-f ]+R_386_RELATIVE +
+[0-9a-f ]+R_386_RELATIVE +
+[0-9a-f ]+R_386_RELATIVE +
+[0-9a-f ]+R_386_RELATIVE +
+[0-9a-f ]+R_386_RELATIVE +
+[0-9a-f ]+R_386_TLS_TPOFF32 0+ +sg3
+[0-9a-f ]+R_386_TLS_TPOFF32
+[0-9a-f ]+R_386_TLS_TPOFF +
+[0-9a-f ]+R_386_TLS_TPOFF +
+[0-9a-f ]+R_386_TLS_TPOFF +
+[0-9a-f ]+R_386_TLS_TPOFF +
+[0-9a-f ]+R_386_TLS_TPOFF +
+[0-9a-f ]+R_386_TLS_TPOFF +
+[0-9a-f ]+R_386_TLS_TPOFF +
+[0-9a-f ]+R_386_TLS_TPOFF +
+[0-9a-f ]+R_386_TLS_TPOFF +0+ +sg4
+[0-9a-f ]+R_386_TLS_TPOFF +0+ +sg5
+[0-9a-f ]+R_386_TLS_TPOFF +0+ +sg1
+[0-9a-f ]+R_386_TLS_TPOFF +0+ +sg2
+
+
+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 sg3
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sg4
+ +[0-9]+: 0+1000 +0 +FUNC +GLOBAL +DEFAULT +5 fn3
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sg5
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sg1
+ +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS __bss_start
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sg2
+ +[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+00 +0 +TLS +LOCAL +DEFAULT +6 bl1
+ +[0-9]+: 0+04 +0 +TLS +LOCAL +DEFAULT +6 bl2
+ +[0-9]+: 0+08 +0 +TLS +LOCAL +DEFAULT +6 bl3
+ +[0-9]+: 0+0c +0 +TLS +LOCAL +DEFAULT +6 bl4
+ +[0-9]+: 0+10 +0 +TLS +LOCAL +DEFAULT +6 bl5
+ +[0-9]+: [0-9a-f]+ +0 +OBJECT +LOCAL +DEFAULT +ABS _DYNAMIC
+ +[0-9]+: 0+1c +0 +TLS +LOCAL +DEFAULT +6 sh3
+ +[0-9]+: 0+20 +0 +TLS +LOCAL +DEFAULT +6 sh4
+ +[0-9]+: 0+14 +0 +TLS +LOCAL +DEFAULT +6 sh1
+ +[0-9]+: 0+218c +0 +OBJECT +LOCAL +DEFAULT +ABS _GLOBAL_OFFSET_TABLE_
+ +[0-9]+: 0+18 +0 +TLS +LOCAL +DEFAULT +6 sh2
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sg3
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sg4
+ +[0-9]+: 0+1000 +0 +FUNC +GLOBAL +DEFAULT +5 fn3
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sg5
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sg1
+ +[0-9]+: [0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +ABS __bss_start
+ +[0-9]+: 0+ +0 +TLS +GLOBAL +DEFAULT +UND sg2
+ +[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-i386/tlsnopic.sd b/binutils-2.21/ld/testsuite/ld-i386/tlsnopic.sd
new file mode 100644
index 0000000..fdfaacf
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsnopic.sd
@@ -0,0 +1,12 @@
+#source: tlsnopic1.s
+#source: tlsnopic2.s
+#as: --32
+#ld: -shared -melf_i386
+#objdump: -sj.got
+#target: i?86-*-*
+
+.*: file format elf32-i386
+
+Contents of section \.got:
+ 2174 00000000 04000000 00000000 00000000 .*
+ 2184 14000000 18000000 +.*
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsnopic1.s b/binutils-2.21/ld/testsuite/ld-i386/tlsnopic1.s
new file mode 100644
index 0000000..80a28bf
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsnopic1.s
@@ -0,0 +1,107 @@
+ .section ".data.rel.ro", "aw", @progbits
+ /* Align, so that .got is likely at address 0x2080. */
+ .balign 4096
+ .section ".tbss", "awT", @nobits
+bl1: .space 4
+bl2: .space 4
+bl3: .space 4
+bl4: .space 4
+bl5: .space 4
+ .text
+ /* Align, so that fn3 is likely at address 0x1000. */
+ .balign 4096
+ .globl fn3
+ .type fn3,@function
+fn3:
+ pushl %ebp
+ movl %esp, %ebp
+
+ /* @indntpoff IE against global var */
+ movl %gs:0, %eax
+ nop;nop
+ addl sg1@indntpoff, %eax
+ nop;nop;nop;nop
+
+ /* @indntpoff direct %gs access IE against global var */
+ movl sg2@indntpoff, %edx
+ nop;nop
+ movl %gs:(%edx), %eax
+ nop;nop;nop;nop
+
+ /* @indntpoff IE against hidden var */
+ movl %gs:0, %eax
+ nop;nop
+ addl sh1@indntpoff, %eax
+ nop;nop;nop;nop
+
+ /* @indntpoff direct %gs access IE against hidden var */
+ movl sh2@indntpoff, %edx
+ nop;nop
+ movl %gs:(%edx), %eax
+ nop;nop;nop;nop
+
+ /* @indntpoff IE against local var */
+ movl %gs:0, %eax
+ nop;nop
+ addl bl1@indntpoff, %eax
+ nop;nop;nop;nop
+
+ /* @indntpoff direct %gs access IE against local var */
+ movl bl2@indntpoff, %edx
+ nop;nop
+ movl %gs:(%edx), %eax
+ nop;nop;nop;nop
+
+ /* LE @tpoff, global var */
+ movl $-3+sg3@tpoff, %edx
+ nop;nop
+ movl %gs:0, %eax
+ nop;nop
+ subl %edx, %eax
+ nop;nop;nop;nop
+
+ /* LE @tpoff, local var */
+ movl $-1+bl3@tpoff, %eax
+ nop;nop
+ movl %gs:0, %edx
+ nop;nop
+ subl %eax, %edx
+ nop;nop;nop;nop
+
+ /* LE @ntpoff, global var */
+ movl %gs:0, %eax
+ nop;nop
+ leal 2+sg4@ntpoff(%eax), %edx
+ nop;nop;nop;nop
+
+ /* LE @ntpoff, hidden var, non-canonical sequence */
+ movl $sh3@ntpoff, %eax
+ nop;nop
+ movl %gs:0, %edx
+ nop;nop
+ addl %eax, %edx
+ nop;nop;nop;nop
+
+ /* LE @ntpoff, local var, non-canonical sequence */
+ movl %gs:0, %edx
+ nop;nop
+ addl $bl4@ntpoff+1, %edx
+ nop;nop;nop;nop
+
+ /* Direct %gs access */
+
+ /* LE @ntpoff, global var */
+ movl %gs:sg5@ntpoff, %eax
+ nop;nop;nop;nop
+
+ /* LE @ntpoff, local var */
+ movl %gs:bl5@ntpoff+3, %edx
+ nop;nop;nop;nop
+
+ /* LE @ntpoff, hidden var */
+ movl %gs:1+sh4@ntpoff, %edx
+ nop;nop;nop;nop
+
+ movl -4(%ebp), %ebx
+ leave
+ ret
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlsnopic2.s b/binutils-2.21/ld/testsuite/ld-i386/tlsnopic2.s
new file mode 100644
index 0000000..d932956
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlsnopic2.s
@@ -0,0 +1,7 @@
+ .section ".tbss", "awT", @nobits
+ .globl sh1, sh2, sh3, sh4
+ .hidden sh1, sh2, sh3, sh4
+sh1: .space 4
+sh2: .space 4
+sh3: .space 4
+sh4: .space 4
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlspic.dd b/binutils-2.21/ld/testsuite/ld-i386/tlspic.dd
new file mode 100644
index 0000000..dd436d2
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlspic.dd
@@ -0,0 +1,411 @@
+#source: tlspic1.s
+#source: tlspic2.s
+#as: --32
+#ld: -shared -melf_i386
+#objdump: -drj.text
+#target: i?86-*-*
+
+.*: +file format elf32-i386
+
+Disassembly of section .text:
+
+[0-9a-f]+ <fn1>:
+ [0-9a-f]+: 55[ ]+push %ebp
+ [0-9a-f]+: 89 e5[ ]+mov %esp,%ebp
+ [0-9a-f]+: 53[ ]+push %ebx
+ [0-9a-f]+: 50[ ]+push %eax
+ [0-9a-f]+: e8 00 00 00 00[ ]+call [0-9a-f]+ <fn1\+0xa>
+ [0-9a-f]+: 5b[ ]+pop %ebx
+ [0-9a-f]+: 81 c3 42 14 00 00[ ]+add \$0x[0-9a-f]+,%ebx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# GD
+ [0-9a-f]+: 8d 04 1d d4 ff ff ff[ ]+lea -0x2c\(,%ebx,1\),%eax
+# ->R_386_TLS_DTPMOD32 sg1
+ [0-9a-f]+: e8 cf ff ff ff[ ]+call [0-9a-f]+ <___tls_get_addr@plt>
+# ->R_386_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 because variable is referenced through @gottpoff too
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 2b 83 f0 ff ff ff[ ]+sub -0x10\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 sg2
+ [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 @gotntpoff too
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 03 83 b4 ff ff ff[ ]+add -0x4c\(%ebx\),%eax
+# ->R_386_TLS_TPOFF sg3
+ [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 @gottpoff and
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 2b 83 c0 ff ff ff[ ]+sub -0x40\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 sg4
+ [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]+: 8d 04 1d 88 ff ff ff[ ]+lea -0x78\(,%ebx,1\),%eax
+# ->R_386_TLS_DTPMOD32 [0x00000000 0x20000000]
+ [0-9a-f]+: e8 8f ff ff ff[ ]+call [0-9a-f]+ <___tls_get_addr@plt>
+# ->R_386_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 against local variable referenced through @gottpoff too
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 2b 83 90 ff ff ff[ ]+sub -0x70\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 [0xdcffffff]
+ [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 @gotntpoff
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 03 83 94 ff ff ff[ ]+add -0x6c\(%ebx\),%eax
+# ->R_386_TLS_TPOFF [0x28000000]
+ [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 @gottpoff and
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 2b 83 98 ff ff ff[ ]+sub -0x68\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 [0xd4ffffff]
+ [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]+: 8d 04 1d f4 ff ff ff[ ]+lea -0xc\(,%ebx,1\),%eax
+# ->R_386_TLS_DTPMOD32 [0x00000000 0x40000000]
+ [0-9a-f]+: e8 4f ff ff ff[ ]+call [0-9a-f]+ <___tls_get_addr@plt>
+# ->R_386_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 against hidden and local variable referenced through @gottpoff too
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 2b 83 fc ff ff ff[ ]+sub -0x4\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 [0xbcffffff]
+ [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 @gotntpoff too
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 03 83 b8 ff ff ff[ ]+add -0x48\(%ebx\),%eax
+# ->R_386_TLS_TPOFF [0x48000000]
+ [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 @gottpoff and @gotntpoff too
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 2b 83 dc ff ff ff[ ]+sub -0x24\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 [0xb4ffffff]
+ [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]+: 8d 04 1d ac ff ff ff[ ]+lea -0x54\(,%ebx,1\),%eax
+# ->R_386_TLS_DTPMOD32 [0x00000000 0x60000000]
+ [0-9a-f]+: e8 0f ff ff ff[ ]+call [0-9a-f]+ <___tls_get_addr@plt>
+# ->R_386_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 against hidden but not local variable referenced through
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 2b 83 bc ff ff ff[ ]+sub -0x44\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 [0x9cffffff]
+ [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
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 03 83 e4 ff ff ff[ ]+add -0x1c\(%ebx\),%eax
+# ->R_386_TLS_TPOFF [0x68000000]
+ [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
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 2b 83 cc ff ff ff[ ]+sub -0x34\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 [0x94ffffff]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# LD
+ [0-9a-f]+: 8d 83 a4 ff ff ff[ ]+lea -0x5c\(%ebx\),%eax
+# ->R_386_TLS_DTPMOD32 [0x00000000 0x00000000]
+ [0-9a-f]+: e8 d0 fe ff ff[ ]+call [0-9a-f]+ <___tls_get_addr@plt>
+# ->R_386_JUMP_SLOT ___tls_get_addr
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8d 90 20 00 00 00[ ]+lea 0x20\(%eax\),%edx
+# sl1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8d 88 26 00 00 00[ ]+lea 0x26\(%eax\),%ecx
+# sl2+2
+ [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]+: 8d 83 a4 ff ff ff[ ]+lea -0x5c\(%ebx\),%eax
+# ->R_386_TLS_DTPMOD32 [0x00000000 0x00000000]
+ [0-9a-f]+: e8 b1 fe ff ff[ ]+call [0-9a-f]+ <___tls_get_addr@plt>
+# ->R_386_JUMP_SLOT ___tls_get_addr
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8d 90 40 00 00 00[ ]+lea 0x40\(%eax\),%edx
+# sh1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8d 88 47 00 00 00[ ]+lea 0x47\(%eax\),%ecx
+# sh2+3
+ [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]+: 8d 83 a4 ff ff ff[ ]+lea -0x5c\(%ebx\),%eax
+# ->R_386_TLS_DTPMOD32 [0x00000000 0x00000000]
+ [0-9a-f]+: e8 92 fe ff ff[ ]+call [0-9a-f]+ <___tls_get_addr@plt>
+# ->R_386_JUMP_SLOT ___tls_get_addr
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8d 90 60 00 00 00[ ]+lea 0x60\(%eax\),%edx
+# sH1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8d 88 65 00 00 00[ ]+lea 0x65\(%eax\),%ecx
+# sH2+1
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE against global var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 2b 8b f0 ff ff ff[ ]+sub -0x10\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF32 sg2
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE against global var
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 2b 83 c0 ff ff ff[ ]+sub -0x40\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 sg4
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against global var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 03 8b b4 ff ff ff[ ]+add -0x4c\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF sg3
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against global var
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 03 83 c4 ff ff ff[ ]+add -0x3c\(%ebx\),%eax
+# ->R_386_TLS_TPOFF sg4
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE against local var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 2b 8b 90 ff ff ff[ ]+sub -0x70\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF32 [0xdcffffff]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE against local var
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 2b 83 98 ff ff ff[ ]+sub -0x68\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 [0xd4ffffff]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against local var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 03 8b 94 ff ff ff[ ]+add -0x6c\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF [0x28000000]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against local var
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 03 83 9c ff ff ff[ ]+add -0x64\(%ebx\),%eax
+# ->R_386_TLS_TPOFF [0x2c000000]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE against hidden and local var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 2b 8b fc ff ff ff[ ]+sub -0x4\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF32 [0xbcffffff]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE against hidden and local var
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 2b 83 dc ff ff ff[ ]+sub -0x24\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 [0xb4ffffff]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against hidden and local var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 03 8b b8 ff ff ff[ ]+add -0x48\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF [0x48000000]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against hidden and local var
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 03 83 e0 ff ff ff[ ]+add -0x20\(%ebx\),%eax
+# ->R_386_TLS_TPOFF [0x4c000000]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE against hidden but not local var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 2b 8b bc ff ff ff[ ]+sub -0x44\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF32 [0x9cffffff]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gottpoff IE against hidden but not local var
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 2b 83 cc ff ff ff[ ]+sub -0x34\(%ebx\),%eax
+# ->R_386_TLS_TPOFF32 [0x94ffffff]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against hidden but not local var
+ [0-9a-f]+: 65 8b 0d 00 00 00 00[ ]+mov %gs:0x0,%ecx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 03 8b e4 ff ff ff[ ]+add -0x1c\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF [0x68000000]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against hidden but not local var
+ [0-9a-f]+: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 03 83 d0 ff ff ff[ ]+add -0x30\(%ebx\),%eax
+# ->R_386_TLS_TPOFF [0x6c000000]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# Direct access through %gs
+# @gotntpoff IE against global var
+ [0-9a-f]+: 8b 8b c8 ff ff ff[ ]+mov -0x38\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF sg5
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 65 8b 11[ ]+mov %gs:\(%ecx\),%edx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against local var
+ [0-9a-f]+: 8b 83 a0 ff ff ff[ ]+mov -0x60\(%ebx\),%eax
+# ->R_386_TLS_TPOFF [0x30000000]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 65 8b 10[ ]+mov %gs:\(%eax\),%edx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against hidden and local var
+ [0-9a-f]+: 8b 93 e8 ff ff ff[ ]+mov -0x18\(%ebx\),%edx
+# ->R_386_TLS_TPOFF [0x50000000]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 65 8b 12[ ]+mov %gs:\(%edx\),%edx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+# @gotntpoff IE against hidden but not local var
+ [0-9a-f]+: 8b 8b ec ff ff ff[ ]+mov -0x14\(%ebx\),%ecx
+# ->R_386_TLS_TPOFF [0x70000000]
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 65 8b 11[ ]+mov %gs:\(%ecx\),%edx
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 8b 5d fc[ ]+mov -0x4\(%ebp\),%ebx
+ [0-9a-f]+: c9[ ]+leave *
+ [0-9a-f]+: c3[ ]+ret *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
+ [0-9a-f]+: 90[ ]+nop *
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlspic.rd b/binutils-2.21/ld/testsuite/ld-i386/tlspic.rd
new file mode 100644
index 0000000..46b8ed5
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlspic.rd
@@ -0,0 +1,154 @@
+#source: tlspic1.s
+#source: tlspic2.s
+#as: --32
+#ld: -shared -melf_i386
+#readelf: -Ssrl
+#target: i?86-*-*
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Addr +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]+\] \.rel.dyn +.*
+ +\[[ 0-9]+\] \.rel.plt +.*
+ +\[[ 0-9]+\] \.plt +.*
+ +\[[ 0-9]+\] \.text +.*
+ +\[[ 0-9]+\] \.tdata +PROGBITS +[0-9a-f]+ [0-9a-f]+ 000060 00 WAT +0 +0 +1
+ +\[[ 0-9]+\] \.tbss +NOBITS +[0-9aa-f]+ [0-9a-f]+ 000020 00 WAT +0 +0 +1
+ +\[[ 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.*
+ +TLS +0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x0+60 0x0+80 R +0x1
+
+ Section to Segment mapping:
+ +Segment Sections...
+ +00 +.hash .dynsym .dynstr .rel.dyn .rel.plt .plt .text *
+ +01 +.tdata .dynamic .got .got.plt *
+ +02 +.dynamic *
+ +03 +.tdata .tbss *
+
+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 26 entries:
+ Offset +Info +Type +Sym.Value +Sym. Name
+[0-9a-f ]+R_386_TLS_DTPMOD3
+[0-9a-f ]+R_386_TLS_TPOFF32
+[0-9a-f ]+R_386_TLS_TPOFF *
+[0-9a-f ]+R_386_TLS_TPOFF32
+[0-9a-f ]+R_386_TLS_TPOFF *
+[0-9a-f ]+R_386_TLS_TPOFF *
+[0-9a-f ]+R_386_TLS_DTPMOD3
+[0-9a-f ]+R_386_TLS_DTPMOD3
+[0-9a-f ]+R_386_TLS_TPOFF *
+[0-9a-f ]+R_386_TLS_TPOFF32
+[0-9a-f ]+R_386_TLS_TPOFF32
+[0-9a-f ]+R_386_TLS_TPOFF *
+[0-9a-f ]+R_386_TLS_TPOFF32
+[0-9a-f ]+R_386_TLS_TPOFF *
+[0-9a-f ]+R_386_TLS_TPOFF *
+[0-9a-f ]+R_386_TLS_TPOFF *
+[0-9a-f ]+R_386_TLS_TPOFF *
+[0-9a-f ]+R_386_TLS_DTPMOD3
+[0-9a-f ]+R_386_TLS_TPOFF32
+[0-9a-f ]+R_386_TLS_TPOFF +0+8 +sg3
+[0-9a-f ]+R_386_TLS_TPOFF32 0+c +sg4
+[0-9a-f ]+R_386_TLS_TPOFF +0+c +sg4
+[0-9a-f ]+R_386_TLS_TPOFF +0+10 +sg5
+[0-9a-f ]+R_386_TLS_DTPMOD3 0+ +sg1
+[0-9a-f ]+R_386_TLS_DTPOFF3 0+ +sg1
+[0-9a-f ]+R_386_TLS_TPOFF32 0+4 +sg2
+
+Relocation section '.rel.plt' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset +Info +Type +Sym.Value +Sym. Name
+[0-9a-f ]+R_386_JUMP_SLOT +0+ +___tls_get_addr
+
+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+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-9a-f]+ +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
+ +[0-9]+: 0+ +0 +NOTYPE +GLOBAL +DEFAULT +UND ___tls_get_addr
+
+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-9a-f]+ +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-9a-f]+ +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-9a-f]+ +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
+ +[0-9]+: 0+ +0 +NOTYPE +GLOBAL +DEFAULT +UND ___tls_get_addr
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlspic.sd b/binutils-2.21/ld/testsuite/ld-i386/tlspic.sd
new file mode 100644
index 0000000..f9c9627
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlspic.sd
@@ -0,0 +1,18 @@
+#source: tlspic1.s
+#source: tlspic2.s
+#as: --32
+#ld: -shared -melf_i386
+#objdump: -sj.got
+#target: i?86-*-*
+
+.*: file format elf32-i386
+
+Contents of section \.got:
+ [0-9a-f]+ 00000000 20000000 dcffffff 28000000 .*
+ [0-9a-f]+ d4ffffff 2c000000 30000000 00000000 .*
+ [0-9a-f]+ 00000000 00000000 60000000 00000000 .*
+ [0-9a-f]+ 48000000 9cffffff 00000000 00000000 .*
+ [0-9a-f]+ 00000000 94ffffff 6c000000 00000000 .*
+ [0-9a-f]+ 00000000 b4ffffff 4c000000 68000000 .*
+ [0-9a-f]+ 50000000 70000000 00000000 00000000 .*
+ [0-9a-f]+ 40000000 bcffffff +.*
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlspic.td b/binutils-2.21/ld/testsuite/ld-i386/tlspic.td
new file mode 100644
index 0000000..1291584
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlspic.td
@@ -0,0 +1,16 @@
+#source: tlspic1.s
+#source: tlspic2.s
+#as: --32
+#ld: -shared -melf_i386
+#objdump: -sj.tdata
+#target: i?86-*-*
+
+.*: file format elf32-i386
+
+Contents of section \.tdata:
+ [0-9a-f]+ 11000000 12000000 13000000 14000000 .*
+ [0-9a-f]+ 15000000 16000000 17000000 18000000 .*
+ [0-9a-f]+ 41000000 42000000 43000000 44000000 .*
+ [0-9a-f]+ 45000000 46000000 47000000 48000000 .*
+ [0-9a-f]+ 01010000 02010000 03010000 04010000 .*
+ [0-9a-f]+ 05010000 06010000 07010000 08010000 .*
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlspic1.s b/binutils-2.21/ld/testsuite/ld-i386/tlspic1.s
new file mode 100644
index 0000000..9dcb3b7
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlspic1.s
@@ -0,0 +1,282 @@
+ .section ".tdata", "awT", @progbits
+ .globl sg1, sg2, sg3, sg4, sg5, sg6, sg7, sg8
+ .globl sh1, sh2, sh3, sh4, sh5, sh6, sh7, sh8
+ .hidden sh1, sh2, sh3, sh4, sh5, sh6, sh7, sh8
+sg1: .long 17
+sg2: .long 18
+sg3: .long 19
+sg4: .long 20
+sg5: .long 21
+sg6: .long 22
+sg7: .long 23
+sg8: .long 24
+sl1: .long 65
+sl2: .long 66
+sl3: .long 67
+sl4: .long 68
+sl5: .long 69
+sl6: .long 70
+sl7: .long 71
+sl8: .long 72
+sh1: .long 257
+sh2: .long 258
+sh3: .long 259
+sh4: .long 260
+sh5: .long 261
+sh6: .long 262
+sh7: .long 263
+sh8: .long 264
+ .text
+ .globl fn1
+ .type fn1,@function
+fn1:
+ pushl %ebp
+ movl %esp, %ebp
+ pushl %ebx
+ pushl %eax
+ call 1f
+1: popl %ebx
+ addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
+ nop;nop;nop;nop
+
+ /* GD */
+ leal sg1@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE because variable is referenced through @gottpoff too */
+ leal sg2@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE because variable is referenced through @gotntpoff too */
+ leal sg3@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE because variable is referenced through @gottpoff and
+ @gotntpoff too */
+ leal sg4@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD against local variable */
+ leal sl1@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE against local variable referenced through @gottpoff too */
+ leal sl2@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE against local variable referenced through @gotntpoff
+ too */
+ leal sl3@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE against local variable referenced through @gottpoff and
+ @gotntpoff too */
+ leal sl4@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD against hidden and local variable */
+ leal sh1@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE against hidden and local variable referenced through
+ @gottpoff too */
+ leal sh2@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE against hidden and local variable referenced through
+ @gotntpoff too */
+ leal sh3@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE against hidden and local variable referenced through
+ @gottpoff and @gotntpoff too */
+ leal sh4@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD against hidden but not local variable */
+ leal sH1@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE against hidden but not local variable referenced through
+ @gottpoff too */
+ leal sH2@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE against hidden but not local variable referenced through
+ @gotntpoff too */
+ leal sH3@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* GD -> IE against hidden but not local variable referenced through
+ @gottpoff and @gotntpoff too */
+ leal sH4@tlsgd(,%ebx,1), %eax
+ call ___tls_get_addr@plt
+ nop;nop;nop;nop
+
+ /* LD */
+ leal sl1@tlsldm(%ebx), %eax
+ call ___tls_get_addr@PLT
+ nop;nop
+ leal sl1@dtpoff(%eax), %edx
+ nop;nop
+ leal 2+sl2@dtpoff(%eax), %ecx
+ nop;nop;nop;nop
+
+ /* LD against hidden and local variables */
+ leal sh1@tlsldm(%ebx), %eax
+ call ___tls_get_addr@PLT
+ nop;nop
+ leal sh1@dtpoff(%eax), %edx
+ nop;nop
+ leal sh2@dtpoff+3(%eax), %ecx
+ nop;nop;nop;nop
+
+ /* LD against hidden but not local variables */
+ leal sH1@tlsldm(%ebx), %eax
+ call ___tls_get_addr@PLT
+ nop;nop
+ leal sH1@dtpoff(%eax), %edx
+ nop;nop
+ leal sH2@dtpoff+1(%eax), %ecx
+ nop;nop
+
+ /* @gottpoff IE against global var */
+ movl %gs:0, %ecx
+ nop;nop
+ subl sg2@gottpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gottpoff IE against global var */
+ movl %gs:0, %eax
+ nop;nop
+ subl sg4@gottpoff(%ebx), %eax
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against global var */
+ movl %gs:0, %ecx
+ nop;nop
+ addl sg3@gotntpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against global var */
+ movl %gs:0, %eax
+ nop;nop
+ addl sg4@gotntpoff(%ebx), %eax
+ nop;nop;nop;nop
+
+ /* @gottpoff IE against local var */
+ movl %gs:0, %ecx
+ nop;nop
+ subl sl2@gottpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gottpoff IE against local var */
+ movl %gs:0, %eax
+ nop;nop
+ subl sl4@gottpoff(%ebx), %eax
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against local var */
+ movl %gs:0, %ecx
+ nop;nop
+ addl sl3@gotntpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against local var */
+ movl %gs:0, %eax
+ nop;nop
+ addl sl4@gotntpoff(%ebx), %eax
+ nop;nop;nop;nop
+
+ /* @gottpoff IE against hidden and local var */
+ movl %gs:0, %ecx
+ nop;nop
+ subl sh2@gottpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gottpoff IE against hidden and local var */
+ movl %gs:0, %eax
+ nop;nop
+ subl sh4@gottpoff(%ebx), %eax
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against hidden and local var */
+ movl %gs:0, %ecx
+ nop;nop
+ addl sh3@gotntpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against hidden and local var */
+ movl %gs:0, %eax
+ nop;nop
+ addl sh4@gotntpoff(%ebx), %eax
+ nop;nop;nop;nop
+
+ /* @gottpoff IE against hidden but not local var */
+ movl %gs:0, %ecx
+ nop;nop
+ subl sH2@gottpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gottpoff IE against hidden but not local var */
+ movl %gs:0, %eax
+ nop;nop
+ subl sH4@gottpoff(%ebx), %eax
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against hidden but not local var */
+ movl %gs:0, %ecx
+ nop;nop
+ addl sH3@gotntpoff(%ebx), %ecx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against hidden but not local var */
+ movl %gs:0, %eax
+ nop;nop
+ addl sH4@gotntpoff(%ebx), %eax
+ nop;nop;nop;nop
+
+ /* Direct access through %gs */
+
+ /* @gotntpoff IE against global var */
+ movl sg5@gotntpoff(%ebx), %ecx
+ nop;nop
+ movl %gs:(%ecx), %edx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against local var */
+ movl sl5@gotntpoff(%ebx), %eax
+ nop;nop
+ movl %gs:(%eax), %edx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against hidden and local var */
+ movl sh5@gotntpoff(%ebx), %edx
+ nop;nop
+ movl %gs:(%edx), %edx
+ nop;nop;nop;nop
+
+ /* @gotntpoff IE against hidden but not local var */
+ movl sH5@gotntpoff(%ebx), %ecx
+ nop;nop
+ movl %gs:(%ecx), %edx
+ nop;nop;nop;nop
+
+ movl -4(%ebp), %ebx
+ leave
+ ret
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlspic2.s b/binutils-2.21/ld/testsuite/ld-i386/tlspic2.s
new file mode 100644
index 0000000..5513f9b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/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-i386/tlspie1.d b/binutils-2.21/ld/testsuite/ld-i386/tlspie1.d
new file mode 100644
index 0000000..bac5dc6
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlspie1.d
@@ -0,0 +1,6 @@
+#name: TLS with PIE
+#as: --32
+#ld: -melf_i386 -pie
+#readelf: -r
+
+There are no relocations in this file.
diff --git a/binutils-2.21/ld/testsuite/ld-i386/tlspie1.s b/binutils-2.21/ld/testsuite/ld-i386/tlspie1.s
new file mode 100644
index 0000000..c2b6151
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/tlspie1.s
@@ -0,0 +1,64 @@
+ .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:
+ pushl %ebp
+ movl %esp, %ebp
+ pushl %esi
+ pushl %ebx
+ call .L3
+.L3:
+ popl %ebx
+ addl $_GLOBAL_OFFSET_TABLE_+[.-.L3], %ebx
+ movl %gs:foo2@NTPOFF, %esi
+ addl %gs:foo1@NTPOFF, %esi
+ movl foo3@GOTNTPOFF(%ebx), %eax
+ addl %gs:(%eax), %esi
+ leal foo4@TLSGD(,%ebx,1), %eax
+ call ___tls_get_addr@PLT
+ addl (%eax), %esi
+ leal foo5@TLSGD(,%ebx,1), %eax
+ call ___tls_get_addr@PLT
+ addl (%eax), %esi
+ movl %esi, %eax
+ popl %ebx
+ popl %esi
+ leave
+ 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-i386/vxworks1-lib.dd b/binutils-2.21/ld/testsuite/ld-i386/vxworks1-lib.dd
new file mode 100644
index 0000000..6d56eb2
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/vxworks1-lib.dd
@@ -0,0 +1,41 @@
+
+.*: file format .*
+
+Disassembly of section \.plt:
+
+00080800 <_PROCEDURE_LINKAGE_TABLE_>:
+ 80800: ff b3 04 00 00 00 pushl 0x4\(%ebx\)
+ 80806: ff a3 08 00 00 00 jmp \*0x8\(%ebx\)
+ 8080c: 90 nop
+ 8080d: 90 nop
+ 8080e: 90 nop
+ 8080f: 90 nop
+
+00080810 <sexternal@plt>:
+ 80810: ff a3 0c 00 00 00 jmp \*0xc\(%ebx\)
+ 80816: 68 00 00 00 00 push \$0x0
+ 8081b: e9 e0 ff ff ff jmp 80800 <_PROCEDURE_LINKAGE_TABLE_>
+
+00080820 <sglobal@plt>:
+ 80820: ff a3 10 00 00 00 jmp \*0x10\(%ebx\)
+ 80826: 68 08 00 00 00 push \$0x8
+ 8082b: e9 d0 ff ff ff jmp 80800 <_PROCEDURE_LINKAGE_TABLE_>
+Disassembly of section \.text:
+
+00080c00 <foo>:
+ 80c00: 53 push %ebx
+ 80c01: 8b 1d 00 00 00 00 mov 0x0,%ebx
+ 80c07: 8b 99 00 00 00 00 mov 0x0\(%ecx\),%ebx
+ 80c0d: 8b 83 14 00 00 00 mov 0x14\(%ebx\),%eax
+ 80c13: ff 00 incl \(%eax\)
+ 80c15: e8 0c 00 00 00 call 80c26 <slocal>
+ 80c1a: e8 01 fc ff ff call 80820 <sglobal@plt>
+ 80c1f: e8 ec fb ff ff call 80810 <sexternal@plt>
+ 80c24: 5b pop %ebx
+ 80c25: c3 ret
+
+00080c26 <slocal>:
+ 80c26: c3 ret
+
+00080c27 <sglobal>:
+ 80c27: c3 ret
diff --git a/binutils-2.21/ld/testsuite/ld-i386/vxworks1-lib.nd b/binutils-2.21/ld/testsuite/ld-i386/vxworks1-lib.nd
new file mode 100644
index 0000000..edf3db3
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/vxworks1-lib.nd
@@ -0,0 +1,9 @@
+#...
+Symbol table '\.dynsym' .*:
+#...
+.*: 00081400 * 0 * OBJECT * GLOBAL * DEFAULT * [0-9]+ _GLOBAL_OFFSET_TABLE_
+#...
+Symbol table '\.symtab' .*:
+#...
+.*: 00081400 * 0 * OBJECT * GLOBAL * DEFAULT * [0-9]+ _GLOBAL_OFFSET_TABLE_
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-i386/vxworks1-lib.rd b/binutils-2.21/ld/testsuite/ld-i386/vxworks1-lib.rd
new file mode 100644
index 0000000..b899b73
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/vxworks1-lib.rd
@@ -0,0 +1,12 @@
+
+Relocation section '\.rel\.dyn' at offset .* contains 4 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+00081800 00000008 R_386_RELATIVE *
+00080c03 .*01 R_386_32 00000000 __GOTT_BASE__
+00080c09 .*01 R_386_32 00000000 __GOTT_INDEX__
+00081414 .*06 R_386_GLOB_DAT 00081c00 x
+
+Relocation section '\.rel\.plt' at offset .* contains 2 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+0008140c .*07 R_386_JUMP_SLOT 00000000 sexternal
+00081410 .*07 R_386_JUMP_SLOT 00080c27 sglobal
diff --git a/binutils-2.21/ld/testsuite/ld-i386/vxworks1-lib.s b/binutils-2.21/ld/testsuite/ld-i386/vxworks1-lib.s
new file mode 100644
index 0000000..f9f05dc
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/vxworks1-lib.s
@@ -0,0 +1,31 @@
+ .text
+ .globl foo
+ .type foo, @function
+foo:
+ push %ebx
+ movl __GOTT_BASE__, %ebx
+ movl __GOTT_INDEX__(%ecx), %ebx
+ movl x@GOT(%ebx), %eax
+ incl (%eax)
+ call slocal@plt
+ call sglobal@plt
+ call sexternal@plt
+ pop %ebx
+ ret
+ .size foo, .-foo
+
+ .type slocal, @function
+slocal:
+ ret
+ .size slocal, .-slocal
+
+ .globl sglobal
+ .type sglobal, @function
+sglobal:
+ ret
+ .size sglobal, .-sglobal
+
+ .data
+ .4byte slocal
+
+ .comm x,4,4
diff --git a/binutils-2.21/ld/testsuite/ld-i386/vxworks1-lib.td b/binutils-2.21/ld/testsuite/ld-i386/vxworks1-lib.td
new file mode 100644
index 0000000..9f223e3
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/vxworks1-lib.td
@@ -0,0 +1,3 @@
+#...
+ 0x0+16 \(TEXTREL\) +0x0
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-i386/vxworks1-static.d b/binutils-2.21/ld/testsuite/ld-i386/vxworks1-static.d
new file mode 100644
index 0000000..88c0baf
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/vxworks1-static.d
@@ -0,0 +1,4 @@
+#name: VxWorks executable test 1 (static)
+#source: vxworks1.s
+#ld: tmpdir/libvxworks1.so -Tvxworks1.ld
+#error: Dynamic sections created in non-dynamic link
diff --git a/binutils-2.21/ld/testsuite/ld-i386/vxworks1.dd b/binutils-2.21/ld/testsuite/ld-i386/vxworks1.dd
new file mode 100644
index 0000000..02b8bc0
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/vxworks1.dd
@@ -0,0 +1,38 @@
+
+.*: file format .*
+
+Disassembly of section \.plt:
+
+00080800 <_PROCEDURE_LINKAGE_TABLE_>:
+ 80800: ff 35 04 14 08 00 pushl 0x81404
+ 80802: R_386_32 _GLOBAL_OFFSET_TABLE_
+ 80806: ff 25 08 14 08 00 jmp \*0x81408
+ 80808: R_386_32 _GLOBAL_OFFSET_TABLE_
+ 8080c: 90 nop
+ 8080d: 90 nop
+ 8080e: 90 nop
+ 8080f: 90 nop
+
+00080810 <sglobal@plt>:
+ 80810: ff 25 0c 14 08 00 jmp \*0x8140c
+ 80812: R_386_32 _GLOBAL_OFFSET_TABLE_
+ 80816: 68 00 00 00 00 push \$0x0
+ 8081b: e9 e0 ff ff ff jmp 80800 <_PROCEDURE_LINKAGE_TABLE_>
+
+00080820 <foo@plt>:
+ 80820: ff 25 10 14 08 00 jmp \*0x81410
+ 80822: R_386_32 _GLOBAL_OFFSET_TABLE_
+ 80826: 68 08 00 00 00 push \$0x8
+ 8082b: e9 d0 ff ff ff jmp 80800 <_PROCEDURE_LINKAGE_TABLE_>
+Disassembly of section \.text:
+
+00080c00 <_start>:
+ 80c00: e8 1b fc ff ff call 80820 <foo@plt>
+ 80c01: R_386_PLT32 \.plt
+ 80c05: e8 05 00 00 00 call 80c0f <sexternal>
+ 80c06: R_386_PLT32 sexternal
+ 80c0a: e9 01 fc ff ff jmp 80810 <sglobal@plt>
+ 80c0b: R_386_PLT32 \.plt
+
+00080c0f <sexternal>:
+ 80c0f: c3 ret
diff --git a/binutils-2.21/ld/testsuite/ld-i386/vxworks1.ld b/binutils-2.21/ld/testsuite/ld-i386/vxworks1.ld
new file mode 100644
index 0000000..ed76f18
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/vxworks1.ld
@@ -0,0 +1,30 @@
+SECTIONS
+{
+ . = 0x80000;
+ .interp : { *(.interp) }
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+
+ . = ALIGN (0x400);
+ .rel.dyn : { *(.rel.dyn) }
+ .rel.plt : { *(.rel.plt) }
+
+ . = ALIGN (0x400);
+ .plt : { *(.plt) }
+
+ . = ALIGN (0x400);
+ .text : { *(.text) }
+
+ . = ALIGN (0x1000);
+ .dynamic : { *(.dynamic) }
+
+ . = ALIGN (0x400);
+ .got : { *(.got.plt) *(.got) }
+
+ . = ALIGN (0x400);
+ .data : { *(.data) }
+
+ . = ALIGN (0x400);
+ .bss : { *(.bss) *(.dynbss) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-i386/vxworks1.rd b/binutils-2.21/ld/testsuite/ld-i386/vxworks1.rd
new file mode 100644
index 0000000..9fd7383
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/vxworks1.rd
@@ -0,0 +1,20 @@
+
+Relocation section '\.rel\.plt' at offset .* contains 2 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+0008140c .*07 R_386_JUMP_SLOT 00000000 sglobal
+00081410 .*07 R_386_JUMP_SLOT 00000000 foo
+
+Relocation section '\.rel\.text' at offset .* contains 3 entries:
+ Offset Info Type Sym.Value Sym. Name
+00080c01 .*04 R_386_PLT32 00080800 .plt
+00080c06 .*04 R_386_PLT32 00080c0f sexternal
+00080c0b .*04 R_386_PLT32 00080800 .plt
+
+Relocation section '\.rel\.plt\.unloaded' at offset .* contains 6 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+00080802 .*01 R_386_32 00081400 _GLOBAL_OFFSET_TABLE_
+00080808 .*01 R_386_32 00081400 _GLOBAL_OFFSET_TABLE_
+00080812 .*01 R_386_32 00081400 _GLOBAL_OFFSET_TABLE_
+0008140c .*01 R_386_32 00080800 _PROCEDURE_LINKAGE_TAB.*
+00080822 .*01 R_386_32 00081400 _GLOBAL_OFFSET_TABLE_
+00081410 .*01 R_386_32 00080800 _PROCEDURE_LINKAGE_TAB.*
diff --git a/binutils-2.21/ld/testsuite/ld-i386/vxworks1.s b/binutils-2.21/ld/testsuite/ld-i386/vxworks1.s
new file mode 100644
index 0000000..5cb68af
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/vxworks1.s
@@ -0,0 +1,14 @@
+ .text
+ .globl _start
+ .type _start,@function
+_start:
+ call foo@plt
+ call sexternal@plt
+ jmp sglobal@plt
+ .size _start, .-_start
+
+ .globl sexternal
+ .type sexternal,@function
+sexternal:
+ ret
+ .size sexternal, .-sexternal
diff --git a/binutils-2.21/ld/testsuite/ld-i386/vxworks2-static.sd b/binutils-2.21/ld/testsuite/ld-i386/vxworks2-static.sd
new file mode 100644
index 0000000..912755b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/vxworks2-static.sd
@@ -0,0 +1,9 @@
+#...
+Elf file type is EXEC \(Executable file\)
+Entry point 0x80000
+#...
+Program Headers:
+ Type .*
+ LOAD .* 0x00080000 0x00080000 .* R E 0x1000
+
+#...
diff --git a/binutils-2.21/ld/testsuite/ld-i386/vxworks2.s b/binutils-2.21/ld/testsuite/ld-i386/vxworks2.s
new file mode 100644
index 0000000..28c8acb
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/vxworks2.s
@@ -0,0 +1,5 @@
+ .globl _start
+ .type _start,@function
+_start:
+ ret
+ .end _start
diff --git a/binutils-2.21/ld/testsuite/ld-i386/vxworks2.sd b/binutils-2.21/ld/testsuite/ld-i386/vxworks2.sd
new file mode 100644
index 0000000..5ff87d3
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/vxworks2.sd
@@ -0,0 +1,13 @@
+#...
+Elf file type is EXEC \(Executable file\)
+Entry point 0x80400
+#...
+Program Headers:
+ Type .*
+ PHDR .*
+#...
+ LOAD .* 0x00080000 0x00080000 .* R E 0x1000
+ LOAD .* 0x00081000 0x00081000 .* RW 0x1000
+ DYNAMIC .*
+
+#...
diff --git a/binutils-2.21/ld/testsuite/ld-i386/warn1.d b/binutils-2.21/ld/testsuite/ld-i386/warn1.d
new file mode 100644
index 0000000..dd541f2
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/warn1.d
@@ -0,0 +1,4 @@
+#name: --warn-shared-textrel --fatal-warnings
+#as: --32
+#ld: -shared -melf_i386 --warn-shared-textrel --fatal-warnings
+#error: .*warning: creating a DT_TEXTREL in a shared object.
diff --git a/binutils-2.21/ld/testsuite/ld-i386/warn1.s b/binutils-2.21/ld/testsuite/ld-i386/warn1.s
new file mode 100644
index 0000000..ca3481a
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/warn1.s
@@ -0,0 +1,5 @@
+ .text
+ .globl foo
+ .type foo, @function
+foo:
+ movl bar, %eax
diff --git a/binutils-2.21/ld/testsuite/ld-i386/zero.s b/binutils-2.21/ld/testsuite/ld-i386/zero.s
new file mode 100644
index 0000000..f716bba
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-i386/zero.s
@@ -0,0 +1,2 @@
+ .global zero
+ .equiv zero, 0