aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorfincs <fincs.alt1@gmail.com>2016-12-16 13:42:02 +1030
committerAlan Modra <amodra@gmail.com>2016-12-16 13:49:03 +1030
commit221855059a11ab76aa909a5df4104354f9384139 (patch)
treee1bd030fe42b33167faff27c3df182cc6843054d /bfd
parent4c4067e410581fe5c6190407b4fd410e7b71f9e4 (diff)
downloadgdb-221855059a11ab76aa909a5df4104354f9384139.zip
gdb-221855059a11ab76aa909a5df4104354f9384139.tar.gz
gdb-221855059a11ab76aa909a5df4104354f9384139.tar.bz2
Implement and document --gc-keep-exported
include/ * bfdlink.h (struct bfd_link_info): Add gc_keep_exported. bfd/ * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Add handling for info->gc_keep_exported. (bfd_elf_gc_sections): Likewise. ld/ * ld.texinfo: Document --gc-keep-exported. * ldlex.h (enum option_values): Add OPTION_GC_KEEP_EXPORTED. * lexsup.c (parse_args): Add handling for --gc-keep-exported.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elflink.c3
2 files changed, 8 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 46cb383..8c09c2c 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2016-12-16 fincs <fincs.alt1@gmail.com>
+
+ * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Add handling
+ for info->gc_keep_exported.
+ (bfd_elf_gc_sections): Likewise.
+
2016-12-15 Alan Modra <amodra@gmail.com>
PR ld/20968
diff --git a/bfd/elflink.c b/bfd/elflink.c
index fe6662d..07b7901 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -13051,6 +13051,7 @@ bfd_elf_gc_mark_dynamic_ref_symbol (struct elf_link_hash_entry *h, void *inf)
&& ELF_ST_VISIBILITY (h->other) != STV_INTERNAL
&& ELF_ST_VISIBILITY (h->other) != STV_HIDDEN
&& (!bfd_link_executable (info)
+ || info->gc_keep_exported
|| info->export_dynamic
|| (h->dynamic
&& d != NULL
@@ -13170,7 +13171,7 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
return FALSE;
/* Mark dynamically referenced symbols. */
- if (htab->dynamic_sections_created)
+ if (htab->dynamic_sections_created || info->gc_keep_exported)
elf_link_hash_traverse (htab, bed->gc_mark_dynamic_ref, info);
/* Grovel through relocs to find out who stays ... */