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