From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id E1990322C for ; Sun, 27 May 2018 23:54:54 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 7BDF421B18; Sun, 27 May 2018 17:54:54 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sun, 27 May 2018 17:54:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=318xrhsdUC0HjB I4bWZX9NOmuM1vW/rD2KCsVVLlNOM=; b=QGDroq1Hng16EemWeES24zterJdfIW 2TBsMzUsNWrb3SKlugI2W2o83qus2jUi29llht3MvJgy3FT+a1EkG9omiC65M7uR os/HHbQ4pFR+s34l711DNmiKk7t5H5rVZvGk9ve3O5iNcC8WVWpWdUKYqabFnHGL cBRNJSQNQSnFM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=318xrhsdUC0HjBI4bWZX9NOmuM1vW/rD2KCsVVLlNOM=; b=AGQzqneo 11iY0h+YaBu2kBDTpUr3v9MV6amddxTfU60vLm/DbOqZBSmJJzHgLPCYInZShOtL gftuz0erPeMqavsX5SvPxPbJC1+DTbfZcIhDWYXO+le3C5VeSirFMUjTPuVRtIpZ JEukwFuxyeWgX4Q1cLxwdOqSwOU6s3l4HgAKtl7+HLX+yxQBem4jq4LqZZnisctQ XlgpDm676IoRe5BfuM0eYXuvcnMecG8rr31XzkotxLHzVKZn3fB+Bjtn93KnUAqE ETN0+oFBRazl3OaEtskqZqR4dbFDZr3vbnntzP/E6hpoKNEI82Kjq7/maqjng1w4 2cEgVI6oFvpoLQ== X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Sender: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id AC395E444F; Sun, 27 May 2018 17:54:53 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: Pavan Nikhilesh , Ferruh Yigit Date: Sun, 27 May 2018 23:54:47 +0200 Message-Id: <20180527215447.2841-1-thomas@monjalon.net> X-Mailer: git-send-email 2.16.2 In-Reply-To: <4156041.IfarTdeXU8@xps> References: <4156041.IfarTdeXU8@xps> Subject: [dpdk-dev] [PATCH v2] devtools: check orphan symbols in map files 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: , X-List-Received-Date: Sun, 27 May 2018 21:54:55 -0000 The script check-symbol-maps.sh finds the symbols exported in a map file but not referenced in the codebase. Suggested-by: Pavan Nikhilesh Signed-off-by: Thomas Monjalon --- v2: - rewrite Python script from Pavan in a smaller shell script - check symbol as whole word (-w) - print one symbol per line --- MAINTAINERS | 1 + devtools/check-symbol-maps.sh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100755 devtools/check-symbol-maps.sh diff --git a/MAINTAINERS b/MAINTAINERS index e56c72687..437777a22 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -81,6 +81,7 @@ F: devtools/check-dup-includes.sh F: devtools/check-maintainers.sh F: devtools/check-git-log.sh F: devtools/check-includes.sh +F: devtools/check-symbol-maps.sh F: devtools/checkpatches.sh F: devtools/get-maintainer.sh F: devtools/git-log-fixes.sh diff --git a/devtools/check-symbol-maps.sh b/devtools/check-symbol-maps.sh new file mode 100755 index 000000000..e137d48a4 --- /dev/null +++ b/devtools/check-symbol-maps.sh @@ -0,0 +1,30 @@ +#! /bin/sh -e +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018 Mellanox Technologies, Ltd + +cd $(dirname $0)/.. + +# speed up by ignoring Unicode details +export LC_ALL=C + +find_orphan_symbols () +{ + for map in $(find lib drivers -name '*.map') ; do + for sym in $(sed -rn 's,^([^}]*_.*);,\1,p' $map) ; do + if echo $sym | grep -q '^per_lcore_' ; then + continue + fi + if ! grep -q -r --exclude=$(basename $map) \ + -w $sym $(dirname $map) ; then + echo "$map: $sym" + fi + done + done +} + +orphan_symbols=$(find_orphan_symbols) +if [ -n "$orphan_symbols" ] ; then + echo "Found only in symbol map file:" + echo "$orphan_symbols" | sed 's,^,\t,' + exit 1 +fi -- 2.16.2