aboutsummaryrefslogtreecommitdiffstats
path: root/lib/romlib/genvar.sh
diff options
context:
space:
mode:
authorRoberto Vargas <roberto.vargas@arm.com>2018-05-22 16:05:42 +0100
committerRoberto Vargas <roberto.vargas@arm.com>2018-08-03 11:31:42 +0100
commit5accce5bcc211c08e80c638acbd01099af81cc37 (patch)
tree923fe8d7c1cd69eccef6eeb9ed5c875f65f9b5c8 /lib/romlib/genvar.sh
parent6c3733456706809d5c9fb78a9746bf2fa484fb91 (diff)
downloadplatform_external_arm-trusted-firmware-5accce5bcc211c08e80c638acbd01099af81cc37.tar.gz
platform_external_arm-trusted-firmware-5accce5bcc211c08e80c638acbd01099af81cc37.tar.bz2
platform_external_arm-trusted-firmware-5accce5bcc211c08e80c638acbd01099af81cc37.zip
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>
Diffstat (limited to 'lib/romlib/genvar.sh')
-rwxr-xr-xlib/romlib/genvar.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/romlib/genvar.sh b/lib/romlib/genvar.sh
new file mode 100755
index 000000000..a3e2cdf69
--- /dev/null
+++ b/lib/romlib/genvar.sh
@@ -0,0 +1,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