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_types.h" 10 11if [ "$SRCARCH" = "x86" ]; then 12FILES="$FILES 13arch/x86/include/asm/nops.h 14arch/x86/include/asm/inat_types.h 15arch/x86/include/asm/orc_types.h 16arch/x86/include/asm/emulate_prefix.h 17arch/x86/lib/x86-opcode-map.txt 18arch/x86/tools/gen-insn-attr-x86.awk 19include/linux/interval_tree_generic.h 20include/linux/livepatch_external.h 21include/linux/static_call_types.h 22" 23 24SYNC_CHECK_FILES=' 25arch/x86/include/asm/inat.h 26arch/x86/include/asm/insn.h 27arch/x86/lib/inat.c 28arch/x86/lib/insn.c 29' 30fi 31 32check_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 49check () { 50 file=$1 51 52 shift 53 54 check_2 tools/$file $file $* 55} 56 57if [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then 58 exit 0 59fi 60 61cd ../.. 62 63while read -r file_entry; do 64 if [ -z "$file_entry" ]; then 65 continue 66 fi 67 68 check $file_entry 69done <<EOF 70$FILES 71EOF 72 73if [ "$SRCARCH" = "x86" ]; then 74 for i in $SYNC_CHECK_FILES; do 75 check $i '-I "^.*\/\*.*__ignore_sync_check__.*\*\/.*$"' 76 done 77fi 78