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

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


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: <victorm.lira@xxxxxxx>
  • Date: Thu, 25 Jul 2024 12:01:53 -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=IFmmQR3vnXMbekwltZbuh3LwRrigr6liLi100vVOUTU=; b=uCk3PwvSqkIv3m9r0IXNU99YzwJxahqWNtw2Iry3byHQfm1r6iMnXTJ3HUcm5FELJaFEqgUrKd2a1rbIWujBwI14i7r5PZe/E+sFEt1Flasb7m0Zay+6cVB8IXsgRRV3JHmC1qLjRdZ/6BlNrPgAQP+mB31vgRPMIgS3Q367J5Bi9Pf5Ey1PlGNDYFabSVQ1cjyK9tS8Aw9HxBxKrH/j/Cj2uBQy0xk18XWqvbCkEAkjsqQ7YJwLE6JUZAVk+uHtxN8fi9nPsELrv/WElSbcMcxZWOgsS5V8C1Q7pUMDg+cFeOXyRTT88Lu1FHYVAn4vHAQRWFT3OesXX6/oeBhKjQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mhIvIghJ8QBuWYsLcQLvqh8NerZ941yaZmnvz5V+AJXXKVHDKeI5D72Qi1CcHDVySJyR+dLsmFlokNuyolABnYbflczQIMvOhWiGGqC5Uime5cNja/xHvWn0PFWmXPO9teh2U1uU19QgiShs9n8W+uxa3JSh+7NZLBPH5a+o8srHkhnSYEYIPDrAdFG0MRfISyfhtrSMQJ522YAJEotL+pyPlPCGS3njsukoF8n6BOo7WkLarwYY/GGWKeUr3iQYP+T8uTRNbGcNqMSKj0UqMkRtay1sIsksMnOzqfHHzCGcmVGW2W/WqOboNdnD8YdY8GXXbBTtKskpI4nEqYuJJA==
  • Cc: Victor Lira <victorm.lira@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, <roberto.bagnara@xxxxxxxxxxx>, <consulting@xxxxxxxxxxx>, <simone.ballarin@xxxxxxxxxxx>
  • Delivery-date: Thu, 25 Jul 2024 19:02:18 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

From: Victor Lira <victorm.lira@xxxxxxx>

Requested-by: Jan Beulich <jbeulich@xxxxxxxx>
Signed-off-by: Victor Lira <victorm.lira@xxxxxxx>
---
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 or 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: Jan Beulich <jbeulich@xxxxxxxx>
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

Changes v3:
- use #!/bin/sh
- update error handling and message similar to ../build.sh
---
 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..61790fb281
--- /dev/null
+++ b/automation/eclair_analysis/linker-symbols.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+# 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}/../.."
+
+fatal() {
+  echo "${script_name}: $*" >&2
+  exit 1
+}
+
+usage() {
+  fatal "Usage: ${script_name} <arm|x86>"
+}
+
+if [ $# -ne 1 ]; then
+  usage
+fi
+
+filepath="${src_dir}/xen/arch/${1}/xen.lds"
+
+if [ ! -f "$filepath" ]; then
+  fatal "Could not find ${1} linker script. Must be run after arm/x86 build."
+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®.