blob: ffdce8f357c8b8dc12c09a16c89fd422afa951e0 [file] [log] [blame]
Manuel Pégourié-Gonnard3385cf42015-04-02 17:59:30 +01001#!/bin/sh
2
3set -eu
4
Manuel Pégourié-Gonnardd1ddd292015-04-09 10:15:10 +02005if [ -d include/mbedtls ]; then :; else
6 echo "$0: must be run from root" >&2
7 exit 1
8fi
9
Manuel Pégourié-Gonnard3385cf42015-04-02 17:59:30 +010010if grep -i cmake Makefile >/dev/null; then
Manuel Pégourié-Gonnardd1ddd292015-04-09 10:15:10 +020011 echo "$0: not compatible with cmake" >&2
Manuel Pégourié-Gonnard3385cf42015-04-02 17:59:30 +010012 exit 1
13fi
14
Manuel Pégourié-Gonnard9afdc832015-08-04 17:15:13 +020015cp include/mbedtls/config.h include/mbedtls/config.h.bak
Manuel Pégourié-Gonnard3385cf42015-04-02 17:59:30 +010016scripts/config.pl full
Gilles Peskine9a52cf32019-05-22 18:22:58 +020017make_ret=
18CFLAGS=-fno-asynchronous-unwind-tables make clean lib \
19 >list-symbols.make.log 2>&1 ||
20 {
21 make_ret=$?
22 echo "Build failure: CFLAGS=-fno-asynchronous-unwind-tables make clean lib"
23 cat list-symbols.make.log >&2
24 }
25rm list-symbols.make.log
Manuel Pégourié-Gonnard9afdc832015-08-04 17:15:13 +020026mv include/mbedtls/config.h.bak include/mbedtls/config.h
Gilles Peskine9a52cf32019-05-22 18:22:58 +020027if [ -n "$make_ret" ]; then
28 exit "$make_ret"
29fi
30
Manuel Pégourié-Gonnardbf6ed082015-08-04 17:34:18 +020031if uname | grep -F Darwin >/dev/null; then
32 nm -gUj library/libmbed*.a 2>/dev/null | sed -n -e 's/^_//p'
33elif uname | grep -F Linux >/dev/null; then
34 nm -og library/libmbed*.a | grep -v '^[^ ]*: *U \|^$\|^[^ ]*:$' | sed 's/^[^ ]* . //'
35fi | sort > exported-symbols
Manuel Pégourié-Gonnard3385cf42015-04-02 17:59:30 +010036make clean
37
38wc -l exported-symbols