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