71551cbd4c81aa7e6e07ec9cc80f27d89d1214a7
[platform/upstream/harfbuzz.git] / src / check-static-inits.sh
1 #!/bin/sh
2
3 LC_ALL=C
4 export LC_ALL
5
6 test -z "$srcdir" && srcdir=.
7 test -z "$libs" && libs=.libs
8 stat=0
9
10
11 if which objdump 2>/dev/null >/dev/null; then
12         :
13 else
14         echo "check-static-inits.sh: 'objdump' not found; skipping test"
15         exit 77
16 fi
17
18 OBJS=$libs/*.o
19 if test "x`echo $OBJS`" = "x$OBJS" 2>/dev/null >/dev/null; then
20         echo "check-static-inits.sh: object files not found; skipping test"
21         exit 77
22 fi
23
24 echo "Checking that no object file has static initializers"
25 for obj in $OBJS; do
26         if objdump -t "$obj" | grep '[.][cd]tors' | grep -v '\<00*\>'; then
27                 echo "Ouch, $obj has static initializers/finalizers"
28                 stat=1
29         fi
30 done
31
32 echo "Checking that no object file has lazy static C++ constructors/destructors or other such stuff"
33 for obj in $OBJS; do
34         if objdump -t "$obj" | grep '__cxa_'; then
35                 echo "Ouch, $obj has lazy static C++ constructors/destructors or other such stuff"
36                 stat=1
37         fi
38 done
39
40 exit $stat