From 4508789f4b5e0ece5620d35598aeeb7ecbe3e3aa Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 8 Jun 2012 21:32:43 -0400 Subject: [PATCH] Add test for static initializers and other C++ stuff --- src/Makefile.am | 3 ++- src/check-static-inits.sh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100755 src/check-static-inits.sh diff --git a/src/Makefile.am b/src/Makefile.am index 344cc57..98c6cd5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -190,8 +190,9 @@ indic_LDADD = libharfbuzz.la $(HBLIBS) dist_check_SCRIPTS = \ check-c-linkage-decls.sh \ check-header-guards.sh \ - check-internal-symbols.sh \ check-includes.sh \ + check-internal-symbols.sh \ + check-static-inits.sh \ $(NULL) if HAVE_ICU diff --git a/src/check-static-inits.sh b/src/check-static-inits.sh new file mode 100755 index 0000000..eb04a55 --- /dev/null +++ b/src/check-static-inits.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +LC_ALL=C +export LC_ALL + +test -z "$srcdir" && srcdir=. +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 + +echo "Checking that no object file has static initializers" +for obj in .libs/*.o; do + if objdump -t "$obj" | grep '[.]ctors'; then + echo "Ouch, $obj has static initializers" + stat=1 + fi +done + +echo "Checking that no object file has lazy static C++ constructors/destructors" +for obj in .libs/*.o; do + if objdump -t "$obj" | grep '__c'; then + echo "Ouch, $obj has lazy static C++ constructors/destructors" + stat=1 + fi +done + +exit $stat -- 2.7.4