check-headers.sh 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #!/bin/sh
  2. # SPDX-License-Identifier: GPL-2.0
  3. FILES='
  4. include/uapi/linux/const.h
  5. include/uapi/drm/drm.h
  6. include/uapi/drm/i915_drm.h
  7. include/uapi/linux/fadvise.h
  8. include/uapi/linux/fcntl.h
  9. include/uapi/linux/fs.h
  10. include/uapi/linux/fscrypt.h
  11. include/uapi/linux/kcmp.h
  12. include/uapi/linux/kvm.h
  13. include/uapi/linux/in.h
  14. include/uapi/linux/mount.h
  15. include/uapi/linux/perf_event.h
  16. include/uapi/linux/prctl.h
  17. include/uapi/linux/sched.h
  18. include/uapi/linux/stat.h
  19. include/uapi/linux/usbdevice_fs.h
  20. include/uapi/linux/vhost.h
  21. include/uapi/sound/asound.h
  22. include/linux/bits.h
  23. include/linux/const.h
  24. include/linux/hash.h
  25. include/uapi/linux/hw_breakpoint.h
  26. arch/x86/include/asm/disabled-features.h
  27. arch/x86/include/asm/required-features.h
  28. arch/x86/include/asm/cpufeatures.h
  29. arch/x86/include/asm/inat_types.h
  30. arch/x86/include/uapi/asm/prctl.h
  31. arch/x86/lib/x86-opcode-map.txt
  32. arch/x86/tools/gen-insn-attr-x86.awk
  33. arch/arm/include/uapi/asm/perf_regs.h
  34. arch/arm64/include/uapi/asm/perf_regs.h
  35. arch/powerpc/include/uapi/asm/perf_regs.h
  36. arch/s390/include/uapi/asm/perf_regs.h
  37. arch/x86/include/uapi/asm/perf_regs.h
  38. arch/x86/include/uapi/asm/kvm.h
  39. arch/x86/include/uapi/asm/kvm_perf.h
  40. arch/x86/include/uapi/asm/svm.h
  41. arch/x86/include/uapi/asm/unistd.h
  42. arch/x86/include/uapi/asm/vmx.h
  43. arch/powerpc/include/uapi/asm/kvm.h
  44. arch/s390/include/uapi/asm/kvm.h
  45. arch/s390/include/uapi/asm/kvm_perf.h
  46. arch/s390/include/uapi/asm/ptrace.h
  47. arch/s390/include/uapi/asm/sie.h
  48. arch/arm/include/uapi/asm/kvm.h
  49. arch/arm64/include/uapi/asm/kvm.h
  50. arch/arm64/include/uapi/asm/unistd.h
  51. arch/alpha/include/uapi/asm/errno.h
  52. arch/mips/include/asm/errno.h
  53. arch/mips/include/uapi/asm/errno.h
  54. arch/parisc/include/uapi/asm/errno.h
  55. arch/powerpc/include/uapi/asm/errno.h
  56. arch/sparc/include/uapi/asm/errno.h
  57. arch/x86/include/uapi/asm/errno.h
  58. include/asm-generic/bitops/arch_hweight.h
  59. include/asm-generic/bitops/const_hweight.h
  60. include/asm-generic/bitops/__fls.h
  61. include/asm-generic/bitops/fls.h
  62. include/asm-generic/bitops/fls64.h
  63. include/linux/coresight-pmu.h
  64. include/uapi/asm-generic/errno.h
  65. include/uapi/asm-generic/errno-base.h
  66. include/uapi/asm-generic/ioctls.h
  67. include/uapi/asm-generic/mman-common.h
  68. include/uapi/asm-generic/unistd.h
  69. '
  70. check_2 () {
  71. file1=$1
  72. file2=$2
  73. shift
  74. shift
  75. cmd="diff $* $file1 $file2 > /dev/null"
  76. test -f $file2 && {
  77. eval $cmd || {
  78. echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2
  79. echo diff -u $file1 $file2
  80. }
  81. }
  82. }
  83. check () {
  84. file=$1
  85. shift
  86. check_2 tools/$file $file $*
  87. }
  88. # Check if we have the kernel headers (tools/perf/../../include), else
  89. # we're probably on a detached tarball, so no point in trying to check
  90. # differences.
  91. test -d ../../include || exit 0
  92. cd ../..
  93. # simple diff check
  94. for i in $FILES; do
  95. check $i -B
  96. done
  97. # diff with extra ignore lines
  98. check arch/x86/lib/memcpy_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"'
  99. check arch/x86/lib/memset_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"'
  100. check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common\(-tools\)*.h>"'
  101. check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"'
  102. check include/linux/ctype.h '-I "isdigit("'
  103. check lib/ctype.c '-I "^EXPORT_SYMBOL" -I "^#include <linux/export.h>" -B'
  104. check arch/x86/include/asm/inat.h '-I "^#include [\"<]\(asm/\)*inat_types.h[\">]"'
  105. check arch/x86/include/asm/insn.h '-I "^#include [\"<]\(asm/\)*inat.h[\">]"'
  106. check arch/x86/lib/inat.c '-I "^#include [\"<]\(../include/\)*asm/insn.h[\">]"'
  107. check arch/x86/lib/insn.c '-I "^#include [\"<]\(../include/\)*asm/in\(at\|sn\).h[\">]"'
  108. # diff non-symmetric files
  109. check_2 tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
  110. cd tools/perf