platform_bionic/linker/ldd
Elliott Hughes 3a1936c62e ldd: slightly improve error message.
Before:

  $ ldd toybox
  toybox: not an ELF file

After

  $ ldd toybox
  toybox: cannot open

I've also sent a toybox patch upstream to make that:

  $ ldd toybox
  toybox: cannot open: No such file or directory

Test: manual
Change-Id: If961cdf6f2f2f8d4f6cdfcade9061e49a09d1f01
2019-06-27 13:50:31 -07:00

24 lines
357 B
Bash

#!/system/bin/sh
# Rather than have ldd and ldd64, this script does the right thing depending
# on the argument.
function error() {
echo "$1"
exit 1
}
[ $# -eq 1 ] || error "usage: ldd FILE"
what=$(file -L "$1")
case "$what" in
*32-bit*)
linker --list "$1"
;;
*64-bit*)
linker64 --list "$1"
;;
*)
error "$what"
;;
esac