automation: add linker symbol name script

Requested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Victor Lira <victorm.lira@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
This commit is contained in:
Victor Lira authored and Stefano Stabellini committed 2024-08-28 17:47:40 -07:00
1 parent b1b1d1c07e
commit 0e0426dda4
1 file changed
+34
+34
View File
@@ -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} <arch>"
}
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 the build."
fi
sed -n "s/^\s*\([a-zA-Z_][a-zA-Z_0-9.\-]*\)\s*=.*;.*$/\1/p" "$filepath"
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.