Kill pthread_ops_hack
[deliverable/binutils-gdb.git] / ld / genscripts.sh
index 10623ecba5ffe6c6578d46061c250c90c9132432..f89b3cba8a4d65aa382490477293a5aab8172343 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 # genscripts.sh - generate the ld-emulation-target specific files
-# Copyright 2007 Free Software Foundation, Inc.
+# Copyright 2007, 2008 Free Software Foundation, Inc.
 #
 # This file is part of the Gnu Linker.
 #
@@ -198,6 +198,27 @@ if [ "x${LIB_PATH}" = "x" ] && [ "x${USE_LIBPATH}" = xyes ] ; then
     *:: | ::*) LIB_PATH=${LIB_PATH}${LIB_PATH2} ;;
     *) LIB_PATH=${LIB_PATH}:${LIB_PATH2} ;;
   esac
+
+  # For multilib'ed targets, ensure both ${target_alias}/lib${LIBPATH_SUFFIX}
+  # and ${TOOL_LIB}/lib${LIBPATH_SUFFIX} are in the default search path, because
+  # 64bit libraries may be in both places, depending on cross-development
+  # setup method (e.g.: /usr/s390x-linux/lib64 vs /usr/s390-linux/lib64)
+  case "${LIBPATH_SUFFIX}:${tool_lib}" in
+    :*) ;;
+    *:*${LIBPATH_SUFFIX}) ;;
+    *)
+      paths="${exec_prefix}/${target_alias}/lib${LIBPATH_SUFFIX}"
+      if [ x"${TOOL_LIB}" != x ]; then
+        paths="${paths} ${exec_prefix}/${TOOL_LIB}/lib${LIBPATH_SUFFIX}"
+      fi
+      for path in $paths; do
+        case :${LIB_PATH}: in
+          ::: | *:${path}:*) ;;
+          *) LIB_PATH=${path}:${LIB_PATH} ;;
+        esac
+      done
+    ;;
+  esac
 fi
 
 # Always search $(tooldir)/lib, aka /usr/local/TARGET/lib, except for
@@ -401,20 +422,17 @@ case " $EMULATION_LIBPATH " in
     *" ${EMULATION_NAME} "*) COMPILE_IN=true;;
 esac
 
-if test -n "${BASH+set}"; then
-  source_em()
-  {
-    local current_script="$em_script"
-    em_script=$1
-    . $em_script
-    em_script=$current_script
-  }
-  fragment()
-  {
-    local lineno=$[${BASH_LINENO[0]} + 1]
-    echo >> e${EMULATION_NAME}.c "#line $lineno \"$em_script\""
-    cat >> e${EMULATION_NAME}.c
-  }
+# PR ld/5652:
+# Determine if the shell has support for the variable BASH_LINENO.
+# When it is the case, it is only available inside functions.
+has_lineno()
+{
+  test "x$BASH_LINENO" != "x"
+}
+
+# Enable accruate error source in the compiler error messages, if possible.
+if has_lineno; then
+  . ${srcdir}/genscrba.sh
 else
   source_em()
   {
This page took 0.024535 seconds and 4 git commands to generate.