summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1998-08-20 22:02:17 +0000
committerRoland McGrath <roland@gnu.org>1998-08-20 22:02:17 +0000
commit926e512f4086995379623feab2146a96ca2f9d92 (patch)
tree268aa06d3a1169dd1bb299cdcfb695804c645ec2 /elf
parentd762684b511b6a425d9e0e2ff7473ffbfc98687d (diff)
downloadglibc-926e512f4086995379623feab2146a96ca2f9d92.tar.gz
glibc-926e512f4086995379623feab2146a96ca2f9d92.tar.xz
glibc-926e512f4086995379623feab2146a96ca2f9d92.zip
1998-08-21 Roland McGrath <roland@baalperazim.frob.com>
* elf/ldd.bash.in (TEXTDOMAIN, TEXTDOMAINDIR): Surround setting these 
with magic comments ###BASH-ONLY and ###END-BASH-ONLY. 
* elf/Makefile ($(objpfx)ldd): Generate always from ldd.bash.in. 
(common-ldd-rewrite): New variable, old contents of $(sh-ldd-rewrite). 
(sh-ldd-rewrite): Use that, add cmds to remove code surrounded by 
those magic comments, and to use /bin/sh for @BASH@. 
(bash-ldd-rewrite): Use $(common-ldd-rewrite). 
* elf/ldd.sh.in: File removed.
Diffstat (limited to 'elf')
-rw-r--r--elf/Makefile10
-rw-r--r--elf/ldd.bash.in2
-rw-r--r--elf/ldd.sh.in186
3 files changed, 8 insertions, 190 deletions
diff --git a/elf/Makefile b/elf/Makefile
index ead48f5850..3771ffb685 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -164,9 +164,11 @@ $(inst_slibdir)/$(rtld-installed-name): \
 	$(make-shlib-link)
 
 
-sh-ldd-rewrite = -e 's%@RTLD@%$(slibdir)/$(rtld-installed-name)%g' \
-		 -e 's%@VERSION@%$(version)%g'
-bash-ldd-rewrite = $(sh-ldd-rewrite) -e 's%@BASH@%$(BASH)%g' \
+common-ldd-rewrite = -e 's%@RTLD@%$(slibdir)/$(rtld-installed-name)%g' \
+		     -e 's%@VERSION@%$(version)%g'
+sh-ldd-rewrite = $(common-ldd-rewrite) -e 's%@BASH@%/bin/sh%g' \
+		 -e 's/\$$"/"/g;/^\#\#\#BASH-ONLY/,/\#\#\#END-BASH-ONLY/d'
+bash-ldd-rewrite = $(common-ldd-rewrite) -e 's%@BASH@%$(BASH)%g' \
 		   -e 's%@TEXTDOMAINDIR@%$(localedir)%g'
 
 ifneq ($(have-bash2),yes)
@@ -185,7 +187,7 @@ sed $($(ldd-shell)-ldd-rewrite) < $< | sed -f $(ldd-rewrite-script) > $@.new
 endef
 endif
 
-$(objpfx)ldd: ldd.$(ldd-shell).in $(common-objpfx)soversions.mk \
+$(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \
 	      $(common-objpfx)config.make
 	$(gen-ldd)
 	chmod 555 $@.new
diff --git a/elf/ldd.bash.in b/elf/ldd.bash.in
index f6ffa6b4e8..f0d50e4430 100644
--- a/elf/ldd.bash.in
+++ b/elf/ldd.bash.in
@@ -24,9 +24,11 @@
 # run-time dynamic linker as a command and setting the environment
 # variable LD_TRACE_LOADED_OBJECTS to a non-empty value.
 
+###BASH-ONLY
 # We should be able to find the translation right at the beginning.
 TEXTDOMAIN=libc
 TEXTDOMAINDIR=@TEXTDOMAINDIR@
+###END-BASH-ONLY
 
 RTLD=@RTLD@
 warn=
diff --git a/elf/ldd.sh.in b/elf/ldd.sh.in
deleted file mode 100644
index 4eda958b4b..0000000000
--- a/elf/ldd.sh.in
+++ /dev/null
@@ -1,186 +0,0 @@
-#! /bin/sh
-
-# Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
-# This file is part of the GNU C Library.
-
-# The GNU C Library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-
-# The GNU C Library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Library General Public License for more details.
-
-# You should have received a copy of the GNU Library General Public
-# License along with the GNU C Library; see the file COPYING.LIB.  If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-
-# This is the `ldd' command, which lists what shared libraries are
-# used by given dynamically-linked executables.  It works by invoking the
-# run-time dynamic linker as a command and setting the environment
-# variable LD_TRACE_LOADED_OBJECTS to a non-empty value.
-
-RTLD=@RTLD@
-warn=
-bind_now=
-
-while test $# -gt 0; do
-  case "$1" in
-  --vers | --versi | --versio | --version)
-    echo 'ldd (GNU libc) @VERSION@
-Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
-This is free software; see the source for copying conditions.  There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-Written by Roland McGrath and Ulrich Drepper.'
-    exit 0
-    ;;
-  --h | --he | --hel | --help)
-    echo "ldd [OPTION]... FILE...
-      --help              print this help and exit
-      --version           print version information and exit
-  -d, --data-relocs       process data relocations
-  -r, --function-relocs   process data and function relocations
-  -v, --verbose           print all information
-Report bugs using the \`glibcbug' script to <bugs@gnu.org>."
-    exit 0
-    ;;
-  -d | --d | --da | --dat | --data | --data- | --data-r | --data-re | \
-  --data-rel | --data-relo | --data-reloc | --data-relocs)
-    warn=yes
-    shift
-    ;;
-  -r | --f | --fu | --fun | --func | --funct | --functi | --functio | \
-  --function | --function- | --function-r | --function-re | --function-rel | \
-  --function-relo | --function-reloc | --function-relocs)
-    warn=yes
-    bind_now=yes
-    shift
-    ;;
-  -v | --verb | --verbo | --verbos | --verbose)
-    verbose=yes
-    shift
-    ;;
-  --v | --ve | --ver)
-    echo >&2 "ldd: option \`$1' is ambiguous"
-    exit 1
-    ;;
-  --)		# Stop option processing.
-    shift; break
-    ;;
-  -*)
-    echo >&2 "\
-ldd: unrecognized option \`$1'
-Try \`ldd --help' for more information."
-    exit 1
-    ;;
-  *)
-    break
-    ;;
-  esac
-done
-
-nonelf ()
-{
-  # Maybe extra code for non-ELF binaries.
-  return 1;
-}
-
-add_env="LD_TRACE_LOADED_OBJECTS=1 LD_WARN=$warn LD_BIND_NOW=$bind_now"
-add_env="$add_env LD_VERBOSE=$verbose"
-case $# in
-0)
-  echo >&2 "\
-ldd: missing file arguments
-Try \`ldd --help' for more information."
-  exit 1
-  ;;
-1)
-  # We don't list the file name when there is only one.
-  case "$1" in
-  */*) file="$1"
-       ;;
-  *) file="./$1"
-     ;;
-  esac
-  if test ! -f "$file"; then
-    echo "ldd: ${file}: no such file"
-    exit 1
-  else
-    if test -r "$file"; then
-      test -x "$file" ||
-	echo "\
-ldd: warning: you do not have execution permission for \`$file'" >&2
-      verify_out=`${RTLD} --verify "$file"`
-      case $? in
-      0)
-	eval $add_env exec '"$file"' || exit 1
-	;;
-      1)
-        nonelf $file ||
-	echo '	not a dynamic executable'
-	exit 1
-	;;
-      2)
-	eval $add_env exec \${RTLD} '"$file"' || exit 1
-	;;
-      *)
-	echo "ldd: ${RTLD} exited with unknown exit code ($?)" >&2
-	exit 1
-	;;
-      esac
-    else
-      echo "ldd: error: you do not have read permission for \`$file'" >&2
-      exit 1
-    fi
-  fi
-  exit
-  ;;
-*)
-  set -e	# Bail out immediately if ${RTLD} loses on any argument.
-  result=0
-  for file; do
-    echo "${file}:"
-    case "$file" in
-    */*) :
-         ;;
-    *) file="./$file"
-       ;;
-    esac
-    if test ! -f "$file"; then
-      echo "ldd: ${file}: no such file"
-      result=1
-    else
-      if test -r "$file"; then
-	test -x "$file" || echo "\
-ldd: warning: you do not have execution permission for \`$file'" >&2
-	verify_out=`${RTLD} --verify "$file"`
-	case $? in
-	0)
-	  eval $add_env '"$file"' || result=1
-	  ;;
-	1)
-          nonelf $file ||
-	  echo '	not a dynamic executable'
-	  result=1
-	  ;;
-	2)
-	  eval $add_env ${RTLD} '"$file"' || result=1
-	  ;;
-	*)
-	  echo "ldd: ${RTLD} exited with unknown exit code ($?)" >&2
-	  exit 1
-	  ;;
-	esac
-      else
-	echo "ldd: error: you do not have read permission for \`$file'" >&2
-	result=1
-      fi
-    fi
-  done
-esac
-
-exit $result