about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrooks Moses <bmoses@google.com>2014-09-12 10:34:21 -0700
committerBrooks Moses <bmoses@google.com>2014-09-12 10:34:21 -0700
commita0db2d6209a3dabd32055bd3fcc4a76abcf07438 (patch)
treeaa299ffc87d5d7bbfcf76bb9b605bbad598bc2bb
parent4ddf6cb7a611804bd725a8f049931ea330aea4ac (diff)
downloadglibc-a0db2d6209a3dabd32055bd3fcc4a76abcf07438.tar.gz
glibc-a0db2d6209a3dabd32055bd3fcc4a76abcf07438.tar.xz
glibc-a0db2d6209a3dabd32055bd3fcc4a76abcf07438.zip
Import ldd patch from Ubuntu sources to allow ldd to work with non-executable files.
-rw-r--r--README.google7
-rw-r--r--elf/ldd.bash.in31
2 files changed, 16 insertions, 22 deletions
diff --git a/README.google b/README.google
index c9c9f962da..f8224bb444 100644
--- a/README.google
+++ b/README.google
@@ -118,7 +118,7 @@ include/alloca.h
   large stack with only 64kb of remaining space, which the upstream alloca
   heuristic is ill-equipped to deal with.
   Forward-ported from cl/51331379 (from cl/38559-p2).
-  (ppluzhnikov, google-local) 
+  (ppluzhnikov, google-local)
 
 locale/programs/locarchive.c
   Reduce starting table sizes for locale-archive file, since we use only a
@@ -379,3 +379,8 @@ elf/dl-support.c
   For b/15780211, revert local change to csu/elf-init.c and move
   initialization of __google_auxv earlier (in the fully-static link).
   (ppluzhnikov, google-local)
+
+elf/ldd.bash.in
+  Import ldd patches from Ubuntu source package.  This fixes the ability
+  of ldd to trace dependencies in non-executable dynamic libraries.
+  (bmoses, google-local)
diff --git a/elf/ldd.bash.in b/elf/ldd.bash.in
index 4ff140d302..5137346640 100644
--- a/elf/ldd.bash.in
+++ b/elf/ldd.bash.in
@@ -150,31 +150,23 @@ for file do
     echo "ldd: ${file}:" $"not regular file" >&2
     result=1
   elif test -r "$file"; then
-    test -x "$file" || echo 'ldd:' $"\
-warning: you do not have execution permission for" "\`$file'" >&2
     RTLD=
     ret=1
     for rtld in ${RTLDLIST}; do
       if test -x $rtld; then
-	verify_out=`${rtld} --verify "$file"`
-	ret=$?
-	case $ret in
-	[02]) RTLD=${rtld}; break;;
-	esac
+	dummy=`$rtld 2>&1` 
+	if test $? = 127; then
+	  verify_out=`${rtld} --verify "$file"`
+	  ret=$?
+	  case $ret in
+	  [02]) RTLD=${rtld}; break;;
+	  esac
+	fi
       fi
     done
     case $ret in
-    0)
-      # If the program exits with exit code 5, it means the process has been
-      # invoked with __libc_enable_secure.  Fall back to running it through
-      # the dynamic linker.
-      try_trace "$file"
-      rc=$?
-      if [ $rc = 5 ]; then
-	try_trace "$RTLD" "$file"
-	rc=$?
-      fi
-      [ $rc = 0 ] || result=1
+    0|2)
+      try_trace "$RTLD" "$file" || result=1
       ;;
     1)
       # This can be a non-ELF binary or no binary at all.
@@ -183,9 +175,6 @@ warning: you do not have execution permission for" "\`$file'" >&2
 	result=1
       }
       ;;
-    2)
-      try_trace "$RTLD" "$file" || result=1
-      ;;
     *)
       echo 'ldd:' ${RTLD} $"exited with unknown exit code" "($ret)" >&2
       exit 1