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