From owner-svn-src-stable@FreeBSD.ORG Thu Sep 4 16:05:13 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 12557E1F; Thu, 4 Sep 2014 16:05:13 +0000 (UTC) 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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E67D91E2E; Thu, 4 Sep 2014 16:05:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s84G5CUG002944; Thu, 4 Sep 2014 16:05:12 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s84G5Ctf002943; Thu, 4 Sep 2014 16:05:12 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201409041605.s84G5Ctf002943@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Thu, 4 Sep 2014 16:05:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r271103 - stable/10/contrib/binutils/ld/emultempl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Sep 2014 16:05:13 -0000 Author: tijl Date: Thu Sep 4 16:05:12 2014 New Revision: 271103 URL: http://svnweb.freebsd.org/changeset/base/271103 Log: MFC r270757: In r253839 the default behaviour of ld(1) was changed such that all libraries that need to be linked into an executable or library have to be listed on the command line explicitly. This commit fixes a bug in ld(1) where it would scan dependencies of the libraries on the command line and link them if needed if they were also found in ld.so.cache. The important bit of the patch is the initialisation of needed.by such that libraries found by scanning dependencies are marked as such and not used in the link. The patch is a backport of binutils git commit d5c8b1f8561426b41aa5330ed60f578178fe6be2 The author gave permission to use it under GPLv2 terms. PR: 192062 Modified: stable/10/contrib/binutils/ld/emultempl/elf32.em Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/binutils/ld/emultempl/elf32.em ============================================================================== --- stable/10/contrib/binutils/ld/emultempl/elf32.em Thu Sep 4 15:11:57 2014 (r271102) +++ stable/10/contrib/binutils/ld/emultempl/elf32.em Thu Sep 4 16:05:12 2014 (r271103) @@ -541,7 +541,8 @@ EOF #endif static bfd_boolean -gld${EMULATION_NAME}_check_ld_elf_hints (const char *name, int force) +gld${EMULATION_NAME}_check_ld_elf_hints (const struct bfd_link_needed_list *l, + int force) { static bfd_boolean initialized; static char *ld_elf_hints; @@ -584,10 +585,9 @@ gld${EMULATION_NAME}_check_ld_elf_hints if (ld_elf_hints == NULL) return FALSE; - needed.by = NULL; - needed.name = name; - return gld${EMULATION_NAME}_search_needed (ld_elf_hints, & needed, - force); + needed.by = l->by; + needed.name = l->name; + return gld${EMULATION_NAME}_search_needed (ld_elf_hints, &needed, force); } EOF # FreeBSD @@ -759,7 +759,8 @@ gld${EMULATION_NAME}_parse_ld_so_conf } static bfd_boolean -gld${EMULATION_NAME}_check_ld_so_conf (const char *name, int force) +gld${EMULATION_NAME}_check_ld_so_conf (const struct bfd_link_needed_list *l, + int force) { static bfd_boolean initialized; static char *ld_so_conf; @@ -794,8 +795,8 @@ gld${EMULATION_NAME}_check_ld_so_conf (c return FALSE; - needed.by = NULL; - needed.name = name; + needed.by = l->by; + needed.name = l->name; return gld${EMULATION_NAME}_search_needed (ld_so_conf, &needed, force); } @@ -1037,7 +1038,7 @@ if [ "x${USE_LIBPATH}" = xyes ] ; then case ${target} in *-*-freebsd* | *-*-dragonfly*) cat >>e${EMULATION_NAME}.c <name, force)) + if (gld${EMULATION_NAME}_check_ld_elf_hints (l, force)) break; EOF # FreeBSD @@ -1046,7 +1047,7 @@ EOF *-*-linux-* | *-*-k*bsd*-*) # Linux cat >>e${EMULATION_NAME}.c <name, force)) + if (gld${EMULATION_NAME}_check_ld_so_conf (l, force)) break; EOF