aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog13
-rw-r--r--ld/configure.host27
-rw-r--r--ld/configure.tgt15
-rw-r--r--ld/emulparams/elf32ppc.sh19
-rw-r--r--ld/emulparams/elf64ppc.sh19
-rwxr-xr-xld/genscripts.sh30
6 files changed, 83 insertions, 40 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 336a326..57ef8c9 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,18 @@
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
calling lang_add_entry.
diff --git a/ld/configure.host b/ld/configure.host
index 65c2fc7..974a23b 100644
--- a/ld/configure.host
+++ b/ld/configure.host
@@ -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-*-*)
diff --git a/ld/configure.tgt b/ld/configure.tgt
index 4961908..c2b4927 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -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 ;;
diff --git a/ld/emulparams/elf32ppc.sh b/ld/emulparams/elf32ppc.sh
index 261e4bf..f88198f 100644
--- a/ld/emulparams/elf32ppc.sh
+++ b/ld/emulparams/elf32ppc.sh
@@ -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
diff --git a/ld/emulparams/elf64ppc.sh b/ld/emulparams/elf64ppc.sh
index a6b3ec5..f1647d5 100644
--- a/ld/emulparams/elf64ppc.sh
+++ b/ld/emulparams/elf64ppc.sh
@@ -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
diff --git a/ld/genscripts.sh b/ld/genscripts.sh
index fe1fa49..36e0a9d 100755
--- a/ld/genscripts.sh
+++ b/ld/genscripts.sh
@@ -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