Make check-symbols.sh work on OS X

Note that the symbol types coming out of `nm` mean different things
from what they do on Linux, but now that we've removed a bunch of
should-be-private symbols, the remaining ones line up well.

Change-Id: I32fe02c46ea8029f846bd203b78aea8f98a8812f
This commit is contained in:
Tim Burke
2024-09-19 11:15:41 -07:00
parent ea534c61a9
commit af4077960a

View File

@@ -13,7 +13,11 @@
set -e
get() {
nm --dynamic --defined-only $1 | cut -c18- | LC_COLLATE=C sort
if [ "$( uname -s )" == "Darwin" ]; then
nm $1 | cut -c18- | grep -v '^[a-zU]' | sed -e 's/ _/ /' | LC_COLLATE=C sort
else
nm --dynamic --defined-only $1 | cut -c18- | LC_COLLATE=C sort
fi
}
check() {
@@ -36,10 +40,16 @@ case $1 in
exit 1
esac
if [ "$( uname -s )" == "Darwin" ]; then
ext=dylib
else
ext=so
fi
rc=0
for lib in $(find . -name '*.so') ; do
for lib in $(find . -name '*.so' -or -name '*.dylib' -not -name '*.1.dylib') ; do
echo "${func}ing $( basename $lib )"
if ! $func $lib $( basename ${lib/%.so/.sym} ) ; then
if ! $func $lib $( basename ${lib/%.$ext/.sym} ) ; then
rc=1
echo
fi