check-headers.sh 3.0 KB

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