2018-05-27 21:54:47 +00:00
|
|
|
#! /bin/sh -e
|
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
# Copyright 2018 Mellanox Technologies, Ltd
|
|
|
|
|
|
|
|
cd $(dirname $0)/..
|
|
|
|
|
|
|
|
# speed up by ignoring Unicode details
|
|
|
|
export LC_ALL=C
|
|
|
|
|
2021-05-13 08:34:15 +00:00
|
|
|
if [ $# = 0 ] ; then
|
|
|
|
set -- $(find lib drivers -name '*.map')
|
|
|
|
fi
|
|
|
|
|
2020-10-16 10:27:11 +00:00
|
|
|
ret=0
|
|
|
|
|
2018-05-27 21:54:47 +00:00
|
|
|
find_orphan_symbols ()
|
|
|
|
{
|
2021-05-13 08:34:15 +00:00
|
|
|
for map in $@ ; do
|
2021-04-06 17:59:10 +00:00
|
|
|
for sym in $(sed -rn 's,^([^}]*_.*);.*$,\1,p' $map) ; do
|
2018-05-27 21:54:47 +00:00
|
|
|
if echo $sym | grep -q '^per_lcore_' ; then
|
2020-04-24 09:32:24 +00:00
|
|
|
symsrc=${sym#per_lcore_}
|
|
|
|
elif echo $sym | grep -q '^__rte_.*_trace_' ; then
|
|
|
|
symsrc=${sym#__}
|
|
|
|
else
|
|
|
|
symsrc=$sym
|
2018-05-27 21:54:47 +00:00
|
|
|
fi
|
2021-05-13 08:34:13 +00:00
|
|
|
if [ -z "$(grep -rlw $symsrc $(dirname $map) | grep -v $map)" ] ; then
|
2018-05-27 21:54:47 +00:00
|
|
|
echo "$map: $sym"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2021-05-13 08:34:15 +00:00
|
|
|
orphan_symbols=$(find_orphan_symbols $@)
|
2018-05-27 21:54:47 +00:00
|
|
|
if [ -n "$orphan_symbols" ] ; then
|
|
|
|
echo "Found only in symbol map file:"
|
|
|
|
echo "$orphan_symbols" | sed 's,^,\t,'
|
2020-10-16 10:27:11 +00:00
|
|
|
ret=1
|
2018-05-27 21:54:47 +00:00
|
|
|
fi
|
2020-10-16 10:27:11 +00:00
|
|
|
|
2021-05-13 08:34:14 +00:00
|
|
|
find_duplicate_symbols ()
|
|
|
|
{
|
2021-05-13 08:34:15 +00:00
|
|
|
for map in $@ ; do
|
2021-05-13 08:34:14 +00:00
|
|
|
buildtools/map-list-symbol.sh $map | \
|
|
|
|
sort | uniq -c | grep -v " 1 $map" || true
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2021-05-13 08:34:15 +00:00
|
|
|
duplicate_symbols=$(find_duplicate_symbols $@)
|
2021-05-13 08:34:14 +00:00
|
|
|
if [ -n "$duplicate_symbols" ] ; then
|
|
|
|
echo "Found duplicates in symbol map file:"
|
|
|
|
echo "$duplicate_symbols"
|
|
|
|
ret=1
|
|
|
|
fi
|
|
|
|
|
2022-03-08 21:02:48 +00:00
|
|
|
local_miss_maps=$(grep -L 'local: \*;' $@ || true)
|
2022-03-06 09:20:23 +00:00
|
|
|
if [ -n "$local_miss_maps" ] ; then
|
|
|
|
echo "Found maps without local catch-all:"
|
|
|
|
echo "$local_miss_maps"
|
|
|
|
ret=1
|
|
|
|
fi
|
|
|
|
|
2020-10-16 10:27:11 +00:00
|
|
|
exit $ret
|