mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
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:
1 parent
b1b1d1c07e
commit
0e0426dda4
1 file changed
+34
Executable
+34
@@ -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"
|
||||