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