aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2011-10-25 03:15:08 +0000
committerAlan Modra <amodra@gmail.com>2011-10-25 03:15:08 +0000
commit360d96edba17ed0c14362ce176f97d1a03edf852 (patch)
treea7a3d0e810425b8d5e217dfa8c98a8379bc2fe60
parent167da4061fbc8f0e9e3f6305a81606b38fd35487 (diff)
downloadgdb-360d96edba17ed0c14362ce176f97d1a03edf852.zip
gdb-360d96edba17ed0c14362ce176f97d1a03edf852.tar.gz
gdb-360d96edba17ed0c14362ce176f97d1a03edf852.tar.bz2
PR ld/13287
2011-10-20 Alan Modra <amodra@gmail.com> * plugin.c (plugin_should_reload): New function. * plugin.h (plugin_should_reload): Declare. * ldlang.c (open_input_bfds): Use above function.
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/ldlang.c3
-rw-r--r--ld/plugin.c11
-rw-r--r--ld/plugin.h3
4 files changed, 22 insertions, 1 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 3c1802d..66b2b73 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,6 +1,12 @@
2011-10-25 Alan Modra <amodra@gmail.com>
Apply mainline patches
+ 2011-10-20 Alan Modra <amodra@gmail.com>
+ PR ld/13287
+ * plugin.c (plugin_should_reload): New function.
+ * plugin.h (plugin_should_reload): Declare.
+ * ldlang.c (open_input_bfds): Use above function.
+
2011-10-19 Alan Modra <amodra@gmail.com>
PR ld/13254
* emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Add
diff --git a/ld/ldlang.c b/ld/ldlang.c
index ae54155..2c56b56 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -3282,7 +3282,8 @@ open_input_bfds (lang_statement_union_type *s, enum open_bfd_mode mode)
&& 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.the_bfd->flags) & DYNAMIC) != 0
+ && plugin_should_reload (s->input_statement.the_bfd))
{
s->input_statement.loaded = FALSE;
s->input_statement.reload = TRUE;
diff --git a/ld/plugin.c b/ld/plugin.c
index 5f4aa8f..91fe48b 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -1014,3 +1014,14 @@ plugin_notice (struct bfd_link_info *info,
abfd, section, value, flags, string);
return TRUE;
}
+
+/* Return true if bfd is a dynamic library that should be reloaded. */
+
+bfd_boolean
+plugin_should_reload (bfd *abfd)
+{
+ return ((abfd->flags & DYNAMIC) != 0
+ && bfd_get_flavour (abfd) == bfd_target_elf_flavour
+ && bfd_get_format (abfd) == bfd_object
+ && (elf_dyn_lib_class (abfd) & DYN_AS_NEEDED) != 0);
+}
diff --git a/ld/plugin.h b/ld/plugin.h
index ee29b7c..dc32295 100644
--- a/ld/plugin.h
+++ b/ld/plugin.h
@@ -66,4 +66,7 @@ extern void plugin_call_cleanup (void);
add_symbols hook has been called so that it can be read when linking. */
extern bfd *plugin_get_ir_dummy_bfd (const char *name, bfd *template);
+/* Return true if bfd is a dynamic library that should be reloaded. */
+extern bfd_boolean plugin_should_reload (bfd *);
+
#endif /* !def GLD_PLUGIN_H */