about summary refs log tree commit diff
path: root/elf/ldd.bash.in
diff options
context:
space:
mode:
Diffstat (limited to 'elf/ldd.bash.in')
-rw-r--r--elf/ldd.bash.in7
1 files changed, 7 insertions, 0 deletions
diff --git a/elf/ldd.bash.in b/elf/ldd.bash.in
index 8867211109..6ee9b60e51 100644
--- a/elf/ldd.bash.in
+++ b/elf/ldd.bash.in
@@ -50,6 +50,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
       --version           print version information and exit
   -d, --data-relocs       process data relocations
   -r, --function-relocs   process data and function relocations
+  -u, --unused            print unused direct dependencies
   -v, --verbose           print all information
 For bug reporting instructions, please see:
 <http://www.gnu.org/software/libc/bugs.html>."
@@ -71,6 +72,9 @@ For bug reporting instructions, please see:
     verbose=yes
     shift
     ;;
+  -u | --u | --un | --unu | --unus | --unuse | --unused)
+    unused=yes
+    shift
   --v | --ve | --ver)
     echo >&2 $"ldd: option \`$1' is ambiguous"
     exit 1
@@ -97,6 +101,9 @@ nonelf ()
 
 add_env="LD_TRACE_LOADED_OBJECTS=1 LD_WARN=$warn LD_BIND_NOW=$bind_now"
 add_env="$add_env LD_VERBOSE=$verbose"
+if test "$unused" = yes; then
+  add_env="$add_env LD_DEBUG="$LD_DEBUG${LD_DEBUG:+,}unused"
+fi
 case $# in
 0)
   echo >&2 'ldd:' $"missing file arguments"