aboutsummaryrefslogtreecommitdiff
path: root/ld/ldlang.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2011-09-20 04:58:56 +0000
committerAlan Modra <amodra@gmail.com>2011-09-20 04:58:56 +0000
commit15fc2e131d8effb40f28e922c2d402cccf8c8193 (patch)
treef6083ddf8d733d641263dcd5b02ee6d90c15d5c2 /ld/ldlang.c
parent699d8ed24cdc9a265c9497edd3fcd300abce9424 (diff)
downloadgdb-15fc2e131d8effb40f28e922c2d402cccf8c8193.zip
gdb-15fc2e131d8effb40f28e922c2d402cccf8c8193.tar.gz
gdb-15fc2e131d8effb40f28e922c2d402cccf8c8193.tar.bz2
PR ld/12301
* ldlang.h (lang_input_statement_type): Add "reload" bitfield. Clarify comments. * ldlang.c (new_afile): Init new field. (load_symbols): Don't call ldlang_add_file when reloading. (open_input_bfds): Reload as-needed libs during plugin rescan.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r--ld/ldlang.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 7251a86..ae54155 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -1133,6 +1133,7 @@ new_afile (const char *name,
#ifdef ENABLE_PLUGINS
p->claimed = FALSE;
p->claim_archive = FALSE;
+ p->reload = FALSE;
#endif /* ENABLE_PLUGINS */
lang_statement_append (&input_file_chain,
@@ -2780,7 +2781,10 @@ load_symbols (lang_input_statement_type *entry,
break;
case bfd_object:
- ldlang_add_file (entry);
+#ifdef ENABLE_PLUGINS
+ if (!entry->reload)
+#endif
+ ldlang_add_file (entry);
if (trace_files || trace_file_tries)
info_msg ("%I\n", entry);
break;
@@ -3272,6 +3276,18 @@ open_input_bfds (lang_statement_union_type *s, enum open_bfd_mode mode)
&& bfd_check_format (s->input_statement.the_bfd,
bfd_archive))
s->input_statement.loaded = FALSE;
+#ifdef ENABLE_PLUGINS
+ /* When rescanning, reload --as-needed shared libs. */
+ else if ((mode & OPEN_BFD_RESCAN) != 0
+ && plugin_insert == NULL
+ && s->input_statement.loaded
+ && s->input_statement.add_DT_NEEDED_for_regular
+ && ((s->input_statement.the_bfd->flags) & DYNAMIC) != 0)
+ {
+ s->input_statement.loaded = FALSE;
+ s->input_statement.reload = TRUE;
+ }
+#endif
os_tail = lang_output_section_statement.tail;
lang_list_init (&add);