From 4005427f8676ad78c88b430fa25e1d179207cbf4 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Sat, 4 Feb 2006 08:29:58 +0000 Subject: [PATCH] bfd/ * elfxx-mips.c (mips_elf_initialize_tls_index): If a TLS symbol has already been assigned a GOT index, copy that index to the current hash table entry. ld/testsuite/ * ld-mips-elf/tls-hidden2a.s, ld-mips-elf/tls-hidden2b.s, * ld/testsuite/ld-mips-elf/tls-hidden2.d, * ld/testsuite/ld-mips-elf/tls-hidden2-got.d: New test. * ld-mips-elf/mips-elf.exp: Run it. --- bfd/ChangeLog | 6 ++++++ bfd/elfxx-mips.c | 5 ++++- ld/testsuite/ChangeLog | 7 +++++++ ld/testsuite/ld-mips-elf/mips-elf.exp | 5 +++++ ld/testsuite/ld-mips-elf/tls-hidden2-got.d | 6 ++++++ ld/testsuite/ld-mips-elf/tls-hidden2.d | 10 ++++++++++ ld/testsuite/ld-mips-elf/tls-hidden2a.s | 11 +++++++++++ ld/testsuite/ld-mips-elf/tls-hidden2b.s | 2 ++ 8 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 ld/testsuite/ld-mips-elf/tls-hidden2-got.d create mode 100644 ld/testsuite/ld-mips-elf/tls-hidden2.d create mode 100644 ld/testsuite/ld-mips-elf/tls-hidden2a.s create mode 100644 ld/testsuite/ld-mips-elf/tls-hidden2b.s diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 5bd1e341ac0..f2ca17dcf48 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2006-02-04 Richard Sandiford + + * elfxx-mips.c (mips_elf_initialize_tls_index): If a TLS symbol + has already been assigned a GOT index, copy that index to the + current hash table entry. + 2006-02-01 Eric Botcazou * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Reinstate bypass diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 99a0def3b9d..2675ee08a10 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -2994,7 +2994,10 @@ mips_elf_initialize_tls_index (void **entryp, void *p) if (g->next == NULL) { if (entry->d.h->tls_type & GOT_TLS_OFFSET_DONE) - return 1; + { + entry->gotidx = entry->d.h->tls_got_offset; + return 1; + } entry->d.h->tls_type |= GOT_TLS_OFFSET_DONE; } } diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index ac9aaddef4d..f7e13cdf4fe 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2006-02-04 Richard Sandiford + + * ld-mips-elf/tls-hidden2a.s, ld-mips-elf/tls-hidden2b.s, + * ld/testsuite/ld-mips-elf/tls-hidden2.d, + * ld/testsuite/ld-mips-elf/tls-hidden2-got.d: New test. + * ld-mips-elf/mips-elf.exp: Run it. + 2006-02-04 Richard Sandiford * ld-mips-elf/rel32-n32.d: Adjust for changes in linker behaviour. diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp index 81f24b86761..da278ae452e 100644 --- a/ld/testsuite/ld-mips-elf/mips-elf.exp +++ b/ld/testsuite/ld-mips-elf/mips-elf.exp @@ -162,6 +162,11 @@ set mips_tls_tests { "-EB -march=mips1 -32 -KPIC" {tlslib-o32.s} {{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32-hidden.got}} "tlslib-o32-hidden.so"} + {"Shared library with TLS and hidden symbols (2)" + "-shared -melf32btsmip -T mips-lib.ld" + "-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"} } if {[istarget mips*-*-linux*]} { diff --git a/ld/testsuite/ld-mips-elf/tls-hidden2-got.d b/ld/testsuite/ld-mips-elf/tls-hidden2-got.d new file mode 100644 index 00000000000..69c0982950e --- /dev/null +++ b/ld/testsuite/ld-mips-elf/tls-hidden2-got.d @@ -0,0 +1,6 @@ + +.*file format.* + +Contents of section \.got: + *[0-9a-f]* 00000000 80000000 00000000 00000000 *\..* + *[0-9a-f]* 00000000 00000000 00000000 00000ba8 *\..* diff --git a/ld/testsuite/ld-mips-elf/tls-hidden2.d b/ld/testsuite/ld-mips-elf/tls-hidden2.d new file mode 100644 index 00000000000..e6322ca8a7f --- /dev/null +++ b/ld/testsuite/ld-mips-elf/tls-hidden2.d @@ -0,0 +1,10 @@ + +.*file format.* + +Disassembly of section \.text: + +.* <.*>: +.*: 8f82802c * lw v0,-32724\(gp\) + \.\.\. +.*: 8f82802c * lw v0,-32724\(gp\) + \.\.\. diff --git a/ld/testsuite/ld-mips-elf/tls-hidden2a.s b/ld/testsuite/ld-mips-elf/tls-hidden2a.s new file mode 100644 index 00000000000..91a0b9e5730 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/tls-hidden2a.s @@ -0,0 +1,11 @@ + .text + lw $2,%gottprel(tls_hidden)($28) + + .section .tdata,"awT" + .globl tls_hidden + .hidden tls_hidden + .type tls_hidden,@object + .size tls_hidden,4 + .space 0xba8 +tls_hidden: + .word 1 diff --git a/ld/testsuite/ld-mips-elf/tls-hidden2b.s b/ld/testsuite/ld-mips-elf/tls-hidden2b.s new file mode 100644 index 00000000000..6a8e190a9a9 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/tls-hidden2b.s @@ -0,0 +1,2 @@ + .text + lw $2,%gottprel(tls_hidden)($28)