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