From owner-svn-src-all@FreeBSD.ORG Sat Sep 28 23:03:41 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id A136CCBF; Sat, 28 Sep 2013 23:03:41 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 752032809; Sat, 28 Sep 2013 23:03:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8SN3fGB022675; Sat, 28 Sep 2013 23:03:41 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8SN3foW022674; Sat, 28 Sep 2013 23:03:41 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201309282303.r8SN3foW022674@svn.freebsd.org> From: Dimitry Andric Date: Sat, 28 Sep 2013 23:03:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255931 - head/contrib/binutils/bfd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Sep 2013 23:03:41 -0000 Author: dim Date: Sat Sep 28 23:03:40 2013 New Revision: 255931 URL: http://svnweb.freebsd.org/changeset/base/255931 Log: 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. Approved by: re (kib) Reported by: swills MFC after: 2 weeks Modified: head/contrib/binutils/bfd/elflink.c Modified: head/contrib/binutils/bfd/elflink.c ============================================================================== --- head/contrib/binutils/bfd/elflink.c Sat Sep 28 16:39:46 2013 (r255930) +++ head/contrib/binutils/bfd/elflink.c Sat Sep 28 23:03:40 2013 (r255931) @@ -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;