|
Adam Williamson |
4660e1 |
From f5edd1ac0e79c0356c6a1e2beffcadc0c532be98 Mon Sep 17 00:00:00 2001
|
|
Adam Williamson |
4660e1 |
From: Alan Modra <amodra@bigpond.net.au>
|
|
Adam Williamson |
4660e1 |
Date: Wed, 8 Feb 2012 10:12:19 +0000
|
|
Adam Williamson |
4660e1 |
Subject: [PATCH] * elflink.c (_bfd_elf_gc_mark_rsec): Mark weakdef syms too.
|
|
Adam Williamson |
4660e1 |
(_bfd_elf_fix_symbol_flags): When a weakdef is def_regular, clear
|
|
Adam Williamson |
4660e1 |
the correct h->u.weakdef.
|
|
Adam Williamson |
4660e1 |
|
|
Adam Williamson |
4660e1 |
---
|
|
Adam Williamson |
4660e1 |
bfd/elflink.c | 26 +++++++++++++++-----------
|
|
Adam Williamson |
65d323 |
1 files changed, 15 insertions(+), 11 deletions(-)
|
|
Adam Williamson |
4660e1 |
|
|
Adam Williamson |
4660e1 |
diff --git a/bfd/elflink.c b/bfd/elflink.c
|
|
Adam Williamson |
4660e1 |
index 1d1ca0b..7f9ec60 100644
|
|
Adam Williamson |
4660e1 |
--- a/bfd/elflink.c
|
|
Adam Williamson |
4660e1 |
+++ b/bfd/elflink.c
|
|
Adam Williamson |
4660e1 |
@@ -2510,23 +2510,21 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h,
|
|
Adam Williamson |
4660e1 |
over to the real definition. */
|
|
Adam Williamson |
4660e1 |
if (h->u.weakdef != NULL)
|
|
Adam Williamson |
4660e1 |
{
|
|
Adam Williamson |
4660e1 |
- struct elf_link_hash_entry *weakdef;
|
|
Adam Williamson |
4660e1 |
-
|
|
Adam Williamson |
4660e1 |
- weakdef = h->u.weakdef;
|
|
Adam Williamson |
4660e1 |
- while (h->root.type == bfd_link_hash_indirect)
|
|
Adam Williamson |
4660e1 |
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
|
Adam Williamson |
4660e1 |
-
|
|
Adam Williamson |
4660e1 |
- BFD_ASSERT (h->root.type == bfd_link_hash_defined
|
|
Adam Williamson |
4660e1 |
- || h->root.type == bfd_link_hash_defweak);
|
|
Adam Williamson |
4660e1 |
- BFD_ASSERT (weakdef->def_dynamic);
|
|
Adam Williamson |
4660e1 |
-
|
|
Adam Williamson |
4660e1 |
/* If the real definition is defined by a regular object file,
|
|
Adam Williamson |
4660e1 |
don't do anything special. See the longer description in
|
|
Adam Williamson |
4660e1 |
_bfd_elf_adjust_dynamic_symbol, below. */
|
|
Adam Williamson |
4660e1 |
- if (weakdef->def_regular)
|
|
Adam Williamson |
4660e1 |
+ if (h->u.weakdef->def_regular)
|
|
Adam Williamson |
4660e1 |
h->u.weakdef = NULL;
|
|
Adam Williamson |
4660e1 |
else
|
|
Adam Williamson |
4660e1 |
{
|
|
Adam Williamson |
4660e1 |
+ struct elf_link_hash_entry *weakdef = h->u.weakdef;
|
|
Adam Williamson |
4660e1 |
+
|
|
Adam Williamson |
4660e1 |
+ while (h->root.type == bfd_link_hash_indirect)
|
|
Adam Williamson |
4660e1 |
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
|
Adam Williamson |
4660e1 |
+
|
|
Adam Williamson |
4660e1 |
+ BFD_ASSERT (h->root.type == bfd_link_hash_defined
|
|
Adam Williamson |
4660e1 |
+ || h->root.type == bfd_link_hash_defweak);
|
|
Adam Williamson |
4660e1 |
+ BFD_ASSERT (weakdef->def_dynamic);
|
|
Adam Williamson |
4660e1 |
BFD_ASSERT (weakdef->root.type == bfd_link_hash_defined
|
|
Adam Williamson |
4660e1 |
|| weakdef->root.type == bfd_link_hash_defweak);
|
|
Adam Williamson |
4660e1 |
(*bed->elf_backend_copy_indirect_symbol) (eif->info, weakdef, h);
|
|
Adam Williamson |
4660e1 |
@@ -11575,6 +11573,12 @@ _bfd_elf_gc_mark_rsec (struct bfd_link_info *info, asection *sec,
|
|
Adam Williamson |
4660e1 |
|| h->root.type == bfd_link_hash_warning)
|
|
Adam Williamson |
4660e1 |
h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
|
Adam Williamson |
4660e1 |
h->mark = 1;
|
|
Adam Williamson |
4660e1 |
+ /* If this symbol is weak and there is a non-weak definition, we
|
|
Adam Williamson |
4660e1 |
+ keep the non-weak definition because many backends put
|
|
Adam Williamson |
4660e1 |
+ dynamic reloc info on the non-weak definition for code
|
|
Adam Williamson |
4660e1 |
+ handling copy relocs. */
|
|
Adam Williamson |
4660e1 |
+ if (h->u.weakdef != NULL)
|
|
Adam Williamson |
4660e1 |
+ h->u.weakdef->mark = 1;
|
|
Adam Williamson |
4660e1 |
return (*gc_mark_hook) (sec, info, cookie->rel, h, NULL);
|
|
Adam Williamson |
4660e1 |
}
|
|
Adam Williamson |
4660e1 |
|
|
Adam Williamson |
4660e1 |
--
|
|
Adam Williamson |
4660e1 |
1.7.3.4
|
|
Adam Williamson |
4660e1 |
|
|
Adam Williamson |
4660e1 |
|