aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-i386
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2007-08-14 19:48:21 +0000
committerH.J. Lu <hjl.tools@gmail.com>2007-08-14 19:48:21 +0000
commita3fadc9a17972a899c807f1ed3c8044066a68857 (patch)
tree76f351a35da7e7cc0506ebb6be7ac3de42bbb77f /ld/testsuite/ld-i386
parent6d307763fb4e0224a97d3f44150b8e07c0943af9 (diff)
downloadgdb-a3fadc9a17972a899c807f1ed3c8044066a68857.zip
gdb-a3fadc9a17972a899c807f1ed3c8044066a68857.tar.gz
gdb-a3fadc9a17972a899c807f1ed3c8044066a68857.tar.bz2
bfd/
2007-08-14 H.J. Lu <hongjiu.lu@intel.com> PR ld/4918 * elf32-i386.c (elf_i386_relocate_section): Allow R_386_PC32 on ___tls_get_addr for GD->LE/LD->LE transitions when not building shared library. * elf64-x86-64.c (elf64_x86_64_relocate_section): Allow R_X86_64_PC32 on __tls_get_addr for GD->LE/LD->LE transitions when not building shared library. ld/testsuite/ 2007-08-14 H.J. Lu <hongjiu.lu@intel.com> PR ld/4918 * ld-i386/i386.exp (i386tests): Add tlsgd1 and tlsld1 tests. * ld-x86-64/x86-64.exp (x86_64tests): Likewise. * ld-i386/tlsgd1.dd: New file. * ld-i386/tlsgd1.s: Likewise. * ld-i386/tlsld1.dd: Likewise. * ld-i386/tlsld1.s: Likewise. * ld-x86-64/tlsgd1.dd: Likewise. * ld-x86-64/tlsgd1.s: Likewise. * ld-x86-64/tlsld1.dd: Likewise. * ld-x86-64/tlsld1.s: Likewise.
Diffstat (limited to 'ld/testsuite/ld-i386')
-rw-r--r--ld/testsuite/ld-i386/i386.exp6
-rw-r--r--ld/testsuite/ld-i386/tlsgd1.dd14
-rw-r--r--ld/testsuite/ld-i386/tlsgd1.s12
-rw-r--r--ld/testsuite/ld-i386/tlsld1.dd15
-rw-r--r--ld/testsuite/ld-i386/tlsld1.s12
5 files changed, 59 insertions, 0 deletions
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index 6b98519..2c7c14b 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -109,6 +109,12 @@ set i386tests {
{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"}
}
run_ld_link_tests $i386tests
diff --git a/ld/testsuite/ld-i386/tlsgd1.dd b/ld/testsuite/ld-i386/tlsgd1.dd
new file mode 100644
index 0000000..54d7416
--- /dev/null
+++ b/ld/testsuite/ld-i386/tlsgd1.dd
@@ -0,0 +1,14 @@
+#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
+#pass
diff --git a/ld/testsuite/ld-i386/tlsgd1.s b/ld/testsuite/ld-i386/tlsgd1.s
new file mode 100644
index 0000000..2b3ed0e
--- /dev/null
+++ b/ld/testsuite/ld-i386/tlsgd1.s
@@ -0,0 +1,12 @@
+ .text
+ .globl _start
+_start:
+ leal foo@TLSGD(,%ebx,1), %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/ld/testsuite/ld-i386/tlsld1.dd b/ld/testsuite/ld-i386/tlsld1.dd
new file mode 100644
index 0000000..782eb5a
--- /dev/null
+++ b/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\),%esi
+#pass
diff --git a/ld/testsuite/ld-i386/tlsld1.s b/ld/testsuite/ld-i386/tlsld1.s
new file mode 100644
index 0000000..5d57e35
--- /dev/null
+++ b/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