This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] sparc: Prevent all but undef weak syms from becoming dynamic.
- From: Egeyar Bagcioglu <egeyar dot bagcioglu at oracle dot com>
- To: binutils at sourceware dot org
- Date: Tue, 30 May 2017 19:31:51 -0700
- Subject: [PATCH] sparc: Prevent all but undef weak syms from becoming dynamic.
- Authentication-results: sourceware.org; auth=none
Prevent sparc backend making symbols dynamic unless they are undefined
weak. By doing so, stop dynamic linker confusing these symbols with
library symbols.
bfd/ChangeLog:
2017-05-19 Egeyar Bagcioglu <egeyar.bagcioglu@oracle.com>
* elfxx-sparc.c (allocate_dynrelocs): If a symbol isn't undefined
weak symbol, don't make it dynamic.
---
bfd/elfxx-sparc.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c
index a9362a3..79746b7 100644
--- a/bfd/elfxx-sparc.c
+++ b/bfd/elfxx-sparc.c
@@ -2310,7 +2310,8 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
&& !h->forced_local
- && !resolved_to_zero)
+ && !resolved_to_zero
+ && h->root.type == bfd_link_hash_undefweak)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
@@ -2422,7 +2423,8 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
&& !h->forced_local
- && !resolved_to_zero)
+ && !resolved_to_zero
+ && h->root.type == bfd_link_hash_undefweak)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
@@ -2564,7 +2566,8 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
&& !h->forced_local
- && !resolved_to_zero)
+ && !resolved_to_zero
+ && h->root.type == bfd_link_hash_undefweak)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
--
1.7.1