aboutsummaryrefslogtreecommitdiff
path: root/ld/plugin.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2013-02-16 17:54:37 +0000
committerH.J. Lu <hjl.tools@gmail.com>2013-02-16 17:54:37 +0000
commit3d5bef4c0871514cd0430d5316dfe256329aaa4b (patch)
treee0e0e2dc86d9c3ee0306ad74a168b886302b7a90 /ld/plugin.c
parent4a2b04a7e5b5cab4c31cfc4a753e6bff6fe0b349 (diff)
downloadgdb-3d5bef4c0871514cd0430d5316dfe256329aaa4b.zip
gdb-3d5bef4c0871514cd0430d5316dfe256329aaa4b.tar.gz
gdb-3d5bef4c0871514cd0430d5316dfe256329aaa4b.tar.bz2
Don't add DT_NEEDED for references from the dummy bfd
bfd/ PR ld/15146 * elflink.c (elf_link_add_object_symbols): Don't add DT_NEEDED for references from the dummy bfd. ld/ PR ld/15146 * plugin.c (plugin_notice): Replace the undefined dummy bfd with the real one. ld/testsuite/ PR ld/15146 * ld-plugin/pr15146.d: New file. * ld-plugin/pr15146a.c: Likewise. * ld-plugin/pr15146b.c: Likewise. * ld-plugin/pr15146c.c: Likewise. * ld-plugin/pr15146d.c: Likewise. * ld-plugin/lto.exp: Add tests for PR ld/15146.
Diffstat (limited to 'ld/plugin.c')
-rw-r--r--ld/plugin.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ld/plugin.c b/ld/plugin.c
index 435f466..d880164 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -993,7 +993,14 @@ plugin_notice (struct bfd_link_info *info,
/* If this is a ref, set non_ir_ref. */
else if (bfd_is_und_section (section))
- h->non_ir_ref = TRUE;
+ {
+ /* Replace the undefined dummy bfd with the real one. */
+ if ((h->type == bfd_link_hash_undefined
+ || h->type == bfd_link_hash_undefweak)
+ && (h->u.undef.abfd->flags & BFD_PLUGIN) != 0)
+ h->u.undef.abfd = abfd;
+ h->non_ir_ref = TRUE;
+ }
/* Otherwise, it must be a new def. Ensure any symbol defined
in an IR dummy BFD takes on a new value from a real BFD.