svn commit: r291226 - head/gnu/usr.bin/binutils/ld

Bryan Drewery bdrewery at FreeBSD.org
Tue Nov 24 00:49:30 UTC 2015


Author: bdrewery
Date: Tue Nov 24 00:49:29 2015
New Revision: 291226
URL: https://svnweb.freebsd.org/changeset/base/291226

Log:
  Fix ld not respecting --sysroot.
  
  ld(1) uses the /usr/libdata/ldscripts when linking. These scripts add in the
  default search paths of /lib and /usr/lib via 'SEARCH_DIR("DIR")'. These
  need to be prefixed by '=' so that the --sysroot flag is respected. This
  is not a problem with buildworld since the TOOLS_PREFIX is baked into the
  cross-ld. However it is a problem when trying to use ld(1) with --sysroot
  anywhere else as it ends up still reading /lib and /usr/lib despite --sysroot.
  
  The default --sysroot (TARGET_SYSTEM_ROOT) is '/' for /usr/bin/ld.
  
  I found this while building with META MODE with uses only --sysroot with
  /usr/bin/ld, and found that libraries that I had not built in its sysroot
  directory were leaking in. This didn't happen with ports binutils either.  This
  would also impact external compiler support.
  
  Reviewed by:	bapt, brooks
  MFC after:	2 weeks
  Sponsored by:	EMC / Isilon Storage Division
  Differential Revision:	https://reviews.freebsd.org/D4262

Modified:
  head/gnu/usr.bin/binutils/ld/Makefile

Modified: head/gnu/usr.bin/binutils/ld/Makefile
==============================================================================
--- head/gnu/usr.bin/binutils/ld/Makefile	Mon Nov 23 23:48:07 2015	(r291225)
+++ head/gnu/usr.bin/binutils/ld/Makefile	Tue Nov 24 00:49:29 2015	(r291226)
@@ -50,7 +50,7 @@ FILES=		${LDSCRIPTS:S|^|ldscripts/|}
 FILESDIR=	${SCRIPTDIR}
 
 HOST=		${TARGET_TUPLE}
-LIBSEARCHPATH=	\"${TOOLS_PREFIX}/lib\":\"${TOOLS_PREFIX}/usr/lib\"
+LIBSEARCHPATH=	\"=/lib\":\"=/usr/lib\"
 .for ext in ${ELF_SCR_EXT}
 LDSCRIPTS+=	${NATIVE_EMULATION}.${ext}
 ldscripts/${NATIVE_EMULATION}.${ext}: e${NATIVE_EMULATION}.c


More information about the svn-src-all mailing list