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