* genscripts.sh (LIB_PATH): For native targets, concatenate $libdir
authorAlan Modra <amodra@gmail.com>
Wed, 22 May 2002 08:44:53 +0000 (08:44 +0000)
committerAlan Modra <amodra@gmail.com>
Wed, 22 May 2002 08:44:53 +0000 (08:44 +0000)
and $NATIVE_LIB_DIRS.  Add $tool_lib before other libs.
(LIB_SEARCH_DIRS): No need to use "tr".
(COMPILE_IN): Only set for native targets.
* configure.host (NATIVE_LIB_DIRS): Specify all native search dirs
here, rather than adding lib:/usr/lib:/usr/local/lib in genscripts.sh.
* configure.tgt (powerpc*): Set tdir_*.
(powerpcle*): Correct targ_extra_emuls.
* emulparams/elf32ppc.sh (LIB_PATH): Set up native 64 bit dirs.
* emulparams/elf64ppc.sh (LIB_PATH): Likewise.

ld/ChangeLog
ld/configure.host
ld/configure.tgt
ld/emulparams/elf32ppc.sh
ld/emulparams/elf64ppc.sh
ld/genscripts.sh

index 336a326248f5c24061ce8c7bb8602af9bda1eb10..57ef8c9f4a742d639e1a690fdb0dacb4f085f76e 100644 (file)
@@ -1,3 +1,16 @@
+2002-05-22  Alan Modra  <amodra@bigpond.net.au>
+
+       * genscripts.sh (LIB_PATH): For native targets, concatenate $libdir
+       and $NATIVE_LIB_DIRS.  Add $tool_lib before other libs.
+       (LIB_SEARCH_DIRS): No need to use "tr".
+       (COMPILE_IN): Only set for native targets.
+       * configure.host (NATIVE_LIB_DIRS): Specify all native search dirs
+       here, rather than adding lib:/usr/lib:/usr/local/lib in genscripts.sh.
+       * configure.tgt (powerpc*): Set tdir_*.
+       (powerpcle*): Correct targ_extra_emuls.
+       * emulparams/elf32ppc.sh (LIB_PATH): Set up native 64 bit dirs.
+       * emulparams/elf64ppc.sh (LIB_PATH): Likewise.
+
 2002-05-22  Alan Modra  <amodra@bigpond.net.au>
 
        * emultempl/pe.em (set_pe_subsystem): Don't set "cmdline" when
index 65c2fc7a21e0e275e30fb3cb785f071d7d5d6518..974a23b551aad0209444ef85757f444e95f38556 100644 (file)
@@ -12,7 +12,7 @@
 HDEFINES=
 HOSTING_CRT0=/lib/crt0.o
 HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ]; then libgcc=../gcc/libgcc.a; else libgcc=\`${CC} -print-libgcc-file-name\`; fi; if [ -f ../gcc/libgcc_eh.a ]; then libgcc="$libgcc ../gcc/libgcc_eh.a"; else libgcc_eh=\`${CC} -print-file-name=libgcc_eh.a\`; if [ x"$libgcc_eh" != xlibgcc_eh.a ]; then libgcc="$libgcc $libgcc_eh"; fi; fi; echo $libgcc -lc $libgcc`'
-NATIVE_LIB_DIRS=
+NATIVE_LIB_DIRS='/usr/local/lib /lib /usr/lib'
 
 #
 #      Generic configurations:
@@ -21,7 +21,7 @@ NATIVE_LIB_DIRS=
 case "${host}" in
 
 *-*-freebsd*)
-  NATIVE_LIB_DIRS=/usr/lib
+  NATIVE_LIB_DIRS='/lib /usr/lib /usr/local/lib'
   # Older versions of gcc do not use a specs file.  In those cases,
   # gcc -print-file-name=specs will simply print specs.  We create a
   # dummy specs files to handle this.
@@ -57,11 +57,6 @@ case "${host}" in
   ;;
 
 alpha*-*-netbsd*)
-  # The new BSD `make' has a bug: it doesn't pass empty arguments in
-  # shell commands.  So we need to make this value non-empty in order
-  # for the genscripts.sh call to work.  There's nothing magic about
-  # the value `/lib'; it's just a dummy.
-  NATIVE_LIB_DIRS=/lib
   HOSTING_CRT0=/usr/lib/crt0.o
   ;;
 
@@ -70,18 +65,13 @@ arm*-*-linux-gnu*)
   ;;
 
 i[3456]86-*-bsd* | i[34567]86-*-freebsd[12] | i[34567]86-*-freebsd[12]\.* | i[34567]86-*-freebsd*aout* | i[3456]86-*-netbsd*)
-  # The new BSD `make' has a bug: it doesn't pass empty arguments in
-  # shell commands.  So we need to make this value non-empty in order
-  # for the genscripts.sh call to work.  There's nothing magic about
-  # the value `/lib'; it's just a dummy.
-  NATIVE_LIB_DIRS=/lib
   HOSTING_CRT0=/usr/lib/crt0.o
   ;;
 
 i[3456]86-*-sysv4*)
   HOSTING_CRT0='/usr/ccs/lib/crt1.o /usr/ccs/lib/crti.o /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
   HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` /usr/ccs/lib/crtn.o'
-  NATIVE_LIB_DIRS=/usr/ccs/lib
+  NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
   ;;
 
 i[3456]86-sequent-ptx* | i[3456]86-sequent-sysv*)
@@ -97,7 +87,7 @@ i[3456]86-*-sysv*)
 i[3456]86-*-solaris*)
   HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else ${CC} -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else ${CC} -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
   HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else ${CC} -print-file-name=crtn.o; fi`'
-  NATIVE_LIB_DIRS=/usr/ccs/lib
+  NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
   ;;
 
 i[3456]86-*-sco* | i[3456]86-*-isc*)
@@ -122,7 +112,7 @@ i[3456]86-*-lynxos*)
 
 i[3456]86-pc-interix*)
   HOSTING_CRT0='$$INTERIX_ROOT/usr/lib/crt0.o'
-  NATIVE_LIB_DIRS='$$INTERIX_ROOT/usr/lib/'
+  NATIVE_LIB_DIRS='/usr/local/lib $$INTERIX_ROOT/usr/lib /lib /usr/lib'
   HOSTING_LIBS='-L $$X/local_bin -L $$INTERIX_ROOT/usr/lib '"$HOSTING_LIBS"' -lcpsx -lc -lcpsx $$INTERIX_ROOT/usr/lib/psxdll.a $$INTERIX_ROOT/usr/lib/psxdll2.a'
   ;;
 
@@ -137,7 +127,7 @@ ia64-*-linux-gnu*)
 ia64-*-aix*)
   HOSTING_CRT0='-dynamic-linker `egrep "libc.so" \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[      ][      ]*\(.*/libc.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
   HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
-  NATIVE_LIB_DIRS=/usr/lib/ia64l64
+  NATIVE_LIB_DIRS='/usr/local/lib /usr/lib/ia64l64 /lib /usr/lib'
   ;;
 
 mips*-dec-bsd*)
@@ -202,7 +192,7 @@ s390-*-linux-gnu*)
 sparc*-*-solaris2*)
   HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else ${CC} -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else ${CC} -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
   HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else ${CC} -print-file-name=crtn.o; fi`'
-  NATIVE_LIB_DIRS=/usr/ccs/lib
+  NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
   ;;
 
 sparc-*-linux-gnu*)
@@ -224,7 +214,6 @@ x86_64-*-linux-gnu*)
   ;;
 
 *-*-netbsd*)
-  NATIVE_LIB_DIRS=/usr/lib
   # NetBSD typically does not use the GCC crtstuff, so ignore it.
   HOSTING_CRT0='-dynamic-linker /usr/libexec/ld.elf_so /usr/lib/crt0.o /usr/lib/crtbegin.o'
   HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` /usr/lib/crtend.o'
@@ -232,7 +221,7 @@ x86_64-*-linux-gnu*)
 
 alpha*-*-*)
   HOSTING_CRT0=/usr/ccs/lib/crt0.o
-  NATIVE_LIB_DIRS=/usr/ccs/lib
+  NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
   ;;
 
 romp-*-*)
index 49619080d47ca2db571ac40b09a1a6aba512db94..c2b4927a6376f634b35907fdb04e41331566c3c4 100644 (file)
@@ -396,7 +396,11 @@ powerpc-*-freebsd*)        targ_emul=elf32ppc_fbsd;
 powerpc*-*-linux*)
        case "${targ}" in
        *64*)   targ_emul=elf64ppc
-               targ_extra_emuls="elf32ppclinux elf32ppc elf32ppcsim" ;;
+               targ_extra_emuls="elf32ppclinux elf32ppc elf32ppcsim"
+               targ_extra_libpath=elf32ppclinux
+               tdir_elf32ppc=`echo "${targ_alias}" | sed -e 's/64//'`
+               tdir_elf32ppclinux=$tdir_elf32ppc
+               tdir_elf32ppcsim=$tdir_elf32ppc ;;
        *)      targ_emul=elf32ppclinux
                targ_extra_emuls="elf32ppc elf32ppcsim"
                targ_extra_libpath=elf32ppc ;;
@@ -405,7 +409,9 @@ powerpc*le-*-elf* | powerpc*le-*-eabi* | powerpc*le-*-solaris* \
   | powerpc*le-*-sysv* | powerpc*le-*-vxworks*)
        case "${targ}" in
        *64*)   targ_emul=elf64lppc
-               targ_extra_emuls="elf32lppc elf32ppcsim" ;;
+               targ_extra_emuls="elf32lppc elf32lppcsim"
+               tdir_elf32lppc=`echo "${targ_alias}" | sed -e 's/64//'`
+               tdir_elf32lppcsim=$tdir_elf32lppc ;;
        *)      targ_emul=elf32lppc
                targ_extra_emuls="elf32ppcsim" ;;
        esac ;;
@@ -413,7 +419,10 @@ powerpc*-*-elf* | powerpc*-*-eabi* | powerpc*-*-sysv* \
   | powerpc*-*-netbsd* | powerpc*-*-vxworks*)
        case "${targ}" in
        *64*)   targ_emul=elf64ppc
-               targ_extra_emuls="elf32ppc elf32ppclinux elf32ppcsim" ;;
+               targ_extra_emuls="elf32ppc elf32ppclinux elf32ppcsim"
+               tdir_elf32ppc=`echo "${targ_alias}" | sed -e 's/64//'`
+               tdir_elf32ppclinux=$tdir_elf32ppc
+               tdir_elf32ppcsim=$tdir_elf32ppc ;;
        *)      targ_emul=elf32ppc
                targ_extra_emuls="elf32ppclinux elf32ppcsim" ;;
        esac ;;
index 261e4bf1fbc030b9496d7e88da7043d63775ae97..f88198f631ff54c00b75ecd53012056baf6f0117 100644 (file)
@@ -17,3 +17,22 @@ OTHER_READWRITE_SECTIONS="
   .got1         ${RELOCATING-0} : { *(.got1) }
   .got2         ${RELOCATING-0} : { *(.got2) }
 "
+
+# Treat a host that matches the target with the possible exception of "64"
+# in the name as if it were native.
+if test `echo "$host" | sed -e s/64//` = `echo "$target" | sed -e s/64//`; then
+    case " $EMULATION_LIBPATH " in
+      *" ${EMULATION_NAME} "*)
+       LIB_PATH=${libdir}
+       for lib in ${NATIVE_LIB_DIRS}; do
+         case :${LIB_PATH}: in
+           *:${lib}:*) ;;
+           *) LIB_PATH=${LIB_PATH}:${lib} ;;
+         esac
+       done
+       # Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first.
+       case "$EMULATION_NAME" in
+         *64*) LIB_PATH=`echo ${LIB_PATH}: | sed -e s,:,64:,g`$LIB_PATH
+       esac
+    esac
+fi
index a6b3ec5438d81a40a4820a67a062d631c1dcdb22..f1647d50c0e9457b7ab7a43d400cb00adc20c23f 100644 (file)
@@ -28,3 +28,22 @@ OTHER_GOT_RELOC_SECTIONS="
 OTHER_READWRITE_SECTIONS="
   .toc1                ${RELOCATING-0}${RELOCATING+ALIGN(8)} : { *(.toc1) }
   .opd         ${RELOCATING-0}${RELOCATING+ALIGN(8)} : { *(.opd) }"
+
+# Treat a host that matches the target with the possible exception of "64"
+# in the name as if it were native.
+if test `echo "$host" | sed -e s/64//` = `echo "$target" | sed -e s/64//`; then
+    case " $EMULATION_LIBPATH " in
+      *" ${EMULATION_NAME} "*)
+       LIB_PATH=${libdir}
+       for lib in ${NATIVE_LIB_DIRS}; do
+         case :${LIB_PATH}: in
+           *:${lib}:*) ;;
+           *) LIB_PATH=${LIB_PATH}:${lib} ;;
+         esac
+       done
+       # Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first.
+       case "$EMULATION_NAME" in
+         *64*) LIB_PATH=`echo ${LIB_PATH}: | sed -e s,:,64:,g`$LIB_PATH
+       esac
+    esac
+fi
index fe1fa499f5ab18a8fab02fc014df76a5973943c1..36e0a9d588a46ed6f082cd0375e64e5df4e156c2 100755 (executable)
@@ -45,31 +45,25 @@ fi
 # To force a logically empty LIB_PATH, do LIBPATH=":".
 
 if [ "x${LIB_PATH}" = "x" ] ; then
-  # Cross, or native non-default emulation not requesting LIB_PATH.
-  LIB_PATH=
-
   if [ "x${host}" = "x${target}" ] ; then
     case " $EMULATION_LIBPATH " in
       *" ${EMULATION_NAME} "*)
         # Native, and default or emulation requesting LIB_PATH.
-        LIB_PATH=/lib:/usr/lib
-        if [ -n "${NATIVE_LIB_DIRS}" ]; then
-         LIB_PATH=${LIB_PATH}:${NATIVE_LIB_DIRS}
-        fi
-        if [ "${libdir}" != /usr/lib ]; then
-         LIB_PATH=${LIB_PATH}:${libdir}
-        fi
-        if [ "${libdir}" != /usr/local/lib ] ; then
-         LIB_PATH=${LIB_PATH}:/usr/local/lib
-        fi
+       LIB_PATH=${libdir}
+       for lib in ${NATIVE_LIB_DIRS}; do
+         case :${LIB_PATH}: in
+           *:${lib}:*) ;;
+           *) LIB_PATH=${LIB_PATH}:${lib} ;;
+         esac
+       done
     esac
   fi
 fi
 
 # Always search $(tooldir)/lib, aka /usr/local/TARGET/lib.
-LIB_PATH=${LIB_PATH}:${tool_lib}
+LIB_PATH=${tool_lib}:${LIB_PATH}
 
-LIB_SEARCH_DIRS=`echo ${LIB_PATH} | tr ':' ' ' | sed -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\\"\1\\");/g'`
+LIB_SEARCH_DIRS=`echo ${LIB_PATH} | sed -e 's/:/ /g' -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\\"\1\\");/g'`
 
 # Generate 5 or 6 script files from a master script template in
 # ${srcdir}/scripttempl/${SCRIPT_NAME}.sh.  Which one of the 5 or 6
@@ -181,9 +175,9 @@ if test -n "$GENERATE_SHLIB_SCRIPT"; then
   fi
 fi
 
-for i in $EMULATION_LIBPATH ; do
-  test "$i" = "$EMULATION_NAME" && COMPILE_IN=true
-done
+case " $EMULATION_LIBPATH " in
+    *" ${EMULATION_NAME} "*) COMPILE_IN=true;;
+esac
 
 # Generate e${EMULATION_NAME}.c.
 . ${srcdir}/emultempl/${TEMPLATE_NAME-generic}.em