aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-m68k.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2012-04-26 14:38:45 +0000
committerAndreas Schwab <schwab@linux-m68k.org>2012-04-26 14:38:45 +0000
commitcab0ad8332b5c0f3d010d55ff094b08ffd278a88 (patch)
treeb66d1cd60503393efaa98ee8d6f41e6d68a0a2ee /bfd/elf32-m68k.c
parentd7ebd843562ed7f9836c353e4b9423ef1607ecb4 (diff)
downloadgdb-cab0ad8332b5c0f3d010d55ff094b08ffd278a88.zip
gdb-cab0ad8332b5c0f3d010d55ff094b08ffd278a88.tar.gz
gdb-cab0ad8332b5c0f3d010d55ff094b08ffd278a88.tar.bz2
* elf32-m68k.c (elf_m68k_check_relocs): Mark non-GOT references
also when generating PIE. (elf_m68k_discard_copies): Mark undefined weak symbols referenced by relocations as dynamic.
Diffstat (limited to 'bfd/elf32-m68k.c')
-rw-r--r--bfd/elf32-m68k.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index 47dece2..78d7464 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -2827,7 +2827,7 @@ elf_m68k_check_relocs (abfd, info, sec, relocs)
turns out to be a function defined by a dynamic object. */
h->plt.refcount++;
- if (!info->shared)
+ if (info->executable)
/* This symbol needs a non-GOT reference. */
h->non_got_ref = 1;
}
@@ -3479,6 +3479,18 @@ elf_m68k_discard_copies (h, inf)
}
}
+ /* Make sure undefined weak symbols are output as a dynamic symbol
+ in PIEs. */
+ if (h->non_got_ref
+ && h->root.type == bfd_link_hash_undefweak
+ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ && h->dynindx == -1
+ && !h->forced_local)
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+ }
+
return TRUE;
}