[617118d] | 1 | diff -uNr binutils-2.14-orig/ld/genscripts.sh binutils-2.14/ld/genscripts.sh
|
---|
| 2 | --- binutils-2.14-orig/ld/genscripts.sh 2003-02-08 01:21:03.000000000 +1100
|
---|
| 3 | +++ binutils-2.14/ld/genscripts.sh 2004-05-19 12:40:51.000000000 +1000
|
---|
| 4 | @@ -50,8 +50,13 @@
|
---|
| 5 | if [ "x${host}" = "x${target}" ] ; then
|
---|
| 6 | NATIVE=yes
|
---|
| 7 | USE_LIBPATH=yes
|
---|
| 8 | + skip_libdir=no
|
---|
| 9 | elif [ "x${use_sysroot}" = "xyes" ] ; then
|
---|
| 10 | USE_LIBPATH=yes
|
---|
| 11 | + skip_libdir=no
|
---|
| 12 | + elif [ "x${LIB_PATH}" != "x" ] ; then
|
---|
| 13 | + USE_LIBPATH=yes
|
---|
| 14 | + skip_libdir=yes
|
---|
| 15 | fi
|
---|
| 16 | ;;
|
---|
| 17 | esac
|
---|
| 18 | @@ -72,13 +77,29 @@
|
---|
| 19 | #
|
---|
| 20 | # If the emulparams file set LIBPATH_SUFFIX, prepend an extra copy of
|
---|
| 21 | # the library path with the suffix applied.
|
---|
| 22 | +if [ "x${USE_LIBPATH}" = xyes ] ; then
|
---|
| 23 | + LIB_PATH2=
|
---|
| 24 | + if [ "x${LIB_PATH}" = "x" ] ; then
|
---|
| 25 | + libs="${NATIVE_LIB_DIRS}"
|
---|
| 26 | + else
|
---|
| 27 | + libs=`echo ${LIB_PATH} | sed 's/:/ /g'`
|
---|
| 28 | + LIB_PATH=
|
---|
| 29 | + fi
|
---|
| 30 |
|
---|
| 31 | -if [ "x${LIB_PATH}" = "x" ] && [ "x${USE_LIBPATH}" = xyes ] ; then
|
---|
| 32 | - if [ x"$use_sysroot" != xyes ] ; then
|
---|
| 33 | - LIB_PATH=${libdir}
|
---|
| 34 | + if [ "x${use_sysroot}" != "xyes" ] ; then
|
---|
| 35 | + if [ "x${skip_libdir}" != "xyes" ] ; then
|
---|
| 36 | + case " ${libs} " in
|
---|
| 37 | + *" ${libdir} "*) ;;
|
---|
| 38 | + *) libs="${libdir} ${libs}" ;;
|
---|
| 39 | + esac
|
---|
| 40 | + fi
|
---|
| 41 | + case " ${libs} " in
|
---|
| 42 | + *" ${tool_lib} "*) ;;
|
---|
| 43 | + *) libs="${tool_lib} ${libs}" ;;
|
---|
| 44 | + esac
|
---|
| 45 | fi
|
---|
| 46 | - LIB_PATH2=""
|
---|
| 47 | - for lib in ${NATIVE_LIB_DIRS}; do
|
---|
| 48 | +
|
---|
| 49 | + for lib in ${libs}; do
|
---|
| 50 | # The "=" is harmless if we aren't using a sysroot, but also needless.
|
---|
| 51 | if [ "x${use_sysroot}" = "xyes" ] ; then
|
---|
| 52 | lib="=${lib}"
|
---|
| 53 | @@ -91,34 +112,51 @@
|
---|
| 54 | esac
|
---|
| 55 | if test -n "$addsuffix"; then
|
---|
| 56 | case :${LIB_PATH}: in
|
---|
| 57 | - *:${lib}${LIBPATH_SUFFIX}:*) ;;
|
---|
| 58 | - ::) LIB_PATH=${lib}${LIBPATH_SUFFIX} ;;
|
---|
| 59 | - *) LIB_PATH=${LIB_PATH}:${lib}${LIBPATH_SUFFIX} ;;
|
---|
| 60 | + *:${lib}${LIBPATH_SUFFIX}:*) ;;
|
---|
| 61 | + ::) LIB_PATH=${lib}${LIBPATH_SUFFIX} ;;
|
---|
| 62 | + *) LIB_PATH=${LIB_PATH}:${lib}${LIBPATH_SUFFIX} ;;
|
---|
| 63 | esac
|
---|
| 64 | - case :${LIB_PATH}${LIB_PATH2}: in
|
---|
| 65 | - *:${lib}:*) ;;
|
---|
| 66 | + case :${LIB_PATH}:${LIB_PATH2}: in
|
---|
| 67 | + *:${lib}:*) ;;
|
---|
| 68 | + *::) LIB_PATH2=${lib} ;;
|
---|
| 69 | *) LIB_PATH2=${LIB_PATH2}:${lib} ;;
|
---|
| 70 | esac
|
---|
| 71 | else
|
---|
| 72 | - case :${LIB_PATH}: in
|
---|
| 73 | + case :${LIB_PATH2}: in
|
---|
| 74 | *:${lib}:*) ;;
|
---|
| 75 | - ::) LIB_PATH=${lib} ;;
|
---|
| 76 | - *) LIB_PATH=${LIB_PATH}:${lib} ;;
|
---|
| 77 | + ::) LIB_PATH2=${lib} ;;
|
---|
| 78 | + *) LIB_PATH2=${LIB_PATH2}:${lib} ;;
|
---|
| 79 | esac
|
---|
| 80 | fi
|
---|
| 81 | done
|
---|
| 82 | - LIB_PATH=${LIB_PATH}${LIB_PATH2}
|
---|
| 83 | -fi
|
---|
| 84 |
|
---|
| 85 | + case :${LIB_PATH}:${LIB_PATH2}: in
|
---|
| 86 | + *:: | ::*) LIB_PATH=${LIB_PATH}${LIB_PATH2} ;;
|
---|
| 87 | + *) LIB_PATH=${LIB_PATH}:${LIB_PATH2} ;;
|
---|
| 88 | + esac
|
---|
| 89 | +fi
|
---|
| 90 |
|
---|
| 91 | # Always search $(tooldir)/lib, aka /usr/local/TARGET/lib, except for
|
---|
| 92 | # sysrooted configurations.
|
---|
| 93 | if [ "x${use_sysroot}" != "xyes" ] ; then
|
---|
| 94 | - LIB_PATH=${tool_lib}:${LIB_PATH}
|
---|
| 95 | + case :${LIB_PATH}: in
|
---|
| 96 | + ::: | *:${tool_lib}:*) ;;
|
---|
| 97 | + ::) LIB_PATH=${tool_lib} ;;
|
---|
| 98 | + *) LIB_PATH=${tool_lib}:${LIB_PATH} ;;
|
---|
| 99 | + esac
|
---|
| 100 | fi
|
---|
| 101 |
|
---|
| 102 | LIB_SEARCH_DIRS=`echo ${LIB_PATH} | sed -e 's/:/ /g' -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\\"\1\\");/g'`
|
---|
| 103 |
|
---|
| 104 | +# We need it for testsuite.
|
---|
| 105 | +case " $EMULATION_LIBPATH " in
|
---|
| 106 | + *" ${EMULATION_NAME} "*)
|
---|
| 107 | + test -d tmpdir || mkdir tmpdir
|
---|
| 108 | + test -f tmpdir/libpath.exp || \
|
---|
| 109 | + echo "set libpath \"${LIB_PATH}\"" | sed -e 's/:/ /g' > tmpdir/libpath.exp
|
---|
| 110 | + ;;
|
---|
| 111 | +esac
|
---|
| 112 | +
|
---|
| 113 | # Generate 5 or 6 script files from a master script template in
|
---|
| 114 | # ${srcdir}/scripttempl/${SCRIPT_NAME}.sh. Which one of the 5 or 6
|
---|
| 115 | # script files is actually used depends on command line options given
|
---|