diff options
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r-- | ld/ldlang.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c index 9d3c513..63326e5 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -5077,11 +5077,20 @@ lang_end (void) struct bfd_link_hash_entry *h; bfd_boolean warn; - if (link_info.relocatable || link_info.shared) + if ((link_info.relocatable && !link_info.gc_sections) + || link_info.shared) warn = entry_from_cmdline; else warn = TRUE; + /* Force the user to specify a root when generating a relocatable with + --gc-sections. */ + if (link_info.gc_sections && link_info.relocatable + && (entry_symbol.name == NULL + && ldlang_undef_chain_list_head == NULL)) + einfo (_("%P%F: gc-sections requires either an entry or " + "an undefined symbol\n")); + if (entry_symbol.name == NULL) { /* No entry has been specified. Look for the default entry, but |