diff -urN binutils-2.18.1~cvs20071027/debian/patches/00list binutils-2.18.1~cvs20071027.cross/debian/patches/00list --- binutils-2.18.1~cvs20071027/debian/patches/00list 2007-11-23 01:53:03.000000000 +0000 +++ binutils-2.18.1~cvs20071027.cross/debian/patches/00list 2007-11-23 01:55:15.000000000 +0000 @@ -5,3 +5,4 @@ 012_check_ldrunpath_length 127_x86_64_i386_biarch 304_pr4476 +999_lib64_for_cross diff -urN binutils-2.18.1~cvs20071027/debian/patches/999_lib64_for_cross.dpatch binutils-2.18.1~cvs20071027.cross/debian/patches/999_lib64_for_cross.dpatch --- binutils-2.18.1~cvs20071027/debian/patches/999_lib64_for_cross.dpatch 1970-01-01 00:00:00.000000000 +0000 +++ binutils-2.18.1~cvs20071027.cross/debian/patches/999_lib64_for_cross.dpatch 2007-11-23 01:54:34.000000000 +0000 @@ -0,0 +1,63 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 999_lib64_for_cross.dpatch by +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: patches lib64 for crosscompiling +## DP: Add /usr/${target-alias}/lib${LIBPATH_SUFFIX} to ld's default +## DP: library search path for cross targets. Needed for cross targets that +## DP: try to support both 32bit and 64bit emulations. + +if [ $# -lt 1 ]; then + echo "`basename $0`: script expects -patch|-unpatch as argument" >&2 + exit 1 +fi + +[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts +patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}" + +case "$1" in + -patch) patch -p1 ${patch_opts} < $0;; + -unpatch) patch -R -p1 ${patch_opts} < $0;; + *) + echo "`basename $0`: script expects -patch|-unpatch as argument" >&2 + exit 1;; +esac + +exit 0 + +@DPATCH@ + +--- binutils-2.18.1~cvs20071027-1.cross/ld/genscripts.sh 2007-11-23 01:37:37.000000000 +0000 ++++ binutils-2.18.1~cvs20071027-1/ld/genscripts.sh 2007-11-23 01:46:27.000000000 +0000 +@@ -197,6 +197,27 @@ + *:: | ::*) LIB_PATH=${LIB_PATH}${LIB_PATH2} ;; + *) LIB_PATH=${LIB_PATH}:${LIB_PATH2} ;; + esac ++ ++ # For multilib'ed targets, ensure both ${target_alias}/lib${LIBPATH_SUFFIX} ++ # and ${TOOL_LIB}/lib${LIBPATH_SUFFIX} to default search path, because ++ # 64bit libraries may be in both places, depending on cross-development ++ # setup method (e.g.: /usr/s390x-linux/lib64 vs /usr/s390-linux/lib64) ++ case "${LIBPATH_SUFFIX}:${tool_lib}" in ++ :*) ;; ++ *:*${LIBPATH_SUFFIX}) ;; ++ *) ++ paths="${exec_prefix}/${target_alias}/lib${LIBPATH_SUFFIX}" ++ if [ "${TOOL_LIB}" != x ]; then ++ paths="${paths} ${exec_prefix}/${TOOL_LIB}/lib${LIBPATH_SUFFIX}" ++ fi ++ for path in $paths; do ++ case :${LIB_PATH}: in ++ ::: | *:${path}:*) ;; ++ *) LIB_PATH=${path}:${LIB_PATH} ;; ++ esac ++ done ++ ;; ++ esac + fi + + # Always search $(tooldir)/lib, aka /usr/local/TARGET/lib, except for