root / check_ops.sh @ e00c1e71
History | View | Annotate | Download (1005 Bytes)
1 | 2f67a0d5 | pbrook | #! /bin/sh |
---|---|---|---|
2 | 2f67a0d5 | pbrook | # Script to check for duplicate function prologues in op.o |
3 | 2f67a0d5 | pbrook | # Typically this indicates missing FORCE_RET(); |
4 | 2f67a0d5 | pbrook | # This script does not detect other errors that may be present. |
5 | 2f67a0d5 | pbrook | |
6 | 2f67a0d5 | pbrook | # Usage: check_ops.sh [-m machine] [op.o] |
7 | 2f67a0d5 | pbrook | # machine and op.o are guessed if not specified. |
8 | 2f67a0d5 | pbrook | |
9 | 2f67a0d5 | pbrook | if [ "x$1" = "x-m" ]; then |
10 | 2f67a0d5 | pbrook | machine=$2 |
11 | 2f67a0d5 | pbrook | shift 2 |
12 | 2f67a0d5 | pbrook | else |
13 | 2f67a0d5 | pbrook | machine=`uname -m` |
14 | 2f67a0d5 | pbrook | fi |
15 | 2f67a0d5 | pbrook | if [ -z "$1" ]; then |
16 | 2f67a0d5 | pbrook | for f in `find . -name op.o`; do |
17 | 2f67a0d5 | pbrook | /bin/sh "$0" -m $machine $f |
18 | 2f67a0d5 | pbrook | done |
19 | 2f67a0d5 | pbrook | exit 0 |
20 | 2f67a0d5 | pbrook | fi |
21 | 2f67a0d5 | pbrook | |
22 | 2f67a0d5 | pbrook | case $machine in |
23 | 2f67a0d5 | pbrook | i?86) |
24 | 2f67a0d5 | pbrook | ret='\tret' |
25 | 2f67a0d5 | pbrook | ;; |
26 | 2f67a0d5 | pbrook | x86_64) |
27 | 2f67a0d5 | pbrook | ret='\tretq' |
28 | 2f67a0d5 | pbrook | ;; |
29 | 2f67a0d5 | pbrook | arm) |
30 | 2f67a0d5 | pbrook | ret='\tldm.*pc' |
31 | 2f67a0d5 | pbrook | ;; |
32 | 2f67a0d5 | pbrook | ppc* | powerpc*) |
33 | 2f67a0d5 | pbrook | ret='\tblr' |
34 | 2f67a0d5 | pbrook | ;; |
35 | 2f67a0d5 | pbrook | mips*) |
36 | 2f67a0d5 | pbrook | ret='\tjr.*ra' |
37 | 2f67a0d5 | pbrook | ;; |
38 | 76d83bde | ths | s390*) |
39 | 76d83bde | ths | ret='\tbr.*' |
40 | 76d83bde | ths | ;; |
41 | 2f67a0d5 | pbrook | *) |
42 | 2f67a0d5 | pbrook | echo "Unknown machine `uname -m`" |
43 | 2f67a0d5 | pbrook | ;; |
44 | 2f67a0d5 | pbrook | esac |
45 | 2f67a0d5 | pbrook | echo $1 |
46 | 2f67a0d5 | pbrook | # op_exit_tb causes false positives on some hosts. |
47 | 2f67a0d5 | pbrook | ${CROSS}objdump -dr $1 | \ |
48 | 2f67a0d5 | pbrook | sed -e '/>:$\|'"$ret"'/!d' -e 's/.*<\(.*\)>:/~\1:/' -e 's/.*'"$ret"'.*/!/' | \ |
49 | 2f67a0d5 | pbrook | sed -e ':1;N;s/\n//;t1' | sed -e 's/~/\n/g' | grep -v '^op_exit_tb' | \ |
50 | 2f67a0d5 | pbrook | grep '^op_.*!!' |