diff -uNr binutils-2.14.90.0.8-ORIG/ld/genscripts.sh binutils-2.14.90.0.8/ld/genscripts.sh --- binutils-2.14.90.0.8-ORIG/ld/genscripts.sh 2004-01-15 08:07:52.000000000 +1100 +++ binutils-2.14.90.0.8/ld/genscripts.sh 2004-03-29 13:04:52.000000000 +1000 @@ -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,13 +130,29 @@ # # 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"$use_sysroot" != xyes ] ; then - LIB_PATH2=${libdir} + if [ "x${LIB_PATH}" = "x" ] ; then + libs="${NATIVE_LIB_DIRS}" + else + libs=`echo ${LIB_PATH} | sed 's/:/ /g'` + LIB_PATH= + fi + + if [ "x${use_sysroot}" != "xyes" ] ; then + if [ "x${skip_libdir}" != "xyes" ] ; then + case " ${libs} " in + *" ${libdir} "*) ;; + *) libs="${libdir} ${libs}" ;; + esac + fi + case " ${libs} " in + *" ${tool_lib} "*) ;; + *) libs="${tool_lib} ${libs}" ;; + esac fi - for lib in ${NATIVE_LIB_DIRS}; do + + for lib in ${libs}; do # The "=" is harmless if we aren't using a sysroot, but also needless. if [ "x${use_sysroot}" = "xyes" ] ; then lib="=${lib}" @@ -161,13 +182,13 @@ esac fi done + case :${LIB_PATH}:${LIB_PATH2}: in *:: | ::*) LIB_PATH=${LIB_PATH}${LIB_PATH2} ;; *) LIB_PATH=${LIB_PATH}:${LIB_PATH2} ;; esac fi - # Always search $(tooldir)/lib, aka /usr/local/TARGET/lib, except for # sysrooted configurations and when LIBPATH=":". if [ "x${use_sysroot}" != "xyes" ] ; then