aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-10-19 23:59:11 +1030
committerAlan Modra <amodra@gmail.com>2018-10-20 19:46:43 +1030
commit91ae256e33f7c068443d877fe3e2b2ffd91cf60b (patch)
tree85965f4e1df7829ce26b31475f89ecf6bdca38ad /ld
parentfe19e45ff30986ed0751332b2128c0737efd2838 (diff)
downloadgdb-91ae256e33f7c068443d877fe3e2b2ffd91cf60b.zip
gdb-91ae256e33f7c068443d877fe3e2b2ffd91cf60b.tar.gz
gdb-91ae256e33f7c068443d877fe3e2b2ffd91cf60b.tar.bz2
Relax a -r --gc-sections requirement
A symbol root is not needed if --gc-keep-exported is also given. * ldlang.c (lang_end): Don't error if no --entry or --undefined is given with -r -gc-sections if --gc-keep-exported.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog5
-rw-r--r--ld/ldlang.c6
2 files changed, 9 insertions, 2 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 8f8880e..6a029f8 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2018-10-20 Alan Modra <amodra@gmail.com>
+
+ * ldlang.c (lang_end): Don't error if no --entry or --undefined
+ is given with -r -gc-sections if --gc-keep-exported.
+
2018-10-15 Jim Wilson <jimw@sifive.com>
* emulparams/elf32lriscv-defs.sh (DATA_START_SYMBOLS): New.
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 8d35e0d..d2b297c 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -6383,8 +6383,10 @@ lang_end (void)
warn = TRUE;
/* Force the user to specify a root when generating a relocatable with
- --gc-sections. */
- if (link_info.gc_sections && bfd_link_relocatable (&link_info)
+ --gc-sections, unless --gc-keep-exported was also given. */
+ if (bfd_link_relocatable (&link_info)
+ && link_info.gc_sections
+ && !link_info.gc_keep_exported
&& !(entry_from_cmdline || undef_from_cmdline))
einfo (_("%F%P: gc-sections requires either an entry or "
"an undefined symbol\n"));