From a02d86484be870615297abfc7be9f94645434762 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 8 Aug 2012 18:04:29 -0400 Subject: [PATCH] Add check-exported-symbols.sh And misc linking fixes. --- src/Makefile.am | 1 + src/check-exported-symbols.sh | 40 ++++++++++++++++++++++++++++++++ src/check-internal-symbols.sh | 2 +- src/hb-ot-shape-complex-indic.cc | 2 +- src/hb-ot-shape.cc | 6 ++--- 5 files changed, 46 insertions(+), 5 deletions(-) create mode 100755 src/check-exported-symbols.sh diff --git a/src/Makefile.am b/src/Makefile.am index d8f7502b..5894b205 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -241,6 +241,7 @@ test_would_substitute_LDADD = libharfbuzz.la $(HBLIBS) $(FREETYPE_LIBS) dist_check_SCRIPTS = \ check-c-linkage-decls.sh \ check-header-guards.sh \ + check-exported-symbols.sh \ check-includes.sh \ check-internal-symbols.sh \ check-static-inits.sh \ diff --git a/src/check-exported-symbols.sh b/src/check-exported-symbols.sh new file mode 100755 index 00000000..a7d6f9b6 --- /dev/null +++ b/src/check-exported-symbols.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +LC_ALL=C +export LC_ALL + +test -z "$srcdir" && srcdir=. +test -z "$MAKE" && MAKE=make +stat=0 + +if which nm 2>/dev/null >/dev/null; then + : +else + echo "check-exported-symbols.sh: 'nm' not found; skipping test" + exit 77 +fi + +defs="harfbuzz.def" +$MAKE $defs > /dev/null +tested=false +for def in $defs; do + lib=`echo "$def" | sed 's/[.]def$//;s@.*/@@'` + so=.libs/lib${lib}.so + if test -f "$so"; then + echo "Checking that $so has the same symbol list as $def" + { + echo EXPORTS + nm "$so" | grep ' [BCDGINRSTVW] ' | grep -v ' T _fini\>\| T _init\>' | cut -d' ' -f3 + stat=1 + # cheat: copy the last line from the def file! + tail -n1 "$def" + } | diff "$def" - >&2 || stat=1 + tested=true + fi +done +if ! $tested; then + echo "check-exported-symbols.sh: libharfbuzz shared library not found; skipping test" + exit 77 +fi + +exit $stat diff --git a/src/check-internal-symbols.sh b/src/check-internal-symbols.sh index 7ad57431..f48d1448 100755 --- a/src/check-internal-symbols.sh +++ b/src/check-internal-symbols.sh @@ -19,7 +19,7 @@ for suffix in .so; do so=`echo .libs/libharfbuzz$suffix` if test -f "$so"; then echo "Checking that we are not exposing internal symbols" - if nm $so | grep ' [TW] ' | grep -v ' T _fini\>\| T _init\>\| T hb_'; then + if nm "$so" | grep ' [BCDGINRSTVW] ' | grep -v ' T _fini\>\| T _init\>\| T hb_'; then echo "Ouch, internal symbols exposed" stat=1 fi diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 0dbf412e..4f9a5af9 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -57,7 +57,7 @@ indic_options_init (void) return u; } -inline indic_options_t +static inline indic_options_t indic_options (void) { static indic_options_union_t options; diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 4c055d33..d1e1d6c6 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -40,7 +40,7 @@ #include "hb-set-private.hh" -hb_tag_t common_features[] = { +static hb_tag_t common_features[] = { HB_TAG('c','c','m','p'), HB_TAG('l','i','g','a'), HB_TAG('l','o','c','l'), @@ -50,7 +50,7 @@ hb_tag_t common_features[] = { }; -hb_tag_t horizontal_features[] = { +static hb_tag_t horizontal_features[] = { HB_TAG('c','a','l','t'), HB_TAG('c','l','i','g'), HB_TAG('c','u','r','s'), @@ -63,7 +63,7 @@ hb_tag_t horizontal_features[] = { * According to the spec, valt and vpal are also mutually exclusive. * But we apply them all for now. */ -hb_tag_t vertical_features[] = { +static hb_tag_t vertical_features[] = { HB_TAG('v','a','l','t'), HB_TAG('v','e','r','t'), HB_TAG('v','k','r','n'), -- GitLab