Merge tag 'ntb-5.11' of git://github.com/jonmason/ntb
[linux/fpc-iii.git] / tools / perf / check-headers.sh
blobdded93a2bc89a330e1b68dc6ed6fd3cf52f2ec8d
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 # These copies are under tools/perf/trace/beauty/ as they are not used to in
79 # building object files only by scripts in tools/perf/trace/beauty/ to generate
80 # tables that then gets included in .c files for things like id->string syscall
81 # tables (and the reverse lookup as well: string -> id)
83 BEAUTY_FILES='
84 include/linux/socket.h
87 check_2 () {
88 file1=$1
89 file2=$2
91 shift
92 shift
94 cmd="diff $* $file1 $file2 > /dev/null"
96 test -f $file2 && {
97 eval $cmd || {
98 echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2
99 echo diff -u $file1 $file2
104 check () {
105 file=$1
107 shift
109 check_2 tools/$file $file $*
112 beauty_check () {
113 file=$1
115 shift
117 check_2 tools/perf/trace/beauty/$file $file $*
120 # Check if we have the kernel headers (tools/perf/../../include), else
121 # we're probably on a detached tarball, so no point in trying to check
122 # differences.
123 test -d ../../include || exit 0
125 cd ../..
127 # simple diff check
128 for i in $FILES; do
129 check $i -B
130 done
132 # diff with extra ignore lines
133 check arch/x86/lib/memcpy_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>" -I"^SYM_FUNC_START\(_LOCAL\)*(memcpy_\(erms\|orig\))"'
134 check arch/x86/lib/memset_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>" -I"^SYM_FUNC_START\(_LOCAL\)*(memset_\(erms\|orig\))"'
135 check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common\(-tools\)*.h>"'
136 check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"'
137 check include/linux/build_bug.h '-I "^#\(ifndef\|endif\)\( \/\/\)* static_assert$"'
138 check include/linux/ctype.h '-I "isdigit("'
139 check lib/ctype.c '-I "^EXPORT_SYMBOL" -I "^#include <linux/export.h>" -B'
140 check arch/x86/include/asm/inat.h '-I "^#include [\"<]\(asm/\)*inat_types.h[\">]"'
141 check arch/x86/include/asm/insn.h '-I "^#include [\"<]\(asm/\)*inat.h[\">]"'
142 check arch/x86/lib/inat.c '-I "^#include [\"<]\(../include/\)*asm/insn.h[\">]"'
143 check arch/x86/lib/insn.c '-I "^#include [\"<]\(../include/\)*asm/in\(at\|sn\).h[\">]" -I "^#include [\"<]\(../include/\)*asm/emulate_prefix.h[\">]"'
145 # diff non-symmetric files
146 check_2 tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
147 check_2 tools/perf/arch/powerpc/entry/syscalls/syscall.tbl arch/powerpc/kernel/syscalls/syscall.tbl
148 check_2 tools/perf/arch/s390/entry/syscalls/syscall.tbl arch/s390/kernel/syscalls/syscall.tbl
150 for i in $BEAUTY_FILES; do
151 beauty_check $i -B
152 done
154 # check duplicated library files
155 check_2 tools/perf/util/hashmap.h tools/lib/bpf/hashmap.h
156 check_2 tools/perf/util/hashmap.c tools/lib/bpf/hashmap.c
158 cd tools/perf