4 echo "Usage: ${0##*/} DIR1 DIR2"
6 echo "Compares all object files recursivelty found in DIR1 and DIR2."
7 echo "Prints diff of their disassembly."
13 # sed removes " address: " prefixes which mess up diff
14 sed $
's/^\\(\t*\\)[ ]*[0-9a-f][0-9a-f]*:[ \t]*/\\1/' \
18 test -d "$1" || usage
1
19 test -d "$2" || usage
1
24 find -name '*.o' # -o -name '*.os' # -o -name '*.so'
28 find -name '*.o' # -o -name '*.os' # -o -name '*.so'
30 } |
sed 's:^\./::' |
sort |
uniq | \
32 while IFS
='' read -r oname
; do
33 if ! test -f "$1/$oname"; then
37 if ! test -f "$2/$oname"; then
41 diff -q -- "$1/$oname" "$2/$oname" >/dev
/null
&& continue
42 (cd "$1" && { size
"$oname"; objdump
-dr "$oname" | filter
; } >"$oname.disasm")
43 (cd "$2" && { size
"$oname"; objdump
-dr "$oname" | filter
; } >"$oname.disasm")
44 diff -u -- "$1/$oname.disasm" "$2/$oname.disasm"