1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0 3 4if [ -z "$SRCARCH" ]; then 5 echo 'sync-check.sh: error: missing $SRCARCH environment variable' >&2 6 exit 1 7fi 8 9FILES="include/linux/objtool.h" 10 11if [ "$SRCARCH" = "x86" ]; then 12FILES="$FILES 13arch/x86/include/asm/inat_types.h 14arch/x86/include/asm/orc_types.h 15arch/x86/include/asm/emulate_prefix.h 16arch/x86/lib/x86-opcode-map.txt 17arch/x86/tools/gen-insn-attr-x86.awk 18include/linux/static_call_types.h 19" 20 21SYNC_CHECK_FILES=' 22arch/x86/include/asm/inat.h 23arch/x86/include/asm/insn.h 24arch/x86/lib/inat.c 25arch/x86/lib/insn.c 26' 27fi 28 29check_2 () { 30 file1=$1 31 file2=$2 32 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 46check () { 47 file=$1 48 49 shift 50 51 check_2 tools/$file $file $* 52} 53 54if [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then 55 exit 0 56fi 57 58cd ../.. 59 60while read -r file_entry; do 61 if [ -z "$file_entry" ]; then 62 continue 63 fi 64 65 check $file_entry 66done <<EOF 67$FILES 68EOF 69 70if [ "$SRCARCH" = "x86" ]; then 71 for i in $SYNC_CHECK_FILES; do 72 check $i '-I "^.*\/\*.*__ignore_sync_check__.*\*\/.*$"' 73 done 74fi 75