xref: /openbmc/linux/tools/perf/check-headers.sh (revision 8bd1369b)
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_2 () {
59  file1=$1
60  file2=$2
61
62  shift
63  shift
64
65  cmd="diff $* $file1 $file2 > /dev/null"
66
67  test -f $file2 &&
68  eval $cmd || echo "Warning: Kernel ABI header at 'tools/$file' differs from latest version at '$file'" >&2
69}
70
71check () {
72  file=$1
73
74  shift
75
76  check_2 ../$file ../../$file $*
77}
78
79# Check if we have the kernel headers (tools/perf/../../include), else
80# we're probably on a detached tarball, so no point in trying to check
81# differences.
82test -d ../../include || exit 0
83
84# simple diff check
85for i in $HEADERS; do
86  check $i -B
87done
88
89# diff with extra ignore lines
90check arch/x86/lib/memcpy_64.S        '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"'
91check arch/x86/lib/memset_64.S        '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"'
92check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common.h>"'
93check include/uapi/linux/mman.h       '-I "^#include <\(uapi/\)*asm/mman.h>"'
94