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