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