From: Andreas Schwab Date: Thu, 26 Apr 2012 14:38:45 +0000 (+0000) Subject: * elf32-m68k.c (elf_m68k_check_relocs): Mark non-GOT references X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cab0ad8332b5c0f3d010d55ff094b08ffd278a88;p=binutils-gdb.git * 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. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 115cd7c0eba..a85cee116f2 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2012-04-26 Andreas Schwab + + * 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. + 2012-04-26 Hans-Peter Nilsson Provide a way for programs to recognize BFD_ASSERT calls. diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 47dece2c4e0..78d7464f427 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; }