mkdiff_obj 819 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. filter() {
  3. # sed removes " address: " prefixes which mess up diff
  4. sed $'s/^\\(\t*\\)[ ]*[0-9a-f][0-9a-f]*:[ \t]*/\\1/' \
  5. | sed 's/__GI_//g'
  6. }
  7. test -d "$1" || exit 1
  8. test -d "$2" || exit 1
  9. {
  10. (
  11. cd "$1" || exit 1
  12. find -name '*.o' -o -name '*.os' # -o -name '*.so'
  13. )
  14. (
  15. cd "$2" || exit 1
  16. find -name '*.o' -o -name '*.os' # -o -name '*.so'
  17. )
  18. } | sed 's:^\./::' | sort | uniq | \
  19. tee LST | \
  20. (
  21. IFS=''
  22. while read -r oname; do
  23. if ! test -f "$1/$oname"; then
  24. echo "Only $2/$oname"
  25. continue
  26. fi
  27. if ! test -f "$2/$oname"; then
  28. echo "Only $1/$oname"
  29. continue
  30. fi
  31. diff -q -- "$1/$oname" "$2/$oname" >/dev/null && continue
  32. (cd "$1"; objdump -dr "$oname" | filter >"$oname.disasm")
  33. (cd "$2"; objdump -dr "$oname" | filter >"$oname.disasm")
  34. diff -u "$1/$oname.disasm" "$2/$oname.disasm"
  35. done
  36. )