Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/tools/objtool/sync-check.sh
48988 views
1
#!/bin/sh
2
# SPDX-License-Identifier: GPL-2.0
3
4
if [ -z "$SRCARCH" ]; then
5
echo 'sync-check.sh: error: missing $SRCARCH environment variable' >&2
6
exit 1
7
fi
8
9
FILES="include/linux/objtool_types.h"
10
11
if [ "$SRCARCH" = "x86" ]; then
12
FILES="$FILES
13
arch/x86/include/asm/nops.h
14
arch/x86/include/asm/inat_types.h
15
arch/x86/include/asm/orc_types.h
16
arch/x86/include/asm/emulate_prefix.h
17
arch/x86/lib/x86-opcode-map.txt
18
arch/x86/tools/gen-insn-attr-x86.awk
19
include/linux/interval_tree_generic.h
20
include/linux/livepatch_external.h
21
include/linux/static_call_types.h
22
"
23
24
SYNC_CHECK_FILES='
25
arch/x86/include/asm/inat.h
26
arch/x86/include/asm/insn.h
27
arch/x86/lib/inat.c
28
arch/x86/lib/insn.c
29
'
30
fi
31
32
check_2 () {
33
file1=$1
34
file2=$2
35
36
shift
37
shift
38
39
cmd="diff $* $file1 $file2 > /dev/null"
40
41
test -f $file2 && {
42
eval $cmd || {
43
echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2
44
echo diff -u $file1 $file2
45
}
46
}
47
}
48
49
check () {
50
file=$1
51
52
shift
53
54
check_2 tools/$file $file $*
55
}
56
57
if [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then
58
exit 0
59
fi
60
61
cd ../..
62
63
while read -r file_entry; do
64
if [ -z "$file_entry" ]; then
65
continue
66
fi
67
68
check $file_entry
69
done <<EOF
70
$FILES
71
EOF
72
73
if [ "$SRCARCH" = "x86" ]; then
74
for i in $SYNC_CHECK_FILES; do
75
check $i '-I "^.*\/\*.*__ignore_sync_check__.*\*\/.*$"'
76
done
77
fi
78
79