0001
0002
0003
0004 if [ -z "$SRCARCH" ]; then
0005 echo 'sync-check.sh: error: missing $SRCARCH environment variable' >&2
0006 exit 1
0007 fi
0008
0009 FILES="include/linux/objtool.h"
0010
0011 if [ "$SRCARCH" = "x86" ]; then
0012 FILES="$FILES
0013 arch/x86/include/asm/nops.h
0014 arch/x86/include/asm/inat_types.h
0015 arch/x86/include/asm/orc_types.h
0016 arch/x86/include/asm/emulate_prefix.h
0017 arch/x86/lib/x86-opcode-map.txt
0018 arch/x86/tools/gen-insn-attr-x86.awk
0019 include/linux/static_call_types.h
0020 "
0021
0022 SYNC_CHECK_FILES='
0023 arch/x86/include/asm/inat.h
0024 arch/x86/include/asm/insn.h
0025 arch/x86/lib/inat.c
0026 arch/x86/lib/insn.c
0027 '
0028 fi
0029
0030 check_2 () {
0031 file1=$1
0032 file2=$2
0033
0034 shift
0035 shift
0036
0037 cmd="diff $* $file1 $file2 > /dev/null"
0038
0039 test -f $file2 && {
0040 eval $cmd || {
0041 echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2
0042 echo diff -u $file1 $file2
0043 }
0044 }
0045 }
0046
0047 check () {
0048 file=$1
0049
0050 shift
0051
0052 check_2 tools/$file $file $*
0053 }
0054
0055 if [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then
0056 exit 0
0057 fi
0058
0059 cd ../..
0060
0061 while read -r file_entry; do
0062 if [ -z "$file_entry" ]; then
0063 continue
0064 fi
0065
0066 check $file_entry
0067 done <<EOF
0068 $FILES
0069 EOF
0070
0071 if [ "$SRCARCH" = "x86" ]; then
0072 for i in $SYNC_CHECK_FILES; do
0073 check $i '-I "^.*\/\*.*__ignore_sync_check__.*\*\/.*$"'
0074 done
0075 fi