aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2006-03-27 11:30:54 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2006-03-27 11:30:54 +0000
commitead49a57e845c028e794fdeb6f3b2492e70b918e (patch)
treee830d5b48fc73f225d5a269740e7d969e9a787be /ld/testsuite
parent5cc40a5834a894e69901fc4a4e0e9b6cd9876e75 (diff)
downloadgdb-ead49a57e845c028e794fdeb6f3b2492e70b918e.zip
gdb-ead49a57e845c028e794fdeb6f3b2492e70b918e.tar.gz
gdb-ead49a57e845c028e794fdeb6f3b2492e70b918e.tar.bz2
* elfxx-mips.c (mips_got_entry): Add more commentary.
(mips_elf_local_got_index): Use the hash table entry to record the GOT index of forced-local symbols. (mips_elf_initialize_tls_index): Rearrange code. Store the index in either the hash table entry or the mips_got_entry, not both. Add more commentary. (mips_elf_multi_got): Make sure the g->next is nonnull when calling mips_elf_initialize_tls_index. * ld-mips-elf/tls-hidden3a.s, ld-mips-elf/tls-hidden3b.s, * ld-mips-elf/tls-hidden3.d, ld-mips-elf/tls-hidden3.got, * ld-mips-elf/tls-hidden3.ld, ld-mips-elf/tls-hidden3.r, * ld-mips-elf/tls-hidden4a.s, ld-mips-elf/tls-hidden4b.s, * ld-mips-elf/tls-hidden4.got, ld-mips-elf/tls-hidden4.r: New tests. * ld-mips-elf/mips-elf.exp: Run them.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ChangeLog9
-rw-r--r--ld/testsuite/ld-mips-elf/mips-elf.exp11
-rw-r--r--ld/testsuite/ld-mips-elf/tls-hidden3.d24
-rw-r--r--ld/testsuite/ld-mips-elf/tls-hidden3.got24
-rw-r--r--ld/testsuite/ld-mips-elf/tls-hidden3.ld31
-rw-r--r--ld/testsuite/ld-mips-elf/tls-hidden3.r13
-rw-r--r--ld/testsuite/ld-mips-elf/tls-hidden3a.s10
-rw-r--r--ld/testsuite/ld-mips-elf/tls-hidden3b.s18
-rw-r--r--ld/testsuite/ld-mips-elf/tls-hidden4.got28
-rw-r--r--ld/testsuite/ld-mips-elf/tls-hidden4.r19
-rw-r--r--ld/testsuite/ld-mips-elf/tls-hidden4a.s18
-rw-r--r--ld/testsuite/ld-mips-elf/tls-hidden4b.s27
12 files changed, 232 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 4be03b8..7684e38 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2006-03-27 Richard Sandiford <richard@codesourcery.com>
+
+ * ld-mips-elf/tls-hidden3a.s, ld-mips-elf/tls-hidden3b.s,
+ * ld-mips-elf/tls-hidden3.d, ld-mips-elf/tls-hidden3.got,
+ * ld-mips-elf/tls-hidden3.ld, ld-mips-elf/tls-hidden3.r,
+ * ld-mips-elf/tls-hidden4a.s, ld-mips-elf/tls-hidden4b.s,
+ * ld-mips-elf/tls-hidden4.got, ld-mips-elf/tls-hidden4.r: New tests.
+ * ld-mips-elf/mips-elf.exp: Run them.
+
2006-03-25 Richard Sandiford <richard@codesourcery.com>
* ld-m68k/merge-error-1a.s, ld-m68k/merge-error-1b.s,
diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp
index add2060..645b7e0 100644
--- a/ld/testsuite/ld-mips-elf/mips-elf.exp
+++ b/ld/testsuite/ld-mips-elf/mips-elf.exp
@@ -199,6 +199,17 @@ set mips_tls_tests {
"-EB -march=mips1 -32 -KPIC" {tls-hidden2a.s tls-hidden2b.s}
{{objdump -drj.text tls-hidden2.d} {objdump -sj.got tls-hidden2-got.d}}
"tls-hidden2.so"}
+ {"Shared library with TLS and hidden symbols (3)"
+ "-shared -melf32btsmip -T tls-hidden3.ld"
+ "-EB -march=mips2 -32 -KPIC" {tls-hidden3a.s tls-hidden3b.s}
+ {{objdump -dj.text tls-hidden3.d} {objdump -sj.got tls-hidden3.got}
+ {readelf --relocs tls-hidden3.r}}
+ "tls-hidden3.so"}
+ {"Shared library with TLS and hidden symbols (4)"
+ "-shared -melf32btsmip -T tls-hidden3.ld"
+ "-EB -march=mips2 -32 -KPIC" {tls-hidden4a.s tls-hidden4b.s}
+ {{objdump -sj.got tls-hidden4.got} {readelf --relocs tls-hidden4.r}}
+ "tls-hidden4.so"}
}
if {[istarget mips*-*-linux*]} {
diff --git a/ld/testsuite/ld-mips-elf/tls-hidden3.d b/ld/testsuite/ld-mips-elf/tls-hidden3.d
new file mode 100644
index 0000000..6d58686
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/tls-hidden3.d
@@ -0,0 +1,24 @@
+
+.*: file format .*
+
+Disassembly of section \.text:
+
+#
+# The TLS entries are ordered as follows:
+#
+# foo0 (-0x7ff0 + 0x20)
+# foo2 (-0x7ff0 + 0x24)
+# foo3 (-0x7ff0 + 0x28)
+# foo1 (-0x7ff0 + 0x2c)
+#
+# Any order would be acceptable, but it must match the .got dump.
+#
+00080c00 <\.text>:
+ 80c00: 8f848030 lw a0,-32720\(gp\)
+ 80c04: 8f84803c lw a0,-32708\(gp\)
+ 80c08: 8f848034 lw a0,-32716\(gp\)
+ 80c0c: 8f848038 lw a0,-32712\(gp\)
+ 80c10: 8f848030 lw a0,-32720\(gp\)
+ 80c14: 8f84803c lw a0,-32708\(gp\)
+ 80c18: 8f848034 lw a0,-32716\(gp\)
+ 80c1c: 8f848038 lw a0,-32712\(gp\)
diff --git a/ld/testsuite/ld-mips-elf/tls-hidden3.got b/ld/testsuite/ld-mips-elf/tls-hidden3.got
new file mode 100644
index 0000000..8b9c87f
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/tls-hidden3.got
@@ -0,0 +1,24 @@
+
+.*: file format .*
+
+#
+# The GOT layout is:
+#
+# - 2 reserved entries
+# - 5 local page entries
+# - 1 global entry for "undef"
+# - 4 TLS entries
+#
+# The order of the TLS entries is:
+#
+# foo0 (offset 0x20)
+# foo2 (offset 0x24)
+# foo3 (offset 0x28)
+# foo1 (offset 0x2c)
+#
+# Any order would be acceptable, but it must match the .d dump.
+#
+Contents of section \.got:
+ 90000 00000000 80000000 00000000 00000000 .*
+ 90010 00000000 00000000 00000000 00000000 .*
+ 90020 0000abc0 0000abc8 0000abcc 0000abc4 .*
diff --git a/ld/testsuite/ld-mips-elf/tls-hidden3.ld b/ld/testsuite/ld-mips-elf/tls-hidden3.ld
new file mode 100644
index 0000000..b3d0584
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/tls-hidden3.ld
@@ -0,0 +1,31 @@
+SECTIONS
+{
+ . = 0x80000;
+ .interp : { *(.interp) }
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+
+ . = ALIGN (0x400);
+ .rel.dyn : { *(.rel.dyn) }
+
+ . = ALIGN (0x400);
+ .MIPS.stubs : { *(.MIPS.stubs) }
+
+ . = ALIGN (0x400);
+ .text : { *(.text) }
+
+ . = ALIGN (0x10000);
+ _gp = . + 0x7ff0;
+ .got : { *(.got) }
+
+ . = ALIGN (0x400);
+ .tdata : { *(.tdata) }
+
+ /DISCARD/ : { *(.reginfo) }
+}
+
+VERSION
+{
+ { local: *; };
+}
diff --git a/ld/testsuite/ld-mips-elf/tls-hidden3.r b/ld/testsuite/ld-mips-elf/tls-hidden3.r
new file mode 100644
index 0000000..500e7b1
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/tls-hidden3.r
@@ -0,0 +1,13 @@
+
+Relocation section '\.rel\.dyn' at offset .* contains 6 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+00000000 00000000 R_MIPS_NONE
+#
+# The order of the next four entries doesn't matter. The important thing
+# is that there is exactly one entry per GOT TLS slot.
+#
+00090020 0000002f R_MIPS_TLS_TPREL3
+0009002c 0000002f R_MIPS_TLS_TPREL3
+00090024 0000002f R_MIPS_TLS_TPREL3
+00090028 0000002f R_MIPS_TLS_TPREL3
+00090030 .*03 R_MIPS_REL32 00000000 undef
diff --git a/ld/testsuite/ld-mips-elf/tls-hidden3a.s b/ld/testsuite/ld-mips-elf/tls-hidden3a.s
new file mode 100644
index 0000000..d1e6d64
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/tls-hidden3a.s
@@ -0,0 +1,10 @@
+ .macro load
+ lw $4,%gottprel(foo\@)($gp)
+ .endm
+
+ .rept 4
+ load
+ .endr
+
+ .section .tdata,"awT",@progbits
+ .fill 0xabc0
diff --git a/ld/testsuite/ld-mips-elf/tls-hidden3b.s b/ld/testsuite/ld-mips-elf/tls-hidden3b.s
new file mode 100644
index 0000000..0744b07
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/tls-hidden3b.s
@@ -0,0 +1,18 @@
+ .macro load
+ .text
+ lw $4,%gottprel(foo\@)($gp)
+
+ .global foo\@
+ .type foo\@,@object
+ .size foo\@,4
+ .section .tdata,"awT",@progbits
+foo\@:
+ .word \@
+ .endm
+
+ .rept 4
+ load
+ .endr
+
+ .data
+ .word undef
diff --git a/ld/testsuite/ld-mips-elf/tls-hidden4.got b/ld/testsuite/ld-mips-elf/tls-hidden4.got
new file mode 100644
index 0000000..84120c0
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/tls-hidden4.got
@@ -0,0 +1,28 @@
+
+.*: file format .*
+
+Contents of section \.got:
+#
+# The order of the TLS entries in this GOT is:
+#
+# foo2
+# foo3
+# foo0
+# foo1
+#
+# The order and address don't matter; the important thing is that the
+# addresses match the relocs in the .r dump and that there is a separate
+# entry for each symbol.
+#
+#...
+ 1c4080 0000abc8 0000abcc 0000abc0 0000abc4 .*
+#
+# Likewise, but the order of the entries in this GOT is:
+#
+# foo3
+# foo2
+# foo0
+# foo1
+#...
+ 1d00c0 00000000 00000000 00000000 0000abcc .*
+ 1d00d0 0000abc8 0000abc0 0000abc4 .*
diff --git a/ld/testsuite/ld-mips-elf/tls-hidden4.r b/ld/testsuite/ld-mips-elf/tls-hidden4.r
new file mode 100644
index 0000000..f6809b5
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/tls-hidden4.r
@@ -0,0 +1,19 @@
+
+Relocation section '\.rel\.dyn' at offset .* contains .* entries:
+ Offset Info Type Sym\.Value Sym\. Name
+00000000 00000000 R_MIPS_NONE
+#
+# The order and addresses of the next eight entries don't matter. The
+# important thing is that there is exactly one entry per GOT TLS slot
+# and that the addresses match those in the .got dump.
+#
+001d00d4 0000002f R_MIPS_TLS_TPREL3
+001d00d8 0000002f R_MIPS_TLS_TPREL3
+001d00d0 0000002f R_MIPS_TLS_TPREL3
+001d00cc 0000002f R_MIPS_TLS_TPREL3
+001c4088 0000002f R_MIPS_TLS_TPREL3
+001c408c 0000002f R_MIPS_TLS_TPREL3
+001c4080 0000002f R_MIPS_TLS_TPREL3
+001c4084 0000002f R_MIPS_TLS_TPREL3
+.* R_MIPS_REL32 .*
+#pass
diff --git a/ld/testsuite/ld-mips-elf/tls-hidden4a.s b/ld/testsuite/ld-mips-elf/tls-hidden4a.s
new file mode 100644
index 0000000..02a0d35
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/tls-hidden4a.s
@@ -0,0 +1,18 @@
+ .macro load
+ lw $4,%gottprel(foo\@)($gp)
+ .endm
+
+ .rept 4
+ load
+ .endr
+
+ .macro load2
+ lw $4,%got(undefa\@)($gp)
+ .endm
+
+ .rept 0x3000
+ load2
+ .endr
+
+ .section .tdata,"awT",@progbits
+ .fill 0xabc0
diff --git a/ld/testsuite/ld-mips-elf/tls-hidden4b.s b/ld/testsuite/ld-mips-elf/tls-hidden4b.s
new file mode 100644
index 0000000..d6deb00
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/tls-hidden4b.s
@@ -0,0 +1,27 @@
+ .macro load
+ .text
+ lw $4,%gottprel(foo\@)($gp)
+
+ .global foo\@
+ .type foo\@,@object
+ .size foo\@,4
+ .section .tdata,"awT",@progbits
+foo\@:
+ .word \@
+ .endm
+
+ .rept 4
+ load
+ .endr
+
+ .text
+ .macro load2
+ lw $4,%got(undefb\@)($gp)
+ .endm
+
+ .rept 0x3000
+ load2
+ .endr
+
+ .data
+ .word undef