sync-check.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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_types.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/interval_tree_generic.h
  17. include/linux/livepatch_external.h
  18. include/linux/static_call_types.h
  19. "
  20. SYNC_CHECK_FILES='
  21. arch/x86/include/asm/inat.h
  22. arch/x86/include/asm/insn.h
  23. arch/x86/lib/inat.c
  24. arch/x86/lib/insn.c
  25. '
  26. fi
  27. check_2 () {
  28. file1=$1
  29. file2=$2
  30. shift
  31. shift
  32. cmd="diff $* $file1 $file2 > /dev/null"
  33. test -f $file2 && {
  34. eval $cmd || {
  35. echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2
  36. echo diff -u $file1 $file2
  37. }
  38. }
  39. }
  40. check () {
  41. file=$1
  42. shift
  43. check_2 tools/$file $file $*
  44. }
  45. if [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then
  46. exit 0
  47. fi
  48. cd ../..
  49. while read -r file_entry; do
  50. if [ -z "$file_entry" ]; then
  51. continue
  52. fi
  53. check $file_entry
  54. done <<EOF
  55. $FILES
  56. EOF
  57. if [ "$SRCARCH" = "x86" ]; then
  58. for i in $SYNC_CHECK_FILES; do
  59. check $i '-I "^.*\/\*.*__ignore_sync_check__.*\*\/.*$"'
  60. done
  61. fi