Merge branch 'work.regset' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux/fpc-iii.git] / tools / perf / check-headers.sh
blob94c2bc22c2bbb49330542df9e263aa9218fb4f89
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
4 FILES='
5 include/uapi/linux/const.h
6 include/uapi/drm/drm.h
7 include/uapi/drm/i915_drm.h
8 include/uapi/linux/fadvise.h
9 include/uapi/linux/fcntl.h
10 include/uapi/linux/fs.h
11 include/uapi/linux/fscrypt.h
12 include/uapi/linux/kcmp.h
13 include/uapi/linux/kvm.h
14 include/uapi/linux/in.h
15 include/uapi/linux/mount.h
16 include/uapi/linux/openat2.h
17 include/uapi/linux/perf_event.h
18 include/uapi/linux/prctl.h
19 include/uapi/linux/sched.h
20 include/uapi/linux/stat.h
21 include/uapi/linux/usbdevice_fs.h
22 include/uapi/linux/vhost.h
23 include/uapi/sound/asound.h
24 include/linux/bits.h
25 include/vdso/bits.h
26 include/linux/const.h
27 include/vdso/const.h
28 include/linux/hash.h
29 include/uapi/linux/hw_breakpoint.h
30 arch/x86/include/asm/disabled-features.h
31 arch/x86/include/asm/required-features.h
32 arch/x86/include/asm/cpufeatures.h
33 arch/x86/include/asm/inat_types.h
34 arch/x86/include/asm/emulate_prefix.h
35 arch/x86/include/asm/irq_vectors.h
36 arch/x86/include/asm/msr-index.h
37 arch/x86/include/uapi/asm/prctl.h
38 arch/x86/lib/x86-opcode-map.txt
39 arch/x86/tools/gen-insn-attr-x86.awk
40 arch/arm/include/uapi/asm/perf_regs.h
41 arch/arm64/include/uapi/asm/perf_regs.h
42 arch/powerpc/include/uapi/asm/perf_regs.h
43 arch/s390/include/uapi/asm/perf_regs.h
44 arch/x86/include/uapi/asm/perf_regs.h
45 arch/x86/include/uapi/asm/kvm.h
46 arch/x86/include/uapi/asm/kvm_perf.h
47 arch/x86/include/uapi/asm/svm.h
48 arch/x86/include/uapi/asm/unistd.h
49 arch/x86/include/uapi/asm/vmx.h
50 arch/powerpc/include/uapi/asm/kvm.h
51 arch/s390/include/uapi/asm/kvm.h
52 arch/s390/include/uapi/asm/kvm_perf.h
53 arch/s390/include/uapi/asm/ptrace.h
54 arch/s390/include/uapi/asm/sie.h
55 arch/arm/include/uapi/asm/kvm.h
56 arch/arm64/include/uapi/asm/kvm.h
57 arch/arm64/include/uapi/asm/unistd.h
58 arch/alpha/include/uapi/asm/errno.h
59 arch/mips/include/asm/errno.h
60 arch/mips/include/uapi/asm/errno.h
61 arch/parisc/include/uapi/asm/errno.h
62 arch/powerpc/include/uapi/asm/errno.h
63 arch/sparc/include/uapi/asm/errno.h
64 arch/x86/include/uapi/asm/errno.h
65 include/asm-generic/bitops/arch_hweight.h
66 include/asm-generic/bitops/const_hweight.h
67 include/asm-generic/bitops/__fls.h
68 include/asm-generic/bitops/fls.h
69 include/asm-generic/bitops/fls64.h
70 include/linux/coresight-pmu.h
71 include/uapi/asm-generic/errno.h
72 include/uapi/asm-generic/errno-base.h
73 include/uapi/asm-generic/ioctls.h
74 include/uapi/asm-generic/mman-common.h
75 include/uapi/asm-generic/unistd.h
78 check_2 () {
79 file1=$1
80 file2=$2
82 shift
83 shift
85 cmd="diff $* $file1 $file2 > /dev/null"
87 test -f $file2 && {
88 eval $cmd || {
89 echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2
90 echo diff -u $file1 $file2
95 check () {
96 file=$1
98 shift
100 check_2 tools/$file $file $*
103 # Check if we have the kernel headers (tools/perf/../../include), else
104 # we're probably on a detached tarball, so no point in trying to check
105 # differences.
106 test -d ../../include || exit 0
108 cd ../..
110 # simple diff check
111 for i in $FILES; do
112 check $i -B
113 done
115 # diff with extra ignore lines
116 check arch/x86/lib/memcpy_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>" -I"^SYM_FUNC_START\(_LOCAL\)*(memcpy_\(erms\|orig\))"'
117 check arch/x86/lib/memset_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>" -I"^SYM_FUNC_START\(_LOCAL\)*(memset_\(erms\|orig\))"'
118 check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common\(-tools\)*.h>"'
119 check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"'
120 check include/linux/build_bug.h '-I "^#\(ifndef\|endif\)\( \/\/\)* static_assert$"'
121 check include/linux/ctype.h '-I "isdigit("'
122 check lib/ctype.c '-I "^EXPORT_SYMBOL" -I "^#include <linux/export.h>" -B'
123 check arch/x86/include/asm/inat.h '-I "^#include [\"<]\(asm/\)*inat_types.h[\">]"'
124 check arch/x86/include/asm/insn.h '-I "^#include [\"<]\(asm/\)*inat.h[\">]"'
125 check arch/x86/lib/inat.c '-I "^#include [\"<]\(../include/\)*asm/insn.h[\">]"'
126 check arch/x86/lib/insn.c '-I "^#include [\"<]\(../include/\)*asm/in\(at\|sn\).h[\">]" -I "^#include [\"<]\(../include/\)*asm/emulate_prefix.h[\">]"'
128 # diff non-symmetric files
129 check_2 tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
131 # check duplicated library files
132 check_2 tools/perf/util/hashmap.h tools/lib/bpf/hashmap.h
133 check_2 tools/perf/util/hashmap.c tools/lib/bpf/hashmap.c
135 cd tools/perf