arm-trusted-firmware/lib/romlib/genvar.sh
Roberto Vargas 5accce5bcc Add support for romlib in the build system
Romlib is a new image that is stored in ROM and contains the code of
several libraries that can be shared between different images. All
the functions within in the library are accessed using a jump table
which allows to update the romlib image whithout changing the binary
compatibility. This jump table can be also stored in RAM and it can
allow to patch a romlib with potential bugs fixes..

Change-Id: If980ccdaca24b7aaca900e32acc68baf6f94ab35
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-08-03 11:31:42 +01:00

36 lines
556 B
Bash
Executable file

#!/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