aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 2560104..9ccf37d 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -11689,13 +11689,18 @@ struct elf_gc_sweep_symbol_info
static bfd_boolean
elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *data)
{
- if ((h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && !h->root.u.def.section->gc_mark
- && !(h->root.u.def.section->owner->flags & DYNAMIC))
+ if (((h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && !h->root.u.def.section->gc_mark
+ && (!(h->root.u.def.section->owner->flags & DYNAMIC)
+ || (h->plt.refcount <= 0
+ && h->got.refcount <= 0)))
+ || (h->root.type == bfd_link_hash_undefined
+ && h->plt.refcount <= 0
+ && h->got.refcount <= 0))
{
struct elf_gc_sweep_symbol_info *inf =
- (struct elf_gc_sweep_symbol_info *) data;
+ (struct elf_gc_sweep_symbol_info *) data;
(*inf->hide_symbol) (inf->info, h, TRUE);
}