sync-check.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/bin/sh
  2. # SPDX-License-Identifier: GPL-2.0
  3. if [ -z "$SRCARCH" ]; then
  4. echo 'sync-check.sh: error: missing $SRCARCH environment variable' >&2
  5. exit 1
  6. fi
  7. FILES="include/linux/objtool.h"
  8. if [ "$SRCARCH" = "x86" ]; then
  9. FILES="$FILES
  10. arch/x86/include/asm/nops.h
  11. arch/x86/include/asm/inat_types.h
  12. arch/x86/include/asm/orc_types.h
  13. arch/x86/include/asm/emulate_prefix.h
  14. arch/x86/lib/x86-opcode-map.txt
  15. arch/x86/tools/gen-insn-attr-x86.awk
  16. include/linux/static_call_types.h
  17. "
  18. SYNC_CHECK_FILES='
  19. arch/x86/include/asm/inat.h
  20. arch/x86/include/asm/insn.h
  21. arch/x86/lib/inat.c
  22. arch/x86/lib/insn.c
  23. '
  24. fi
  25. check_2 () {
  26. file1=$1
  27. file2=$2
  28. shift
  29. shift
  30. cmd="diff $* $file1 $file2 > /dev/null"
  31. test -f $file2 && {
  32. eval $cmd || {
  33. echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2
  34. echo diff -u $file1 $file2
  35. }
  36. }
  37. }
  38. check () {
  39. file=$1
  40. shift
  41. check_2 tools/$file $file $*
  42. }
  43. if [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then
  44. exit 0
  45. fi
  46. cd ../..
  47. while read -r file_entry; do
  48. if [ -z "$file_entry" ]; then
  49. continue
  50. fi
  51. check $file_entry
  52. done <<EOF
  53. $FILES
  54. EOF
  55. if [ "$SRCARCH" = "x86" ]; then
  56. for i in $SYNC_CHECK_FILES; do
  57. check $i '-I "^.*\/\*.*__ignore_sync_check__.*\*\/.*$"'
  58. done
  59. fi