aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2011-09-16 01:17:16 +0000
committerH.J. Lu <hjl.tools@gmail.com>2011-09-16 01:17:16 +0000
commit1a766c6843ce0005fee23633b3b30c98e81a7b07 (patch)
treeedbea425f1029e549fe635c8ce82f666dc6ef977 /bfd
parentfd91d41947667d30f47b06c45cc57d4b4fcefade (diff)
downloadgdb-1a766c6843ce0005fee23633b3b30c98e81a7b07.zip
gdb-1a766c6843ce0005fee23633b3b30c98e81a7b07.tar.gz
gdb-1a766c6843ce0005fee23633b3b30c98e81a7b07.tar.bz2
Also hide symbols without PLT nor GOT references.
bfd/ 2011-09-15 H.J. Lu <hongjiu.lu@intel.com> PR ld/13177 * elflink.c (elf_gc_sweep_symbol): Also hide symbols without PLT nor GOT references. ld/testsuite/ 2011-09-15 H.J. Lu <hongjiu.lu@intel.com> PR ld/13177 * ld-elf/pr13177.d: New. * ld-elf/pr13177.s: Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elflink.c15
2 files changed, 16 insertions, 5 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b063de9..3521289 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
2011-09-15 H.J. Lu <hongjiu.lu@intel.com>
+ PR ld/13177
+ * elflink.c (elf_gc_sweep_symbol): Also hide symbols without PLT
+ nor GOT references.
+
+2011-09-15 H.J. Lu <hongjiu.lu@intel.com>
+
PR ld/12975
* bfd-in.h (bfd_elf_size_dynamic_sections): Remove pointer
to struct bfd_elf_version_tree.
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);
}