This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] scan for i*86 directories on x86_64


Hi!

When building elf32 code on x86_64, you typicaly want to scan for all
the corresponding i*86 directories instead of just i386.

This patch extends genscripts.sh so that it is possible to specify
multiple targets in the TOOL_LIB list, and uses that to enumerate
them in ld/configure.tgt.

2007-12-09  Robert Millan  <rmh@aybabtu.com>

	* genscripts.sh: Allow `TOOL_LIB' (and `tool_lib') to contain multiple
	directories.
	* configure.tgt (x86_64-*-linux-*): Set `tdir_elf_i386' with a target
	for each of i386, i486, i586 and i686, instead of just i386.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
2007-12-09  Robert Millan  <rmh@aybabtu.com>

	* genscripts.sh: Allow `TOOL_LIB' (and `tool_lib') to contain multiple
	directories.
	* configure.tgt (x86_64-*-linux-*): Set `tdir_elf_i386' with a target
	for each of i386, i486, i586 and i686, instead of just i386.

Index: ld/configure.tgt
===================================================================
RCS file: /cvs/src/src/ld/configure.tgt,v
retrieving revision 1.215
diff -u -p -r1.215 configure.tgt
--- ld/configure.tgt	19 Oct 2007 17:31:25 -0000	1.215
+++ ld/configure.tgt	9 Dec 2007 19:32:23 -0000
@@ -200,7 +200,7 @@ x86_64-*-linux-*)	targ_emul=elf_x86_64
 			targ_extra_emuls="elf_i386 i386linux"
 			targ_extra_libpath=elf_i386
 			tdir_i386linux=`echo ${targ_alias}aout | sed -e 's/x86_64/i386/'`
-			tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'` ;;
+			tdir_elf_i386=`for i in i386 i486 i586 i686 ; do echo ${targ_alias} | sed -e "s/x86_64/$i/"; done` ;;
 i[3-7]86-*-sysv[45]*)	targ_emul=elf_i386 ;;
 i[3-7]86-*-solaris2*)	targ_emul=elf_i386_ldso
                         targ_extra_emuls="elf_i386 elf_x86_64"
Index: ld/genscripts.sh
===================================================================
RCS file: /cvs/src/src/ld/genscripts.sh,v
retrieving revision 1.27
diff -u -p -r1.27 genscripts.sh
--- ld/genscripts.sh	26 Oct 2007 06:33:59 -0000	1.27
+++ ld/genscripts.sh	9 Dec 2007 19:32:24 -0000
@@ -97,7 +97,7 @@ CUSTOMIZER_SCRIPT=$4
 if [ "x${TOOL_LIB}" = "x" ] ; then
   tool_lib=${exec_prefix}/${target_alias}/lib
 else
-  tool_lib=${exec_prefix}/${TOOL_LIB}/lib
+  tool_lib=`echo ${TOOL_LIB} | sed -e "s,\([^ ][^ ]*\),${exec_prefix}/\1/lib,g"`
 fi
 
 if [ "x${CUSTOMIZER_SCRIPT}" = "x" ] ; then
@@ -157,10 +157,12 @@ if [ "x${LIB_PATH}" = "x" ] && [ "x${USE
       *" ${libdir} "*) ;;
       *) libs="${libdir} ${libs}" ;;
     esac
-    case " ${libs} " in
-      *" ${tool_lib} "*) ;;
-      *) libs="${tool_lib} ${libs}" ;;
-    esac
+    for i in ${tool_lib}; do
+      case " ${libs} " in
+        *" ${i} "*) ;;
+        *) libs="${i} ${libs}" ;;
+      esac
+    done
   fi
 
   for lib in ${libs}; do
@@ -203,19 +205,21 @@ fi
 # Always search $(tooldir)/lib, aka /usr/local/TARGET/lib, except for
 # sysrooted configurations and when LIBPATH=":".
 if [ "x${use_sysroot}" != "xyes" ] ; then
-  case :${LIB_PATH}: in
-  ::: | *:${tool_lib}:*) ;;
-  ::) LIB_PATH=${tool_lib} ;;
-  *) LIB_PATH=${tool_lib}:${LIB_PATH} ;;
-  esac
-  # For multilib targets, search both $tool_lib dirs
-  if [ "x${LIBPATH_SUFFIX}" != "x" ] ; then
+  for i in ${tool_lib}; do
     case :${LIB_PATH}: in
-      ::: | *:${tool_lib}${LIBPATH_SUFFIX}:*) ;;
-      ::) LIB_PATH=${tool_lib}${LIBPATH_SUFFIX} ;;
-      *) LIB_PATH=${tool_lib}${LIBPATH_SUFFIX}:${LIB_PATH} ;;
+    ::: | *:${i}:*) ;;
+    ::) LIB_PATH=${i} ;;
+    *) LIB_PATH=${i}:${LIB_PATH} ;;
     esac
-  fi
+    # For biarch targets, search this ${tool_lib} dir both with and without suffix
+    if [ "x${LIBPATH_SUFFIX}" != "x" ] ; then
+      case :${LIB_PATH}: in
+        ::: | *:${i}${LIBPATH_SUFFIX}:*) ;;
+        ::) LIB_PATH=${i}${LIBPATH_SUFFIX} ;;
+        *) LIB_PATH=${i}${LIBPATH_SUFFIX}:${LIB_PATH} ;;
+      esac
+    fi
+  done
 fi
 
 LIB_SEARCH_DIRS=`echo ${LIB_PATH} | sed -e 's/:/ /g' -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\\"\1\\");/g'`

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]