blob: a3e2cdf69673530feda8a565f052311b89b1c997 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#!/bin/sh
# Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
set -e
output=jmpvar.s
for i
do
case $i in
-o)
output=$2
shift 2
;;
--)
shift
break
;;
-*)
echo usage: genvar.sh [-o output] file... >&2
;;
esac
done
tmp=`mktemp`
trap "rm -f $tmp" EXIT INT QUIT
nm -a "$@" |
awk -v OFS="\n" '
$3 == ".text" {print "\t.data",
"\t.globl\tjmptbl",
"\t.align\t4",
"jmptbl:\t.quad\t0x" $1}' > $tmp
mv $tmp $output
|