blob: 0695f6e4f20d3787451608bda545eb26536d57a2 [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=jmptbl.s
9
10for i
11do
12 case $i in
13 -o)
14 output=$2
15 shift 2
16 ;;
17 --)
18 shift
19 break
20 ;;
21 -*)
22 echo usage: gentbl.sh [-o output] file ... >&2
23 exit 1
24 ;;
25 esac
26done
27
28tmp=`mktemp`
29trap "rm -f $tmp" EXIT INT QUIT
30
31rm -f $output
32
33awk -v OFS="\n" '
34BEGIN {print "\t.text",
35 "\t.globl\tjmptbl",
36 "jmptbl:"}
37 {sub(/[:blank:]*#.*/,"")}
38!/^$/ {print "\tb\t" $3}' "$@" > $tmp
39
40mv $tmp $output