dpdk-fm10k/buildtools/map-list-symbol.sh
David Marchand 3290ac14eb buildtools: detect discrepancies for experimental symbols
When promoting those symbols as stable, there is no check to ensure that
the final result is consistent.

Add a little script to get the symbols per section from the library map
files.
Validate that all experimental symbols in object files are referenced by
library map files.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
2019-06-29 19:04:32 +02:00

71 lines
1.1 KiB
Bash
Executable file

#!/bin/sh
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2018 David Marchand <david.marchand@redhat.com>
section=all
symbol=all
quiet=
while getopts 'S:s:q' name; do
case $name in
S)
[ $section = 'all' ] || {
echo 'Cannot list in multiple sections'
exit 1
}
section=$OPTARG
;;
s)
[ $symbol = 'all' ] || {
echo 'Cannot list multiple symbols'
exit 1
}
symbol=$OPTARG
;;
q)
quiet='y'
;;
?)
echo 'usage: $0 [-S section] [-s symbol] [-q]'
exit 1
;;
esac
done
shift $(($OPTIND - 1))
for file in $@; do
cat "$file" |awk '
BEGIN {
current_section = "";
if ("'$section'" == "all" && "'$symbol'" == "all") {
ret = 0;
} else {
ret = 1;
}
}
/^.*{/ {
if ("'$section'" == "all" || $1 == "'$section'") {
current_section = $1;
}
}
/.*}/ { current_section = ""; }
/^[^}].*[^:*];/ {
if (current_section != "") {
gsub(";","");
if ("'$symbol'" == "all" || $1 == "'$symbol'") {
ret = 0;
if ("'$quiet'" == "") {
print "'$file' "current_section" "$1;
}
if ("'$symbol'" != "all") {
exit 0;
}
}
}
}
END {
exit ret;
}'
done