2012-06-09 03:32:43 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
LC_ALL=C
|
|
|
|
export LC_ALL
|
|
|
|
|
|
|
|
test -z "$srcdir" && srcdir=.
|
2018-01-05 10:12:20 +01:00
|
|
|
test -z "$libs" && libs=.libs
|
2012-06-09 03:32:43 +02:00
|
|
|
stat=0
|
|
|
|
|
|
|
|
if which objdump 2>/dev/null >/dev/null; then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
echo "check-static-inits.sh: 'objdump' not found; skipping test"
|
|
|
|
exit 77
|
|
|
|
fi
|
|
|
|
|
2018-01-04 07:41:34 +01:00
|
|
|
OBJS=$libs/*.o
|
2012-08-08 20:48:41 +02:00
|
|
|
if test "x`echo $OBJS`" = "x$OBJS" 2>/dev/null >/dev/null; then
|
|
|
|
echo "check-static-inits.sh: object files not found; skipping test"
|
|
|
|
exit 77
|
|
|
|
fi
|
|
|
|
|
2012-06-09 03:32:43 +02:00
|
|
|
echo "Checking that no object file has static initializers"
|
2012-08-08 20:48:41 +02:00
|
|
|
for obj in $OBJS; do
|
2014-10-01 17:56:07 +02:00
|
|
|
if objdump -t "$obj" | grep '[.][cd]tors' | grep -v '\<00*\>'; then
|
2014-10-01 17:55:14 +02:00
|
|
|
echo "Ouch, $obj has static initializers/finalizers"
|
2012-06-09 03:32:43 +02:00
|
|
|
stat=1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2012-08-29 01:08:36 +02:00
|
|
|
echo "Checking that no object file has lazy static C++ constructors/destructors or other such stuff"
|
2012-08-08 20:48:41 +02:00
|
|
|
for obj in $OBJS; do
|
2018-09-24 19:11:34 +02:00
|
|
|
if objdump -t "$obj" | grep -q '__cxa_' && ! objdump -t "$obj" | grep -q __ubsan_handle; then
|
|
|
|
objdump -t "$obj" | grep '__cxa_'
|
2012-08-29 01:08:36 +02:00
|
|
|
echo "Ouch, $obj has lazy static C++ constructors/destructors or other such stuff"
|
2012-06-09 03:32:43 +02:00
|
|
|
stat=1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
exit $stat
|