summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Baran <marcinx.baran@intel.com>2019-11-20 17:23:39 +0000
committerDavid Marchand <david.marchand@redhat.com>2019-11-20 23:05:39 +0100
commit0533d2733be993be0b0b3a179a4d4bd01b3d23bd (patch)
treee28c7c7258eff046617473579eea3d57485e9560
parent85ff364f3bd32f6fb1fcd85d2bf1b08ad1092e1b (diff)
downloaddpdk-next-net-intel-0533d2733be993be0b0b3a179a4d4bd01b3d23bd.zip
dpdk-next-net-intel-0533d2733be993be0b0b3a179a4d4bd01b3d23bd.tar.gz
dpdk-next-net-intel-0533d2733be993be0b0b3a179a4d4bd01b3d23bd.tar.xz
buildtools: add ABI version check script
Add a shell script that checks whether built libraries are versioned with expected ABI (current ABI, current ABI + 1, or EXPERIMENTAL). The following command was used to verify current source tree (assuming build directory is in ./build): find ./build/lib ./build/drivers -name \*.so \ -exec ./buildtools/check-abi-version.sh {} \; -print Signed-off-by: Marcin Baran <marcinx.baran@intel.com> Signed-off-by: Pawel Modrak <pawelx.modrak@intel.com> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Thomas Monjalon <thomas@monjalon.net>
-rw-r--r--MAINTAINERS1
-rwxr-xr-xbuildtools/check-abi-version.sh54
2 files changed, 55 insertions, 0 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 88b5a12..9389eab 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -145,6 +145,7 @@ F: lib/librte_eal/common/include/rte_function_versioning.h
F: doc/guides/rel_notes/deprecation.rst
F: devtools/validate-abi.sh
F: devtools/check-symbol-change.sh
+F: buildtools/check-abi-version.sh
F: buildtools/check-experimental-syms.sh
F: buildtools/map-list-symbol.sh
F: buildtools/update-abi.sh
diff --git a/buildtools/check-abi-version.sh b/buildtools/check-abi-version.sh
new file mode 100755
index 0000000..9a3d135
--- /dev/null
+++ b/buildtools/check-abi-version.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+# Check whether library symbols have correct
+# version (provided ABI number or provided ABI
+# number + 1 or EXPERIMENTAL).
+# Args:
+# $1: path of the library .so file
+# $2: ABI major version number to check
+# (defaults to ABI_VERSION file value)
+
+if [ -z "$1" ]; then
+ echo "Script checks whether library symbols have"
+ echo "correct version (ABI_VER/ABI_VER+1/EXPERIMENTAL)"
+ echo "Usage:"
+ echo " $0 SO_FILE_PATH [ABI_VER]"
+ exit 1
+fi
+
+LIB="$1"
+DEFAULT_ABI=$(cat "$(dirname \
+ $(readlink -f $0))/../ABI_VERSION" | \
+ cut -d'.' -f 1)
+ABIVER="DPDK_${2-$DEFAULT_ABI}"
+NEXT_ABIVER="DPDK_$((${2-$DEFAULT_ABI}+1))"
+
+ret=0
+
+# get output of objdump
+OBJ_DUMP_OUTPUT=`objdump -TC --section=.text ${LIB} 2>&1 | grep ".text"`
+
+# there may not be any .text sections in the .so file, in which case exit early
+echo "${OBJ_DUMP_OUTPUT}" | grep "not found in any input file" -q
+if [ "$?" -eq 0 ]; then
+ exit 0
+fi
+
+# we have symbols, so let's see if the versions are correct
+for SYM in $(echo "${OBJ_DUMP_OUTPUT}" | awk '{print $(NF-1) "-" $NF}')
+do
+ version=$(echo $SYM | cut -d'-' -f 1)
+ symbol=$(echo $SYM | cut -d'-' -f 2)
+ case $version in (*"$ABIVER"*|*"$NEXT_ABIVER"*|"EXPERIMENTAL")
+ ;;
+ (*)
+ echo "Warning: symbol $symbol ($version) should be annotated " \
+ "as ABI version $ABIVER / $NEXT_ABIVER, or EXPERIMENTAL."
+ ret=1
+ ;;
+ esac
+done
+
+exit $ret