Date: Sat, 12 Oct 2013 16:11:58 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256384 - in stable: 7/contrib/binutils/bfd 8/contrib/binutils/bfd 9/contrib/binutils/bfd Message-ID: <201310121611.r9CGBwKT008790@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Sat Oct 12 16:11:57 2013 New Revision: 256384 URL: http://svnweb.freebsd.org/changeset/base/256384 Log: MFC r255931: Fix a bug in ld, where indirect symbols are not handled properly during linking of a shared library, leading to corrupt indexes in the dynamic symbol table. This should fix the multimedia/ffmpegthumbnailer port. Reported by: swills Modified: stable/9/contrib/binutils/bfd/elflink.c Directory Properties: stable/9/contrib/binutils/ (props changed) Changes in other areas also in this revision: Modified: stable/7/contrib/binutils/bfd/elflink.c stable/8/contrib/binutils/bfd/elflink.c Directory Properties: stable/7/contrib/binutils/ (props changed) stable/8/contrib/binutils/ (props changed) Modified: stable/9/contrib/binutils/bfd/elflink.c ============================================================================== --- stable/9/contrib/binutils/bfd/elflink.c Sat Oct 12 16:03:31 2013 (r256383) +++ stable/9/contrib/binutils/bfd/elflink.c Sat Oct 12 16:11:57 2013 (r256384) @@ -488,12 +488,28 @@ bfd_elf_record_link_assignment (bfd *out if (h->root.u.undef.next != NULL || htab->root.undefs_tail == &h->root) bfd_link_repair_undef_list (&htab->root); } - - if (h->root.type == bfd_link_hash_new) + else if (h->root.type == bfd_link_hash_new) { bfd_elf_link_mark_dynamic_symbol (info, h, NULL); h->non_elf = 0; } + else if (h->root.type == bfd_link_hash_indirect) + { + const struct elf_backend_data *bed = get_elf_backend_data (output_bfd); + struct elf_link_hash_entry *hv = h; + do + hv = (struct elf_link_hash_entry *) hv->root.u.i.link; + while (hv->root.type == bfd_link_hash_indirect + || hv->root.type == bfd_link_hash_warning); + h->root.type = bfd_link_hash_undefined; + hv->root.type = bfd_link_hash_indirect; + hv->root.u.i.link = (struct bfd_link_hash_entry *) h; + (*bed->elf_backend_copy_indirect_symbol) (info, h, hv); + } + else if (h->root.type == bfd_link_hash_warning) + { + abort (); + } /* If this symbol is being provided by the linker script, and it is currently defined by a dynamic object, but not by a regular @@ -1417,10 +1433,10 @@ _bfd_elf_merge_symbol (bfd *abfd, case, we make the versioned symbol point to the normal one. */ const struct elf_backend_data *bed = get_elf_backend_data (abfd); flip->root.type = h->root.type; + flip->root.u.undef.abfd = h->root.u.undef.abfd; h->root.type = bfd_link_hash_indirect; h->root.u.i.link = (struct bfd_link_hash_entry *) flip; (*bed->elf_backend_copy_indirect_symbol) (info, flip, h); - flip->root.u.undef.abfd = h->root.u.undef.abfd; if (h->def_dynamic) { h->def_dynamic = 0;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310121611.r9CGBwKT008790>