fix biarch ld search paths
Alan Modra
amodra@bigpond.net.au
Wed Jan 28 13:31:00 GMT 2004
I was building binutils away from my favourite /usr/local prefix the
other day, and hit a snag with biarch search paths. Given the seach
path without LIBPATH_SUFFIX (64 in my case) adjusted extra paths was
/scratch/alan/powerpc64-linux/lib
/scratch/alan/lib
/usr/local/lib
/lib
/usr/lib
then I think we ought to search all these first.
/scratch/alan/powerpc64-linux/lib64
/scratch/alan/lib64
/usr/local/lib64
/lib64
/usr/lib64
Previous behaviour was to search
/scratch/alan/powerpc64-linux/lib
/usr/local/lib64
/lib64
/usr/lib64
/scratch/alan/lib
/usr/local/lib
/lib
/usr/lib
Not seaching at least one of /scratch/alan/powerpc64-linux/lib64
or /scratch/alan/lib64 makes it a little difficult for someone to
install biarch libraries locally, ie. without root permission.
* genscripts.sh: Apply $LIBPATH_SUFFIX to $tool_lib and $libdir too.
Index: genscripts.sh
===================================================================
RCS file: /cvs/src/src/ld/genscripts.sh,v
retrieving revision 1.16
diff -u -p -r1.16 genscripts.sh
--- genscripts.sh 16 Oct 2003 08:46:34 -0000 1.16
+++ genscripts.sh 28 Jan 2004 12:44:27 -0000
@@ -128,10 +128,20 @@ fi
if [ "x${LIB_PATH}" = "x" ] && [ "x${USE_LIBPATH}" = xyes ] ; then
LIB_PATH2=
- if [ x"$use_sysroot" != xyes ] ; then
- LIB_PATH2=${libdir}
+
+ libs=${NATIVE_LIB_DIRS}
+ if [ "x${use_sysroot}" != "xyes" ] ; then
+ case " ${libs} " in
+ *" ${libdir} "*) ;;
+ *) libs="${libdir} ${libs}"
+ esac
+ 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,12 +171,12 @@ if [ "x${LIB_PATH}" = "x" ] && [ "x${USE
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=":".
--
Alan Modra
IBM OzLabs - Linux Technology Centre
More information about the Binutils
mailing list