From 6efca8892eb7245f3b7aa55d6edda2bee256209f Mon Sep 17 00:00:00 2001 From: amodra Date: Fri, 15 Apr 2011 03:47:30 +0000 Subject: [PATCH] PR ld/12672 * ldlang.c (enum open_bfd_mode): New. (open_input_bfds): Replace "force" param with "mode". Reload archives for rescan. Update all callers. (lang_process): Make another open_input_bfds pass for plugins. --- ld/ChangeLog | 17 +++++++++++++++++ ld/ldlang.c | 31 +++++++++++++++++++++---------- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 855912da8d..5939efcd9f 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,11 @@ +2011-04-15 Alan Modra + + PR ld/12672 + * ldlang.c (enum open_bfd_mode): New. + (open_input_bfds): Replace "force" param with "mode". Reload + archives for rescan. Update all callers. + (lang_process): Make another open_input_bfds pass for plugins. + 2011-04-13 Kai Tietz PR binutils/12658 @@ -228,6 +236,15 @@ 2011-02-14 Alan Modra + * plugin.c (plugin_get_ir_dummy_bfd): Set SEC_EXCLUDE on dummy + .text section, use newer bfd_make_section variant. Error handling. + Correct setting of gp size. + (asymbol_from_plugin_symbol): Properly cast last arg of concat. + (message): Likewise for ACONCAT. + (get_symbols): Formatting. + +2011-02-14 Alan Modra + * ldmain.c (remove_output): Rename to.. (ld_cleanup): ..this. Call bfd_cache_close_all and plugin_call_cleanup. (main): Adjust. diff --git a/ld/ldlang.c b/ld/ldlang.c index 76b02f4766..08bfa60f69 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -3174,26 +3174,34 @@ init_opb (void) /* Open all the input files. */ +enum open_bfd_mode + { + OPEN_BFD_NORMAL = 0, + OPEN_BFD_FORCE = 1, + OPEN_BFD_RESCAN = 2 + }; + static void -open_input_bfds (lang_statement_union_type *s, bfd_boolean force) +open_input_bfds (lang_statement_union_type *s, enum open_bfd_mode mode) { for (; s != NULL; s = s->header.next) { switch (s->header.type) { case lang_constructors_statement_enum: - open_input_bfds (constructor_list.head, force); + open_input_bfds (constructor_list.head, mode); break; case lang_output_section_statement_enum: - open_input_bfds (s->output_section_statement.children.head, force); + open_input_bfds (s->output_section_statement.children.head, mode); break; case lang_wild_statement_enum: /* Maybe we should load the file's symbols. */ - if (s->wild_statement.filename + if ((mode & OPEN_BFD_RESCAN) == 0 + && s->wild_statement.filename && !wildcardp (s->wild_statement.filename) && !archive_path (s->wild_statement.filename)) lookup_name (s->wild_statement.filename); - open_input_bfds (s->wild_statement.children.head, force); + open_input_bfds (s->wild_statement.children.head, mode); break; case lang_group_statement_enum: { @@ -3206,7 +3214,8 @@ open_input_bfds (lang_statement_union_type *s, bfd_boolean force) do { undefs = link_info.hash->undefs_tail; - open_input_bfds (s->group_statement.children.head, TRUE); + open_input_bfds (s->group_statement.children.head, + mode | OPEN_BFD_FORCE); } while (undefs != link_info.hash->undefs_tail); } @@ -3225,8 +3234,8 @@ open_input_bfds (lang_statement_union_type *s, bfd_boolean force) /* If we are being called from within a group, and this is an archive which has already been searched, then force it to be researched unless the whole archive - has been loaded already. */ - if (force + has been loaded already. Do the same for a rescan. */ + if (mode != OPEN_BFD_NORMAL && !s->input_statement.whole_archive && s->input_statement.loaded && bfd_check_format (s->input_statement.the_bfd, @@ -6468,7 +6477,7 @@ lang_process (void) /* Create a bfd for each input file. */ current_target = default_target; - open_input_bfds (statement_list.head, FALSE); + open_input_bfds (statement_list.head, OPEN_BFD_NORMAL); #ifdef ENABLE_PLUGINS if (plugin_active_plugins_p ()) @@ -6489,7 +6498,7 @@ lang_process (void) einfo (_("%P%F: %s: plugin reported error after all symbols read\n"), plugin_error_plugin ()); /* Open any newly added files, updating the file chains. */ - open_input_bfds (added.head, FALSE); + open_input_bfds (added.head, OPEN_BFD_NORMAL); /* Restore the global list pointer now they have all been added. */ lang_list_remove_tail (stat_ptr, &added); /* And detach the fresh ends of the file lists. */ @@ -6519,6 +6528,8 @@ lang_process (void) else lang_list_insert_after (&file_chain, &files, &file_chain.head); } + /* Rescan any archives in case new undefined symbols have appeared. */ + open_input_bfds (statement_list.head, OPEN_BFD_RESCAN); } #endif /* ENABLE_PLUGINS */ -- 2.11.0