diff options
author | Alan Modra <amodra@gmail.com> | 2010-10-28 06:45:33 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2010-10-28 06:45:33 +0000 |
commit | 24898b7032d87189fb709337d3806d629cf0a344 (patch) | |
tree | 2ac304a81cad2b856a579c5b6b412ed0f4776d56 /ld/ldlang.c | |
parent | 47f929815c2345016f4c1c378da0718dfcb9984f (diff) | |
download | gdb-24898b7032d87189fb709337d3806d629cf0a344.zip gdb-24898b7032d87189fb709337d3806d629cf0a344.tar.gz gdb-24898b7032d87189fb709337d3806d629cf0a344.tar.bz2 |
* ldlang.h (ldlang_add_undef): Add cmdline param.
* ldlang.c (undef_from_cmdline): New var.
(ldlang_add_undef): Add cmdline param. Set undef_from_cmdline.
(lang_end): Really require -e or -u from command line on
relocatable --gc-sections.
* ldemul.c (after_parse_default): Adjust ldlang_add_undef call.
* ldgram.y (extern_name_list_body): Likewise.
* lexsup.c (parse_args): Likewise.
* emultempl/aix.em (gld${EMULATION_NAME}_read_file): Likewise.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r-- | ld/ldlang.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c index 2bb2e93..95ef5f5 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -101,6 +101,7 @@ lang_statement_list_type input_file_chain; struct bfd_sym_chain entry_symbol = { NULL, NULL }; const char *entry_section = ".text"; bfd_boolean entry_from_cmdline; +bfd_boolean undef_from_cmdline; bfd_boolean lang_has_input_file = FALSE; bfd_boolean had_output_filename = FALSE; bfd_boolean lang_float_flag = FALSE; @@ -3297,11 +3298,12 @@ typedef struct bfd_sym_chain ldlang_undef_chain_list_type; #define ldlang_undef_chain_list_head entry_symbol.next void -ldlang_add_undef (const char *const name) +ldlang_add_undef (const char *const name, bfd_boolean cmdline) { - ldlang_undef_chain_list_type *new_undef = (ldlang_undef_chain_list_type *) - stat_alloc (sizeof (ldlang_undef_chain_list_type)); + ldlang_undef_chain_list_type *new_undef; + undef_from_cmdline = undef_from_cmdline || cmdline; + new_undef = (ldlang_undef_chain_list_type *) stat_alloc (sizeof (*new_undef)); new_undef->next = ldlang_undef_chain_list_head; ldlang_undef_chain_list_head = new_undef; @@ -5583,8 +5585,7 @@ lang_end (void) /* 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)) + && !(entry_from_cmdline || undef_from_cmdline)) einfo (_("%P%F: gc-sections requires either an entry or " "an undefined symbol\n")); |