eal/memory: fix unused SIGBUS handler
[dpdk.git] / buildtools / check-symbols.sh
1 #!/bin/sh
2
3 # SPDX-License-Identifier: BSD-3-Clause
4
5 MAPFILE=$1
6 OBJFILE=$2
7
8 ROOTDIR=$(readlink -f $(dirname $(readlink -f $0))/..)
9 LIST_SYMBOL=$ROOTDIR/buildtools/map-list-symbol.sh
10 CHECK_SYMBOL_MAPS=$ROOTDIR/devtools/check-symbol-maps.sh
11
12 # added check for "make -C test/" usage
13 if [ ! -e $MAPFILE ] || [ ! -f $OBJFILE ]
14 then
15         exit 0
16 fi
17
18 if [ -d $MAPFILE ]
19 then
20         exit 0
21 fi
22
23 DUMPFILE=$(mktemp -t dpdk.${0##*/}.objdump.XXXXXX)
24 trap 'rm -f "$DUMPFILE"' EXIT
25 objdump -t $OBJFILE >$DUMPFILE
26
27 ret=0
28
29 if ! $CHECK_SYMBOL_MAPS $MAPFILE; then
30         ret=1
31 fi
32
33 for SYM in `$LIST_SYMBOL -S EXPERIMENTAL $MAPFILE |cut -d ' ' -f 3`
34 do
35         if grep -q "\.text.*[[:space:]]$SYM$" $DUMPFILE &&
36                 ! grep -q "\.text\.experimental.*[[:space:]]$SYM$" $DUMPFILE &&
37                 $LIST_SYMBOL -s $SYM $MAPFILE | grep -q EXPERIMENTAL
38         then
39                 cat >&2 <<- END_OF_MESSAGE
40                 $SYM is not flagged as experimental
41                 but is listed in version map
42                 Please add __rte_experimental to the definition of $SYM
43                 END_OF_MESSAGE
44                 ret=1
45         fi
46 done
47
48 # Filter out symbols suffixed with a . for icc
49 for SYM in `awk '{
50         if ($2 != "l" && $4 == ".text.experimental" && !($NF ~ /\.$/)) {
51                 print $NF
52         }
53 }' $DUMPFILE`
54 do
55         $LIST_SYMBOL -S EXPERIMENTAL -s $SYM -q $MAPFILE || {
56                 cat >&2 <<- END_OF_MESSAGE
57                 $SYM is flagged as experimental
58                 but is not listed in version map
59                 Please add $SYM to the version map
60                 END_OF_MESSAGE
61                 ret=1
62         }
63 done
64
65 for SYM in `$LIST_SYMBOL -S INTERNAL $MAPFILE |cut -d ' ' -f 3`
66 do
67         if grep -q "\.text.*[[:space:]]$SYM$" $DUMPFILE &&
68                 ! grep -q "\.text\.internal.*[[:space:]]$SYM$" $DUMPFILE
69         then
70                 cat >&2 <<- END_OF_MESSAGE
71                 $SYM is not flagged as internal
72                 but is listed in version map
73                 Please add __rte_internal to the definition of $SYM
74                 END_OF_MESSAGE
75                 ret=1
76         fi
77 done
78
79 # Filter out symbols suffixed with a . for icc
80 for SYM in `awk '{
81         if ($2 != "l" && $4 == ".text.internal" && !($NF ~ /\.$/)) {
82                 print $NF
83         }
84 }' $DUMPFILE`
85 do
86         $LIST_SYMBOL -S INTERNAL -s $SYM -q $MAPFILE || {
87                 cat >&2 <<- END_OF_MESSAGE
88                 $SYM is flagged as internal
89                 but is not listed in version map
90                 Please add $SYM to the version map
91                 END_OF_MESSAGE
92                 ret=1
93         }
94 done
95
96 exit $ret