From 000458d5b04ef11d19dbc5eda3f33eaba3fa3a71 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sat, 16 Feb 2013 17:54:35 +0000 Subject: 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. --- bfd/elflink.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'bfd/elflink.c') diff --git a/bfd/elflink.c b/bfd/elflink.c index 1a45110597..617c505ffb 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -4480,10 +4480,13 @@ error_free_dyn: break; } + /* Don't add DT_NEEDED for references from the dummy bfd. */ if (!add_needed && definition && ((dynsym - && h->ref_regular) + && h->ref_regular + && (undef_bfd == NULL + || (undef_bfd->flags & BFD_PLUGIN) == 0)) || (h->ref_dynamic && (elf_dyn_lib_class (abfd) & DYN_AS_NEEDED) != 0 && !on_needed_list (elf_dt_name (abfd), htab->needed)))) -- cgit v1.2.1