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