Skip to content

Commit 515c907

Browse files
committed
scripts/gensyms: Stricter address matching
On ARM, indirect branches to the "fp" register erroneously matched the previous regex, since the leading "f" is a hex digit. Require two hex digits in a row to avoid this. This requires adding additional logic to skip "0x", which otherwise only has a single leading hex digit. To avoid the regex getting unreadable, switch to a POSIX extended regex.
1 parent 2d0a429 commit 515c907

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

scripts/gensyms

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ CROSS_COMPILE=${CROSS_COMPILE:-${ARCH}-linux-musl-}
1313
# Generated, but might need adjustment
1414
case "$ARCH" in
1515
arm)
16-
CALL_INSN='\(bl\|blx\)'
16+
CALL_INSN='(bl|blx)'
1717
TAIL_INSN=
1818
;;
1919
or1k)
20-
CALL_INSN=l.jal
21-
TAIL_INSN=l.j
20+
CALL_INSN='l\.jal'
21+
TAIL_INSN='l\.j'
2222
;;
2323
esac
2424

@@ -47,8 +47,8 @@ fi
4747
sort -go "$symbols" -u "$symbols"
4848

4949
# Add all normally-called functions
50-
grep "${CALL_INSN}\s[[:xdigit:]]" "$assembly" |
51-
sed "s/^.*${CALL_INSN}\s//" |
50+
grep -E "${CALL_INSN}\s(0x)?[[:xdigit:]]{2,}" "$assembly" |
51+
sed -E "s/^.*${CALL_INSN}\s//" |
5252
sort -gu |
5353
while read -r addr dummy; do
5454
{ printf "$addr" | grep -q "^0x"; } || addr=0x${addr}

0 commit comments

Comments
 (0)