[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH v2] automation: add linker symbol name script


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: <victorm.lira@xxxxxxx>
  • Date: Wed, 24 Jul 2024 10:52:06 -0700
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QSG+4QXsyKI+tdBgDmtpUygqksz8xeQoqV4gwUkde9s=; b=tnYSxYx7Jmv8MyMkL6U5V1DOJzI042nd4/4RwwEg3pTU+cFjmloepNJsLHIeKykTmjBx/ZpMvPFlQq44lRyNObb7sfUYzRRbTEi+vdZZm8PNefIiJlL8wUCPF5/vKQ/77FD5HvplXFMz8kPJwrbhaeqglCfn53PAiyJMJs2FGnl+Pa6ugk5N4Qfn7fzu8TrRTIAk8Df4L7vGDQfjUXMcPAVrakz+p1vrg7exG1DdxRt8ypRsYifSBlfsxMClg+H/NiOSWxOfhWT/8uebXUUMkO7jO0S+1k6wfhSIyC9stAHE9iRk/iCIQ/2qdBvvArO3pxs7MPZjSoDXR3q6uB8byg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=E3qEj7ADIi3WXMC5aXGqCHYV7Uk5oY01kvVCDIuMWtW7cAZ6LStISe78Ti8U/RLkLNL2AC//nrwE2foRnQmsvzkFrntzZlour2OMrh9ETsaXGol9GBL8osfak60OpmWYtbeXoklUMt1gUr9HasHIPF0AcvzPvrzaVcRRQzPimE59/VTdxv9hBeTwmUBanM1n8ncmu22v9ElS+EnDiCr0IbGLWs/6ZBJ1Vf0fuskpXQXbDi+XtZ7qAZ2SADqVZSTeJr7psr3M779Xsk4fdtUEMdyvlbO6MzjPKNAfzvgRQwY/SDk90N5NXcuLPrtpwP2Lem0EZkid7/5KE0GaID/zIA==
  • Cc: Victor Lira <victorm.lira@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, <roberto.bagnara@xxxxxxxxxxx>, <consulting@xxxxxxxxxxx>, <simone.ballarin@xxxxxxxxxxx>
  • Delivery-date: Wed, 24 Jul 2024 17:52:36 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

From: Victor Lira <victorm.lira@xxxxxxx>

Signed-off-by: Victor Lira <victorm.lira@xxxxxxx>
Requested-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
Notes:
This is a utilty script for help with the MISRA process.
This script matches all linker symbol names in linker script files for
arm and x86.
Not included are symbol names starting with "." or symbol names enclosed
in quotes since the files dont't use any. The regular expression also does
not match for "&=" and similar compound assignments.
---
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Cc: roberto.bagnara@xxxxxxxxxxx
Cc: consulting@xxxxxxxxxxx
Cc: simone.ballarin@xxxxxxxxxxx
---
Changes v2:
- address style comments
- updated script to use .lds instead of .lds.S
- remove sample output from patch
---
 automation/eclair_analysis/linker-symbols.sh | 34 ++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100755 automation/eclair_analysis/linker-symbols.sh

diff --git a/automation/eclair_analysis/linker-symbols.sh 
b/automation/eclair_analysis/linker-symbols.sh
new file mode 100755
index 0000000000..35ec97eb8e
--- /dev/null
+++ b/automation/eclair_analysis/linker-symbols.sh
@@ -0,0 +1,34 @@
+# Stop immediately if any executed command has exit status different from 0.
+set -e
+
+# Extract linker symbol names (except those starting with ".") from 
assignments.
+
+script_name=$(basename "$0")
+script_dir="$(
+  cd "$(dirname "$0")"
+  echo "${PWD}"
+)"
+src_dir="${script_dir}/../.."
+
+usage() {
+  echo "Usage: ${script_name} <arm|x86>"
+}
+
+if [ $# -ne 1 ]; then
+  usage
+  exit 1
+fi
+
+if [ "$1" != "arm" ] && [ "$1" != "x86" ]; then
+    usage
+    exit 1
+fi
+
+filepath="${src_dir}/xen/arch/${1}/xen.lds"
+
+if [ ! -f "$filepath" ]; then
+    echo "Must be run after build."
+    exit 2
+fi
+
+sed -n "s/^\s*\([a-zA-Z_][a-zA-Z_0-9.\-]*\)\s*=.*;.*$/\1/p" $filepath
--
2.25.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.