diff -uNr binutils-2.15.90.0.1-ORIG/ld/genscripts.sh binutils-2.15.90.0.1/ld/genscripts.sh --- binutils-2.15.90.0.1-ORIG/ld/genscripts.sh 2004-03-04 07:24:34.000000000 +1100 +++ binutils-2.15.90.0.1/ld/genscripts.sh 2004-03-21 17:30:10.000000000 +1100 @@ -103,8 +103,13 @@ if [ "x${host}" = "x${target}" ] ; then NATIVE=yes USE_LIBPATH=yes + skip_libdir=no elif [ "x${use_sysroot}" = "xyes" ] ; then USE_LIBPATH=yes + skip_libdir=no + elif [ "x${LIB_PATH}" != "x" ] ; then + USE_LIBPATH=yes + skip_libdir=yes fi ;; esac @@ -125,16 +130,22 @@ # # If the emulparams file set LIBPATH_SUFFIX, prepend an extra copy of # the library path with the suffix applied. - -if [ "x${LIB_PATH}" = "x" ] && [ "x${USE_LIBPATH}" = xyes ] ; then +if [ "x${USE_LIBPATH}" = xyes ] ; then LIB_PATH2= + if [ "x${LIB_PATH}" = "x" ] ; then + libs="${NATIVE_LIB_DIRS}" + else + libs=`echo ${LIB_PATH} | sed 's/:/ /g'` + LIB_PATH= + fi - libs=${NATIVE_LIB_DIRS} if [ "x${use_sysroot}" != "xyes" ] ; then - case " ${libs} " in - *" ${libdir} "*) ;; - *) libs="${libdir} ${libs}" ;; - esac + if [ "x${skip_libdir}" != "xyes" ] ; then + case " ${libs} " in + *" ${libdir} "*) ;; + *) libs="${libdir} ${libs}" ;; + esac + fi case " ${libs} " in *" ${tool_lib} "*) ;; *) libs="${tool_lib} ${libs}" ;;