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