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 | |
parent | 47f929815c2345016f4c1c378da0718dfcb9984f (diff) | |
download | binutils-24898b7032d87189fb709337d3806d629cf0a344.zip binutils-24898b7032d87189fb709337d3806d629cf0a344.tar.gz binutils-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')
-rw-r--r-- | ld/ChangeLog | 12 | ||||
-rw-r--r-- | ld/emultempl/aix.em | 2 | ||||
-rw-r--r-- | ld/ldemul.c | 2 | ||||
-rw-r--r-- | ld/ldgram.y | 6 | ||||
-rw-r--r-- | ld/ldlang.c | 11 | ||||
-rw-r--r-- | ld/ldlang.h | 2 | ||||
-rw-r--r-- | ld/lexsup.c | 2 |
7 files changed, 25 insertions, 12 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index a82f4d7..650e0a7 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,15 @@ +2010-10-28 Alan Modra <amodra@gmail.com> + + * 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. + 2010-10-25 Alan Modra <amodra@gmail.com> * plugin.c (plugin_get_ir_dummy_bfd): Set bfd_use_reserved_id. diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em index 497f51d..4dc36c3 100644 --- a/ld/emultempl/aix.em +++ b/ld/emultempl/aix.em @@ -1193,7 +1193,7 @@ gld${EMULATION_NAME}_read_file (const char *filename, bfd_boolean import) { struct export_symbol_list *n; - ldlang_add_undef (symname); + ldlang_add_undef (symname, TRUE); n = ((struct export_symbol_list *) xmalloc (sizeof (struct export_symbol_list))); n->next = export_symbols; diff --git a/ld/ldemul.c b/ld/ldemul.c index c77eeb0..f1f3979 100644 --- a/ld/ldemul.c +++ b/ld/ldemul.c @@ -219,7 +219,7 @@ after_parse_default (void) is_vma = *send == '\0'; } if (!is_vma) - ldlang_add_undef (entry_symbol.name); + ldlang_add_undef (entry_symbol.name, entry_from_cmdline); } } diff --git a/ld/ldgram.y b/ld/ldgram.y index 49d9ff1..69a84c7 100644 --- a/ld/ldgram.y +++ b/ld/ldgram.y @@ -287,11 +287,11 @@ extern_name_list: extern_name_list_body: NAME - { ldlang_add_undef ($1); } + { ldlang_add_undef ($1, FALSE); } | extern_name_list_body NAME - { ldlang_add_undef ($2); } + { ldlang_add_undef ($2, FALSE); } | extern_name_list_body ',' NAME - { ldlang_add_undef ($3); } + { ldlang_add_undef ($3, FALSE); } ; script_file: 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")); diff --git a/ld/ldlang.h b/ld/ldlang.h index f89eb53..0b7b43b 100644 --- a/ld/ldlang.h +++ b/ld/ldlang.h @@ -568,7 +568,7 @@ extern lang_output_section_statement_type *lang_output_section_statement_lookup extern lang_output_section_statement_type *next_matching_output_section_statement (lang_output_section_statement_type *, int); extern void ldlang_add_undef - (const char *const); + (const char *const, bfd_boolean); extern void lang_add_output_format (const char *, const char *, const char *, int); extern void lang_list_init diff --git a/ld/lexsup.c b/ld/lexsup.c index 0c44151..39ca326 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -1307,7 +1307,7 @@ parse_args (unsigned argc, char **argv) config.dynamic_link = FALSE; break; case 'u': - ldlang_add_undef (optarg); + ldlang_add_undef (optarg, TRUE); break; case OPTION_UNIQUE: if (optarg != NULL) |