arm-trusted-firmware/lib/romlib/genwrappers.sh
John Tsichritzis ae2e01b876 ROMLIB bug fixes
Fixed the below bugs:
1) Bug related to build flag V=1: if the flag was V=0, building with
ROMLIB would fail.
2) Due to a syntax bug in genwrappers.sh, index file entries marked as
"patch" or "reserved" were ignored.
3) Added a prepending hash to constants that genwrappers is generating.
4) Due to broken dependencies, currently the inclusion functionality is
intentionally not utilised. This is why the contents of romlib/jmptbl.i
have been copied to platform specific jmptbl.i files. As a result of the
broken dependencies, when changing the index files, e.g. patching
functions, a clean build is always required. This is a known issue that
will be fixed in the future.

Change-Id: I9d92aa9724e86d8f90fcd3e9f66a27aa3cab7aaa
Signed-off-by: John Tsichritzis <john.tsichritzis@arm.com>
2019-03-21 10:51:07 +00:00

52 lines
726 B
Bash
Executable file

#!/bin/sh
# Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
set -e
build=.
out=output.a
for i
do
case $i in
-o)
out=$2
shift 2
;;
-b)
build=$2
shift 2
;;
--)
shift
break
;;
-*)
echo usage: genwrappers.sh [-o output] [-b dir] file ... >&2
exit 1
;;
esac
done
awk '{sub(/[:blank:]*#.*/,"")}
!/^$/ && $NF != "patch" && $NF != "reserved" {print $1*4, $2, $3}' "$@" |
while read idx lib sym
do
file=$build/${lib}_$sym
cat <<EOF > $file.s
.globl $sym
$sym:
ldr x17, =jmptbl
ldr x17, [x17]
mov x16, #$idx
add x16, x16, x17
br x16
EOF
${CROSS_COMPILE}as -o $file.o $file.s
done
${CROSS_COMPILE}ar -rc $out $build/*.o