aboutsummaryrefslogtreecommitdiff
path: root/ld/plugin.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2014-07-03 16:32:45 +0930
committerAlan Modra <amodra@gmail.com>2014-07-03 17:05:42 +0930
commitd215621ebe5a6b60dff2e60c788a0f761e3cb5bd (patch)
treeeb5c641bf87b201f435e3cc6d0d753a7410ceab0 /ld/plugin.c
parentfd48cee0093fef69608959d0f577c0c81fe24eec (diff)
downloadgdb-d215621ebe5a6b60dff2e60c788a0f761e3cb5bd.zip
gdb-d215621ebe5a6b60dff2e60c788a0f761e3cb5bd.tar.gz
gdb-d215621ebe5a6b60dff2e60c788a0f761e3cb5bd.tar.bz2
Reload --as-needed libraries inside groups
When a shared library appears within --start-group/--end-group ld may only discover a need for loading the library on the second or subsequent pass over archive libraries, as more objects are extracted. ld/ PR 17068 * ldlang.c (load_symbols): Always check flags.reload. (open_input_bfds): Always reload --as-needed shared libraries, not just when rescanning. * ldlang.h (struct lang_input_statement_flags): Update reload comment. * plugin.c (plugin_should_reload): Assume shared library arg. * plugin.h (plugin_should_reload): Update comment. ld/testsuite * ld-elf/pr17068.s: New. * ld-elf/pr17068a.s: New. * ld-elf/pr17068b.s: New. * ld-elf/pr17068c.s: New. * ld-elf/pr17068d.s: New. * ld-elf/pr17068e.s: New. * ld-elf/pr17068ez.s: New. * ld-elf/elf.exp: Run new test.
Diffstat (limited to 'ld/plugin.c')
-rw-r--r--ld/plugin.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/ld/plugin.c b/ld/plugin.c
index 2a6d7c5..cd6ae60 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -1029,13 +1029,11 @@ plugin_notice (struct bfd_link_info *info,
return TRUE;
}
-/* Return true if bfd is a dynamic library that should be reloaded. */
+/* Return true if ABFD, a dynamic library, 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
+ return (bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& (elf_dyn_lib_class (abfd) & DYN_AS_NEEDED) != 0);
}