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>
This commit is contained in:
David Marchand 2019-06-29 13:58:48 +02:00 committed by Thomas Monjalon
parent da6cab7646
commit 3290ac14eb
3 changed files with 93 additions and 7 deletions

View file

@ -136,6 +136,7 @@ F: doc/guides/rel_notes/deprecation.rst
F: devtools/validate-abi.sh
F: devtools/check-symbol-change.sh
F: buildtools/check-experimental-syms.sh
F: buildtools/map-list-symbol.sh
Driver information
M: Neil Horman <nhorman@tuxdriver.com>

View file

@ -5,6 +5,8 @@
MAPFILE=$1
OBJFILE=$2
LIST_SYMBOL=$RTE_SDK/buildtools/map-list-symbol.sh
# added check for "make -C test/" usage
if [ ! -e $MAPFILE ] || [ ! -f $OBJFILE ]
then
@ -16,12 +18,9 @@ then
exit 0
fi
for i in `awk 'BEGIN {found=0}
/.*EXPERIMENTAL.*/ {found=1}
/.*}.*;/ {found=0}
/.*;/ {if (found == 1) print $1}' $MAPFILE`
ret=0
for SYM in `$LIST_SYMBOL -S EXPERIMENTAL $MAPFILE`
do
SYM=`echo $i | sed -e"s/;//"`
objdump -t $OBJFILE | grep -q "\.text.*$SYM$"
IN_TEXT=$?
objdump -t $OBJFILE | grep -q "\.text\.experimental.*$SYM$"
@ -33,8 +32,24 @@ do
but is listed in version map
Please add __rte_experimental to the definition of $SYM
END_OF_MESSAGE
exit 1
ret=1
fi
done
exit 0
for SYM in `objdump -t $OBJFILE |awk '{
if ($2 != "l" && $4 == ".text.experimental") {
print $NF
}
}'`
do
$LIST_SYMBOL -S EXPERIMENTAL -s $SYM -q $MAPFILE || {
cat >&2 <<- END_OF_MESSAGE
$SYM is flagged as experimental
but is not listed in version map
Please add $SYM to the version map
END_OF_MESSAGE
ret=1
}
done
exit $ret

70
buildtools/map-list-symbol.sh Executable file
View file

@ -0,0 +1,70 @@
#!/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