• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Check that the libc.so for all platforms, and all architectures
2# Does not export 'atexit' and '__dso_handle' symbols.
3#
4export ANDROID_NDK_ROOT=$NDK
5
6NDK_BUILDTOOLS_PATH=$NDK/build/tools
7. $NDK/build/tools/prebuilt-common.sh
8echo DEFAULT_ARCHS=$DEFAULT_ARCHS
9
10LIBRARIES=
11for ARCH in $DEFAULT_ARCHS; do
12  LIB=$(cd $NDK && find platforms -name "libc.so" | sed -e 's!^!'$NDK'/!' | grep arch-$ARCH)
13  LIBRARIES=$LIBRARIES" $LIB"
14done
15
16FAILURE=
17COUNT=0
18for LIB in $LIBRARIES; do
19  COUNT=$(( $COUNT + 1 ))
20  echo "Checking: $LIB"
21  readelf -s $LIB | grep -q -F " atexit"
22  if [ $? = 0 ]; then
23    echo "ERROR: $NDK/$LIB exposes 'atexit'!" >&2
24    FAILURE=true
25  fi
26  readelf -s $LIB | grep -q -F " __dso_handle"
27  if [ $? = 0 ]; then
28    echo "ERROR: $NDK/$LIB exposes '__dso_handle'!" >&2
29    FAILURE=true
30  fi
31done
32
33if [ "$COUNT" = 0 ]; then
34  echo "ERROR: Did not find any libc.so in $NDK/platforms!"
35  exit 1
36fi
37
38if [ "$FAILURE" ]; then
39  exit 1
40else
41  echo "All $COUNT libc.so are ok!"
42  exit 0
43fi
44