Home | History | Annotate | Download | only in libc_no_atexit
      1 # Check that the libc.so for all platforms, and all architectures
      2 # Does not export 'atexit' and '__dso_handle' symbols.
      3 #
      4 export ANDROID_NDK_ROOT=$NDK
      5 
      6 NDK_BUILDTOOLS_PATH=$NDK/build/tools
      7 . $NDK/build/tools/prebuilt-common.sh
      8 echo DEFAULT_ARCHS=$DEFAULT_ARCHS
      9 
     10 LIBRARIES=
     11 for 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"
     14 done
     15 
     16 FAILURE=
     17 COUNT=0
     18 for 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
     31 done
     32 
     33 if [ "$COUNT" = 0 ]; then
     34   echo "ERROR: Did not find any libc.so in $NDK/platforms!"
     35   exit 1
     36 fi
     37 
     38 if [ "$FAILURE" ]; then
     39   exit 1
     40 else
     41   echo "All $COUNT libc.so are ok!"
     42   exit 0
     43 fi
     44