diff options
Diffstat (limited to 'lib/romlib/gentbl.sh')
-rwxr-xr-x | lib/romlib/gentbl.sh | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/romlib/gentbl.sh b/lib/romlib/gentbl.sh index e64cfe2be..bfb1ec3cf 100755 --- a/lib/romlib/gentbl.sh +++ b/lib/romlib/gentbl.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. +# Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause @@ -19,6 +19,10 @@ do build=$2 shift 2 ;; + --bti=*) + enable_bti=$(echo $1 | sed 's/--bti=\(.*\)/\1/') + shift 1 + ;; --) shift break @@ -47,12 +51,15 @@ if (NF == 2 && $1 == "include") { awk -v OFS="\t" ' BEGIN{print "#index\tlib\tfunction\t[patch]"} {print NR-1, $0}' | tee $build/jmptbl.i | -awk -v OFS="\n" ' +awk -v OFS="\n" -v BTI=$enable_bti ' BEGIN {print "\t.text", "\t.globl\tjmptbl", "jmptbl:"} {sub(/[:blank:]*#.*/,"")} -!/^$/ {if ($3 == "reserved") +!/^$/ { + if (BTI == 1) + print "\tbti\tj" + if ($3 == "reserved") print "\t.word\t0x0" else print "\tb\t" $3}' > $$.tmp && |