summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/dist/s_export
blob: 69afe8c8d643414d831f3ba78a2c9409bc6013d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#! /bin/sh

# Check for illegal external symbols.
#
t=__wt.$$
trap 'rm -f $t' 0 1 2 3 13 15

case `uname` in
Darwin)
    NM='nm -gUo $f | egrep " T | D " | sed "s/ _/ /"'
    ;;
*)
    # We require GNU nm, which may not be installed.
    type nm > /dev/null 2>&1 &&
        (nm --version | grep 'GNU nm') > /dev/null 2>&1 || {
        echo "$0 skipped: GNU nm not found"
        exit 0
    }
    NM='nm --extern-only --defined-only --print-file-name $f | egrep -v "__bss_start|_edata|_end|_fini|_init"'
    ;;
esac

check()
{
    (sed -e '/^#/d' s_export.list &&
    eval $NM |
    sed 's/.* //' |
    # Functions beginning with __ut are intentionally exposed to support unit testing when
    # Wiredtiger is compiled with HAVE_UNITTEST=1.
    egrep -v '^__ut' |
    egrep -v '^__wt') |
    sort |
    uniq -u |
    egrep -v \
        'lz4_extension_init|snappy_extension_init|zlib_extension_init|zstd_extension_init' > $t

    test -s $t && {
        echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
        echo 'unexpected external symbols in the WiredTiger library '"$f"
        echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
        cat $t
        exit 1
    }
}

# This check would normally be done after the library is built, but this way
# we don't forget about a symbol during development. We usually build in the
# top-level directories, check the previously built library,
# if it exists. And, allow this script to be run from the top-level directory
# as well as locally. (??? this last wasn't true before my changes and still
# isn't)
#
# Check all library images that appear; typically they will be one of
#    ../build/libwiredtiger.$ext                (cmake build)
#    ../cmake_build/libwiredtiger.$ext          (cmake build)

found=0
for f in $(find .. -name "libwiredtiger.*" -print); do
    case "$f" in
        *.a|*.so|*.dylib)
        check "$f"
        found=1
            ;;
        *)
        ;;
    esac
done

if [ $found = 0 ]; then
    echo "$0 skipped: libwiredtiger.[a|so|dylib] not found"
fi
exit 0