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 | # |
| 3 | # Copyright (C) 2015-2019, Arm Limited, All Rights Reserved |
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. |
Bence Szépkúti | 700ee44 | 2020-05-26 00:33:31 +0200 | [diff] [blame] | 17 | # |
| 18 | # This file is part of Mbed TLS (https://tls.mbed.org) |
Manuel Pégourié-Gonnard | 3385cf4 | 2015-04-02 17:59:30 +0100 | [diff] [blame] | 19 | |
| 20 | set -eu |
| 21 | |
Manuel Pégourié-Gonnard | d1ddd29 | 2015-04-09 10:15:10 +0200 | [diff] [blame] | 22 | if [ -d include/mbedtls ]; then :; else |
| 23 | echo "$0: must be run from root" >&2 |
| 24 | exit 1 |
| 25 | fi |
| 26 | |
Manuel Pégourié-Gonnard | 3385cf4 | 2015-04-02 17:59:30 +0100 | [diff] [blame] | 27 | if grep -i cmake Makefile >/dev/null; then |
Manuel Pégourié-Gonnard | d1ddd29 | 2015-04-09 10:15:10 +0200 | [diff] [blame] | 28 | echo "$0: not compatible with cmake" >&2 |
Manuel Pégourié-Gonnard | 3385cf4 | 2015-04-02 17:59:30 +0100 | [diff] [blame] | 29 | exit 1 |
| 30 | fi |
| 31 | |
Manuel Pégourié-Gonnard | 9afdc83 | 2015-08-04 17:15:13 +0200 | [diff] [blame] | 32 | cp include/mbedtls/config.h include/mbedtls/config.h.bak |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 33 | scripts/config.py full |
Jaeden Amero | 3b025ac | 2019-05-31 12:26:42 +0100 | [diff] [blame] | 34 | make clean |
Gilles Peskine | 9a52cf3 | 2019-05-22 18:22:58 +0200 | [diff] [blame] | 35 | make_ret= |
Jaeden Amero | 3b025ac | 2019-05-31 12:26:42 +0100 | [diff] [blame] | 36 | CFLAGS=-fno-asynchronous-unwind-tables make lib \ |
Gilles Peskine | 9a52cf3 | 2019-05-22 18:22:58 +0200 | [diff] [blame] | 37 | >list-symbols.make.log 2>&1 || |
| 38 | { |
| 39 | make_ret=$? |
Jaeden Amero | 3b025ac | 2019-05-31 12:26:42 +0100 | [diff] [blame] | 40 | echo "Build failure: CFLAGS=-fno-asynchronous-unwind-tables make lib" |
Gilles Peskine | 9a52cf3 | 2019-05-22 18:22:58 +0200 | [diff] [blame] | 41 | cat list-symbols.make.log >&2 |
| 42 | } |
| 43 | rm list-symbols.make.log |
Manuel Pégourié-Gonnard | 9afdc83 | 2015-08-04 17:15:13 +0200 | [diff] [blame] | 44 | mv include/mbedtls/config.h.bak include/mbedtls/config.h |
Gilles Peskine | 9a52cf3 | 2019-05-22 18:22:58 +0200 | [diff] [blame] | 45 | if [ -n "$make_ret" ]; then |
| 46 | exit "$make_ret" |
| 47 | fi |
| 48 | |
Manuel Pégourié-Gonnard | bf6ed08 | 2015-08-04 17:34:18 +0200 | [diff] [blame] | 49 | if uname | grep -F Darwin >/dev/null; then |
Christoph M. Wintersteiger | 9b33e7d | 2018-12-14 13:34:06 +0000 | [diff] [blame] | 50 | 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] | 51 | elif uname | grep -F Linux >/dev/null; then |
Christoph M. Wintersteiger | 9b33e7d | 2018-12-14 13:34:06 +0000 | [diff] [blame] | 52 | 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] | 53 | fi | sort > exported-symbols |
Manuel Pégourié-Gonnard | 3385cf4 | 2015-04-02 17:59:30 +0100 | [diff] [blame] | 54 | make clean |
| 55 | |
| 56 | wc -l exported-symbols |