The script 'check-abi-version.sh' should be used to check whether built libraries are versioned with correct ABI number (provided ABI, provided ABI+1 or EXPERIMENTAL).
Signed-off-by: Marcin Baran <marcinx.ba...@intel.com> Signed-off-by: Pawel Modrak <pawelx.mod...@intel.com> --- buildtools/check-abi-version.sh | 46 +++++++++++++++++++++++++++++++++ buildtools/update_abi.sh | 41 +++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100755 buildtools/check-abi-version.sh create mode 100755 buildtools/update_abi.sh diff --git a/buildtools/check-abi-version.sh b/buildtools/check-abi-version.sh new file mode 100755 index 000000000..ead25c080 --- /dev/null +++ b/buildtools/check-abi-version.sh @@ -0,0 +1,46 @@ +#!/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))/../config/ABI_VERSION" | \ + cut -d'.' -f 1) +ABIVER="DPDK_${2-$DEFAULT_ABI}" +NEXT_ABIVER="DPDK_$((${2-$DEFAULT_ABI}+1))" + +ret=0 + +for SYM in `objdump -TC --section=.text ${LIB} | \ + grep -e "DPDK\|EXPERIMENTAL" | \ + 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 diff --git a/buildtools/update_abi.sh b/buildtools/update_abi.sh new file mode 100755 index 000000000..43ee79a92 --- /dev/null +++ b/buildtools/update_abi.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2019 Intel Corporation + +abi_version="" +abi_version_file="./config/ABI_VERSION" +update_path="lib drivers" + +if [ -z "$1" ] +then + echo "\$provide ABI version" +fi + +abi_version=$1 +abi_version_with_prefix="DPDK_$abi_version" + +if [ -n "$2" ] +then + abi_version_file=$2 +fi + +if [ -n "$3" ] +then + update_path=${@:3} +fi + +echo "New ABI version:" $abi_version +echo "ABI_VERSION path:" $abi_version_file +echo "Path to update:" $update_path + +echo $abi_version > $abi_version_file + +grep --binary-files=without-match --recursive --files-with-matches \ +--max-count=1 --include \*.c 'BIND_DEFAULT_SYMBOL\|VERSION_SYMBOL' \ +$update_path | xargs --max-lines=1 --verbose -I {} \ +./buildtools/update_default_symbol_abi.py {} \ +$abi_version_with_prefix + +find $update_path -name \*version.map -exec \ +./buildtools/update_version_map_abi.py {} \ +$abi_version_with_prefix \; -print -- 2.22.0.windows.1