| 1 | #!/bin/sh |
| 2 | |
| 3 | # Stop immediately if any executed command has exit status different from 0. |
| 4 | set -e |
| 5 | |
| 6 | # Extract linker symbol names (except those starting with ".") from assignments. |
| 7 | |
| 8 | script_name=$(basename "$0") |
| 9 | script_dir="$( |
| 10 | cd "$(dirname "$0")" |
| 11 | echo "${PWD}" |
| 12 | )" |
| 13 | src_dir="${script_dir}/../.." |
| 14 | |
| 15 | fatal() { |
| 16 | echo "${script_name}: $*" >&2 |
| 17 | exit 1 |
| 18 | } |
| 19 | |
| 20 | usage() { |
| 21 | fatal "Usage: ${script_name} <arch>" |
| 22 | } |
| 23 | |
| 24 | if [ $# -ne 1 ]; then |
| 25 | usage |
| 26 | fi |
| 27 | |
| 28 | filepath="${src_dir}/xen/arch/${1}/xen.lds" |
| 29 | |
| 30 | if [ ! -f "$filepath" ]; then |
| 31 | fatal "Could not find ${1} linker script. Must be run after the build." |
| 32 | fi |
| 33 | |
| 34 | sed -n "s/^\s*\([a-zA-Z_][a-zA-Z_0-9.\-]*\)\s*=.*;.*$/\1/p" "$filepath" |