update from main archive 960921
[glibc.git] / elf / ldd.sh.in
blob78fda69d22ff41a407fc61bef4a3fdb0c7bcd595
1 #! /bin/sh
3 # This is the `ldd' command, which lists what shared libraries are
4 # used by given dynamically-linked executables. It works by invoking the
5 # run-time dynamic linker as a command and giving it the special `--list'
6 # switch.
8 RTLD=@RTLD@
10 case $# in
12 echo >&2 "Usage: $0 FILE..."
13 exit 1 ;;
15 # We don't list the file name when there is only one.
16 case "$1" in
17 /*) file="$1" ;;
18 *) file="./$1" ;;
19 esac
20 if ${RTLD} --verify "$file"; then
21 LD_TRACE_LOADED_OBJECTS=1 exec ${RTLD} "$file" && exit 1
22 else
23 echo ' not a dynamic executable'
25 exit ;;
27 set -e # Bail out immediately if ${RTLD} loses on any argument.
28 for file; do
29 echo "${file}:"
30 case "$file" in
31 /*) file="$file" ;;
32 *) file="./$file" ;;
33 esac
34 if ${RTLD} --verify "$file"; then
35 LD_TRACE_LOADED_OBJECTS=1 ${RTLD} "$file"
36 else
37 echo ' not a dynamic executable'
39 done
40 esac
42 exit 0