aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2009-08-26 13:35:37 +0000
committerNick Clifton <nickc@redhat.com>2009-08-26 13:35:37 +0000
commite5f2b1de7c60e55d86dab61eaa3750eca33ef367 (patch)
tree4bc2c1e39f020277f9bdd4e5dad6a0580e54ed53 /bfd
parentf7922329bf858a53e75d0affc239ce08bea43fb8 (diff)
downloadgdb-e5f2b1de7c60e55d86dab61eaa3750eca33ef367.zip
gdb-e5f2b1de7c60e55d86dab61eaa3750eca33ef367.tar.gz
gdb-e5f2b1de7c60e55d86dab61eaa3750eca33ef367.tar.bz2
* 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. * 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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog8
-rw-r--r--bfd/elf32-m68k.c24
2 files changed, 32 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index cae2e2f..12966bc 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+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
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index 2957db0..ced19a1 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -2487,6 +2487,10 @@ elf_m68k_copy_indirect_symbol (struct bfd_link_info *info,
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
@@ -2581,6 +2585,14 @@ elf_m68k_check_relocs (abfd, info, sec, relocs)
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)
@@ -2739,6 +2751,10 @@ elf_m68k_check_relocs (abfd, info, sec, relocs)
/* 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
@@ -2946,6 +2962,9 @@ elf_m68k_gc_sweep_hook (bfd *abfd,
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),
@@ -3159,6 +3178,11 @@ elf_m68k_adjust_dynamic_symbol (info, h)
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"),