value.
(elf_m68k_check_relocs): Handle dynamic TLS relocations.
Handle non_got_ref field.
(elf_m68k_adjust_dynamic_symbol): Handle non_got_ref field.
* tls-def-1.s, tls-def-1.d, tls-gd-1.d2, tls-gd-1.d3, tls-main-1.s,
* tls-main-1.d: New files.
* m68k.exp: Run new TLS tests.
+2009-08-26 Maxim Kuvyrkov <maxim@codesourcery.com>
+
+ * elf32-m68k.c (elf_m68k_copy_indirect_symbol): Propagate
+ non_got_ref value.
+ (elf_m68k_check_relocs): Handle dynamic TLS relocations.
+ Handle non_got_ref field.
+ (elf_m68k_adjust_dynamic_symbol): Handle non_got_ref field.
+
2009-08-26 Alan Modra <amodra@bigpond.net.au>
PR ld/10515
dir = elf_m68k_hash_entry (_dir);
ind = elf_m68k_hash_entry (_ind);
+ /* Any absolute non-dynamic relocations against an indirect or weak
+ definition will be against the target symbol. */
+ _dir->non_got_ref |= _ind->non_got_ref;
+
/* We might have a direct symbol already having entries in the GOTs.
Update its key only in case indirect symbol has GOT entries and
assert that both indirect and direct symbols don't have GOT entries
case R_68K_TLS_IE16:
case R_68K_TLS_IE32:
+ case R_68K_TLS_TPREL32:
+ case R_68K_TLS_DTPREL32:
+
+ if (ELF32_R_TYPE (rel->r_info) == R_68K_TLS_TPREL32
+ && info->shared)
+ /* Do the special chorus for libraries with static TLS. */
+ info->flags |= DF_STATIC_TLS;
+
/* This symbol requires a global offset table entry. */
if (dynobj == NULL)
/* Make sure a plt entry is created for this symbol if it
turns out to be a function defined by a dynamic object. */
h->plt.refcount++;
+
+ if (!info->shared)
+ /* This symbol needs a non-GOT reference. */
+ h->non_got_ref = 1;
}
/* If we are creating a shared library, we need to copy the
case R_68K_TLS_IE16:
case R_68K_TLS_IE32:
+ case R_68K_TLS_TPREL32:
+ case R_68K_TLS_DTPREL32:
+
if (got == NULL)
{
got = elf_m68k_get_bfd2got_entry (elf_m68k_multi_got (info),
if (info->shared)
return TRUE;
+ /* If there are no references to this symbol that do not use the
+ GOT, we don't need to generate a copy reloc. */
+ if (!h->non_got_ref)
+ return TRUE;
+
if (h->size == 0)
{
(*_bfd_error_handler) (_("dynamic variable `%s' is zero size"),
+2009-08-26 Maxim Kuvyrkov <maxim@codesourcery.com>
+
+ * ld-m68k/tls-def-1.s: New file.
+ * ld-m68k/tls-def-1.d: New file.
+ * ld-m68k/tls-gd-1.d2: New file.
+ * ld-m68k/tls-gd-1.d3: New file.
+ * ld-m68k/tls-main-1.s: New file.
+ * ld-m68k/tls-main-1.d: New file.
+ * ld-m68k/m68k.exp: Run new TLS tests.
+
2009-08-23 Andreas Schwab <schwab@linux-m68k.org>
* ld-powerpc/powerpc.exp: Move relaxing and relocatable relaxing
# Expect script for run_dump_test based ld-m68k tests.
-# Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
+# Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
run_dump_test "tls-ie-1"
run_dump_test "tls-ld-1"
run_dump_test "tls-ld-2"
+
+ set m68k_tls_tests {
+ {"TLS definition"
+ "-shared" "" {tls-def-1.s}
+ {{nm -ngD tls-def-1.d}}
+ "tls-def-1.so"}
+ {"TLS direct symbol use"
+ "-shared tmpdir/tls-def-1.so" "" {tls-gd-1.s}
+ {{nm -ngD tls-gd-1.d2} {readelf -d tls-gd-1.d3}}
+ "tls-gd-1.so"}
+ {"TLS indirect symbol use"
+ "tmpdir/tls-gd-1.so -rpath-link ./" "" {tls-main-1.s}
+ {{readelf -d tls-main-1.d}}
+ "tls-main-1"}}
+
+ run_ld_link_tests $m68k_tls_tests
}
--- /dev/null
+00000000 B x
+.*
+.*
+.*
--- /dev/null
+#NO_APP
+ .globl x
+ .section .tbss,"awT",@nobits
+ .align 2
+ .type x, @object
+ .size x, 4
+x:
+ .zero 4
+ .section .note.GNU-stack,"",@progbits
--- /dev/null
+.* U x
+.*
+.*
+.*
+.*
--- /dev/null
+
+Dynamic section at offset .* contains .*:
+ * Tag * Type * Name/Value
+ 0x00000001 \(NEEDED\) * Shared library: \[tmpdir/tls-def-1.so\]
+ 0x00000004 \(HASH\) .*
+ 0x00000005 \(STRTAB\) .*
+ 0x00000006 \(SYMTAB\) .*
+ 0x0000000a \(STRSZ\) .*
+ 0x0000000b \(SYMENT\) .*
+ 0x00000007 \(RELA\) .*
+ 0x00000008 \(RELASZ\) .*
+ 0x00000009 \(RELAENT\) .*
+ 0x00000000 \(NULL\) .*
--- /dev/null
+
+Dynamic section at offset .* contains .*:
+ * Tag * Type * Name/Value
+ 0x00000001 \(NEEDED\) * Shared library: \[tmpdir/tls-gd-1.so\]
+ 0x00000001 \(NEEDED\) * Shared library: \[tls-def-1.so\]
+ 0x00000004 \(HASH\) .*
+ 0x00000005 \(STRTAB\) .*
+ 0x00000006 \(SYMTAB\) .*
+ 0x0000000a \(STRSZ\) .*
+ 0x0000000b \(SYMENT\) .*
+ 0x00000015 \(DEBUG\) .*
+ 0x00000007 \(RELA\) .*
+ 0x00000008 \(RELASZ\) .*
+ 0x00000009 \(RELAENT\) .*
+ 0x00000000 \(NULL\) .*
--- /dev/null
+#NO_APP
+ .text
+ .align 2
+ .globl main
+ .type main, @function
+ .globl _start
+ .type _start, @function
+main:
+_start:
+ link.w %fp,#0
+ move.l %a5,-(%sp)
+ move.l #_GLOBAL_OFFSET_TABLE_@GOTPC, %a5
+ lea (-6, %pc, %a5), %a5
+ move.l x@TLSIE(%a5),%a0
+ move.l -4(%fp),%a5
+ unlk %fp
+ rts
+ .size main, .-main
+ .section .note.GNU-stack,"",@progbits