mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-17 01:54:22 +00:00

This change allows patching of functions in the romlib. This can be done by adding "patch" at the end of the jump table entry for the function that needs to be patched in the file jmptbl.i. Functions patched in the jump table list will be built as part of the BL image and the romlib version will not be used Change-Id: Iefb200cb86e2a4b61ad3ee6180d3ecc39bad537f Signed-off-by: Sathees Balya <sathees.balya@arm.com>
52 lines
697 B
Bash
Executable file
52 lines
697 B
Bash
Executable file
#!/bin/sh
|
|
# Copyright (c) 2018, 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:]*#.*/,"")}
|
|
!/^$/ && !/\\tpatch$/ {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
|