diff --git a/MAINTAINERS b/MAINTAINERS index bbec1982cc..285ace55c0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -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 diff --git a/buildtools/check-experimental-syms.sh b/buildtools/check-experimental-syms.sh index 7d1f3a568a..653756e274 100755 --- a/buildtools/check-experimental-syms.sh +++ b/buildtools/check-experimental-syms.sh @@ -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 diff --git a/buildtools/map-list-symbol.sh b/buildtools/map-list-symbol.sh new file mode 100755 index 0000000000..5509b4a7fa --- /dev/null +++ b/buildtools/map-list-symbol.sh @@ -0,0 +1,70 @@ +#!/bin/sh +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 David Marchand + +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