xref: /linux/tools/perf/check-headers.sh (revision 9a379e77033f02c4a071891afdf0f0a01eff8ccb)
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/s390/include/uapi/asm/unistd.h
37arch/arm/include/uapi/asm/kvm.h
38arch/arm64/include/uapi/asm/kvm.h
39arch/alpha/include/uapi/asm/errno.h
40arch/mips/include/asm/errno.h
41arch/mips/include/uapi/asm/errno.h
42arch/parisc/include/uapi/asm/errno.h
43arch/powerpc/include/uapi/asm/errno.h
44arch/sparc/include/uapi/asm/errno.h
45arch/x86/include/uapi/asm/errno.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  while [ -n "$*" ]; do
63    opts="$opts \"$1\""
64    shift
65  done
66
67  cmd="diff $opts ../$file ../../$file > /dev/null"
68
69  test -f ../../$file &&
70  eval $cmd || echo "Warning: Kernel ABI header at 'tools/$file' differs from latest version at '$file'" >&2
71}
72
73
74# Check if we have the kernel headers (tools/perf/../../include), else
75# we're probably on a detached tarball, so no point in trying to check
76# differences.
77test -d ../../include || exit 0
78
79# simple diff check
80for i in $HEADERS; do
81  check $i -B
82done
83
84# diff with extra ignore lines
85check arch/x86/lib/memcpy_64.S        -I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"
86check arch/x86/lib/memset_64.S        -I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"
87check include/uapi/asm-generic/mman.h -I "^#include <\(uapi/\)*asm-generic/mman-common.h>"
88check include/uapi/linux/mman.h       -I "^#include <\(uapi/\)*asm/mman.h>"
89