| Manuel Pégourié-Gonnard | 3385cf4 | 2015-04-02 17:59:30 +0100 | [diff] [blame] | 1 | #!/bin/sh | 
| Bence Szépkúti | 700ee44 | 2020-05-26 00:33:31 +0200 | [diff] [blame] | 2 | # | 
| Bence Szépkúti | 1e14827 | 2020-08-07 13:07:28 +0200 | [diff] [blame] | 3 | # Copyright The Mbed TLS Contributors | 
| Bence Szépkúti | c7da1fe | 2020-05-26 01:54:15 +0200 | [diff] [blame] | 4 | # SPDX-License-Identifier: Apache-2.0 | 
|  | 5 | # | 
|  | 6 | # Licensed under the Apache License, Version 2.0 (the "License"); you may | 
|  | 7 | # not use this file except in compliance with the License. | 
|  | 8 | # You may obtain a copy of the License at | 
|  | 9 | # | 
|  | 10 | # http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 11 | # | 
|  | 12 | # Unless required by applicable law or agreed to in writing, software | 
|  | 13 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | 
|  | 14 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 15 | # See the License for the specific language governing permissions and | 
|  | 16 | # limitations under the License. | 
| Manuel Pégourié-Gonnard | 3385cf4 | 2015-04-02 17:59:30 +0100 | [diff] [blame] | 17 |  | 
|  | 18 | set -eu | 
|  | 19 |  | 
| Manuel Pégourié-Gonnard | d1ddd29 | 2015-04-09 10:15:10 +0200 | [diff] [blame] | 20 | if [ -d include/mbedtls ]; then :; else | 
|  | 21 | echo "$0: must be run from root" >&2 | 
|  | 22 | exit 1 | 
|  | 23 | fi | 
|  | 24 |  | 
| Manuel Pégourié-Gonnard | 3385cf4 | 2015-04-02 17:59:30 +0100 | [diff] [blame] | 25 | if grep -i cmake Makefile >/dev/null; then | 
| Manuel Pégourié-Gonnard | d1ddd29 | 2015-04-09 10:15:10 +0200 | [diff] [blame] | 26 | echo "$0: not compatible with cmake" >&2 | 
| Manuel Pégourié-Gonnard | 3385cf4 | 2015-04-02 17:59:30 +0100 | [diff] [blame] | 27 | exit 1 | 
|  | 28 | fi | 
|  | 29 |  | 
| Manuel Pégourié-Gonnard | 9afdc83 | 2015-08-04 17:15:13 +0200 | [diff] [blame] | 30 | cp include/mbedtls/config.h include/mbedtls/config.h.bak | 
| Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 31 | scripts/config.py full | 
| Jaeden Amero | 3b025ac | 2019-05-31 12:26:42 +0100 | [diff] [blame] | 32 | make clean | 
| Gilles Peskine | 9a52cf3 | 2019-05-22 18:22:58 +0200 | [diff] [blame] | 33 | make_ret= | 
| Jaeden Amero | 3b025ac | 2019-05-31 12:26:42 +0100 | [diff] [blame] | 34 | CFLAGS=-fno-asynchronous-unwind-tables make lib \ | 
| Gilles Peskine | 9a52cf3 | 2019-05-22 18:22:58 +0200 | [diff] [blame] | 35 | >list-symbols.make.log 2>&1 || | 
|  | 36 | { | 
|  | 37 | make_ret=$? | 
| Jaeden Amero | 3b025ac | 2019-05-31 12:26:42 +0100 | [diff] [blame] | 38 | echo "Build failure: CFLAGS=-fno-asynchronous-unwind-tables make lib" | 
| Gilles Peskine | 9a52cf3 | 2019-05-22 18:22:58 +0200 | [diff] [blame] | 39 | cat list-symbols.make.log >&2 | 
|  | 40 | } | 
|  | 41 | rm list-symbols.make.log | 
| Manuel Pégourié-Gonnard | 9afdc83 | 2015-08-04 17:15:13 +0200 | [diff] [blame] | 42 | mv include/mbedtls/config.h.bak include/mbedtls/config.h | 
| Gilles Peskine | 9a52cf3 | 2019-05-22 18:22:58 +0200 | [diff] [blame] | 43 | if [ -n "$make_ret" ]; then | 
|  | 44 | exit "$make_ret" | 
|  | 45 | fi | 
|  | 46 |  | 
| Manuel Pégourié-Gonnard | bf6ed08 | 2015-08-04 17:34:18 +0200 | [diff] [blame] | 47 | if uname | grep -F Darwin >/dev/null; then | 
| Christoph M. Wintersteiger | 9b33e7d | 2018-12-14 13:34:06 +0000 | [diff] [blame] | 48 | nm -gUj library/libmbed*.a 2>/dev/null | sed -n -e 's/^_//p' | grep -v -e ^FStar -e ^Hacl | 
| Manuel Pégourié-Gonnard | bf6ed08 | 2015-08-04 17:34:18 +0200 | [diff] [blame] | 49 | elif uname | grep -F Linux >/dev/null; then | 
| Christoph M. Wintersteiger | 9b33e7d | 2018-12-14 13:34:06 +0000 | [diff] [blame] | 50 | nm -og library/libmbed*.a | grep -v '^[^ ]*: *U \|^$\|^[^ ]*:$' | sed 's/^[^ ]* . //' | grep -v -e ^FStar -e ^Hacl | 
| Manuel Pégourié-Gonnard | bf6ed08 | 2015-08-04 17:34:18 +0200 | [diff] [blame] | 51 | fi | sort > exported-symbols | 
| Manuel Pégourié-Gonnard | 3385cf4 | 2015-04-02 17:59:30 +0100 | [diff] [blame] | 52 | make clean | 
|  | 53 |  | 
|  | 54 | wc -l exported-symbols |