xref: /openbmc/linux/tools/perf/check-headers.sh (revision 8fdf9062)
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/perf_event.h
14include/uapi/linux/prctl.h
15include/uapi/linux/sched.h
16include/uapi/linux/stat.h
17include/uapi/linux/usbdevice_fs.h
18include/uapi/linux/vhost.h
19include/uapi/sound/asound.h
20include/linux/bits.h
21include/linux/hash.h
22include/uapi/linux/hw_breakpoint.h
23arch/x86/include/asm/disabled-features.h
24arch/x86/include/asm/required-features.h
25arch/x86/include/asm/cpufeatures.h
26arch/x86/include/uapi/asm/prctl.h
27arch/arm/include/uapi/asm/perf_regs.h
28arch/arm64/include/uapi/asm/perf_regs.h
29arch/powerpc/include/uapi/asm/perf_regs.h
30arch/s390/include/uapi/asm/perf_regs.h
31arch/x86/include/uapi/asm/perf_regs.h
32arch/x86/include/uapi/asm/kvm.h
33arch/x86/include/uapi/asm/kvm_perf.h
34arch/x86/include/uapi/asm/svm.h
35arch/x86/include/uapi/asm/unistd.h
36arch/x86/include/uapi/asm/vmx.h
37arch/powerpc/include/uapi/asm/kvm.h
38arch/s390/include/uapi/asm/kvm.h
39arch/s390/include/uapi/asm/kvm_perf.h
40arch/s390/include/uapi/asm/ptrace.h
41arch/s390/include/uapi/asm/sie.h
42arch/arm/include/uapi/asm/kvm.h
43arch/arm64/include/uapi/asm/kvm.h
44arch/arm64/include/uapi/asm/unistd.h
45arch/alpha/include/uapi/asm/errno.h
46arch/mips/include/asm/errno.h
47arch/mips/include/uapi/asm/errno.h
48arch/parisc/include/uapi/asm/errno.h
49arch/powerpc/include/uapi/asm/errno.h
50arch/sparc/include/uapi/asm/errno.h
51arch/x86/include/uapi/asm/errno.h
52arch/powerpc/include/uapi/asm/unistd.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.h>"'
107check include/uapi/linux/mman.h       '-I "^#include <\(uapi/\)*asm/mman.h>"'
108
109# diff non-symmetric files
110check_2 tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
111
112cd tools/perf
113