From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A500EA2EDB for ; Mon, 30 Sep 2019 11:22:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CC74349DF; Mon, 30 Sep 2019 11:22:41 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id D234A49DF for ; Mon, 30 Sep 2019 11:22:39 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Sep 2019 02:22:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,565,1559545200"; d="scan'208";a="204792635" Received: from baranmx-mobl.ger.corp.intel.com ([10.103.104.83]) by fmsmga001.fm.intel.com with ESMTP; 30 Sep 2019 02:22:38 -0700 From: Marcin Baran To: dev@dpdk.org, bruce.richardson@intel.com, ray.kinsella@intel.com Cc: Marcin Baran , Pawel Modrak Date: Mon, 30 Sep 2019 11:21:34 +0200 Message-Id: <20190930092139.2440-3-marcinx.baran@intel.com> X-Mailer: git-send-email 2.22.0.windows.1 In-Reply-To: <20190930092139.2440-1-marcinx.baran@intel.com> References: <20190930092139.2440-1-marcinx.baran@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 3/8] buildtools: add ABI versioning check script X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Signed-off-by: Pawel Modrak --- 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