Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Sep 2014 16:05:12 +0000 (UTC)
From:      Tijl Coosemans <tijl@FreeBSD.org>
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
Message-ID:  <201409041605.s84G5Ctf002943@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <<EOF
-	  if (gld${EMULATION_NAME}_check_ld_elf_hints (l->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 <<EOF
-	  if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force))
+	  if (gld${EMULATION_NAME}_check_ld_so_conf (l, force))
 	    break;
 
 EOF



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409041605.s84G5Ctf002943>