13bd51c5aSJosh Poimboeuf#!/bin/sh 23bd51c5aSJosh Poimboeuf# SPDX-License-Identifier: GPL-2.0 33bd51c5aSJosh Poimboeuf 4bb090fdbSJulien Thierryif [ -z "$SRCARCH" ]; then 5bb090fdbSJulien Thierry echo 'sync-check.sh: error: missing $SRCARCH environment variable' >&2 6bb090fdbSJulien Thierry exit 1 7bb090fdbSJulien Thierryfi 8bb090fdbSJulien Thierry 9*f7515d9fSJosh PoimboeufFILES="include/linux/objtool_types.h" 10ee819aedSJulien Thierry 11bb090fdbSJulien Thierryif [ "$SRCARCH" = "x86" ]; then 12ee819aedSJulien ThierryFILES="$FILES 13301cddc2SPeter Zijlstraarch/x86/include/asm/nops.h 143bd51c5aSJosh Poimboeufarch/x86/include/asm/inat_types.h 153bd51c5aSJosh Poimboeufarch/x86/include/asm/orc_types.h 164d65adfcSMasami Hiramatsuarch/x86/include/asm/emulate_prefix.h 17d046b725SJosh Poimboeufarch/x86/lib/x86-opcode-map.txt 18d046b725SJosh Poimboeufarch/x86/tools/gen-insn-attr-x86.awk 191e7e4788SJosh Poimboeufinclude/linux/static_call_types.h 203890b8d9SJulien Thierry" 21d30c7b82SBorislav Petkov 22d30c7b82SBorislav PetkovSYNC_CHECK_FILES=' 23d30c7b82SBorislav Petkovarch/x86/include/asm/inat.h 24d30c7b82SBorislav Petkovarch/x86/include/asm/insn.h 25d30c7b82SBorislav Petkovarch/x86/lib/inat.c 26d30c7b82SBorislav Petkovarch/x86/lib/insn.c 27d30c7b82SBorislav Petkov' 28bb090fdbSJulien Thierryfi 293bd51c5aSJosh Poimboeuf 302ffd84aeSArnaldo Carvalho de Melocheck_2 () { 312ffd84aeSArnaldo Carvalho de Melo file1=$1 322ffd84aeSArnaldo Carvalho de Melo file2=$2 333bd51c5aSJosh Poimboeuf 342ffd84aeSArnaldo Carvalho de Melo shift 352ffd84aeSArnaldo Carvalho de Melo shift 362ffd84aeSArnaldo Carvalho de Melo 372ffd84aeSArnaldo Carvalho de Melo cmd="diff $* $file1 $file2 > /dev/null" 382ffd84aeSArnaldo Carvalho de Melo 392ffd84aeSArnaldo Carvalho de Melo test -f $file2 && { 402ffd84aeSArnaldo Carvalho de Melo eval $cmd || { 412ffd84aeSArnaldo Carvalho de Melo echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2 422ffd84aeSArnaldo Carvalho de Melo echo diff -u $file1 $file2 432ffd84aeSArnaldo Carvalho de Melo } 442ffd84aeSArnaldo Carvalho de Melo } 452ffd84aeSArnaldo Carvalho de Melo} 462ffd84aeSArnaldo Carvalho de Melo 472ffd84aeSArnaldo Carvalho de Melocheck () { 482ffd84aeSArnaldo Carvalho de Melo file=$1 492ffd84aeSArnaldo Carvalho de Melo 502ffd84aeSArnaldo Carvalho de Melo shift 512ffd84aeSArnaldo Carvalho de Melo 522ffd84aeSArnaldo Carvalho de Melo check_2 tools/$file $file $* 533bd51c5aSJosh Poimboeuf} 543bd51c5aSJosh Poimboeuf 553bd51c5aSJosh Poimboeufif [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then 563bd51c5aSJosh Poimboeuf exit 0 573bd51c5aSJosh Poimboeuffi 583bd51c5aSJosh Poimboeuf 592ffd84aeSArnaldo Carvalho de Melocd ../.. 602ffd84aeSArnaldo Carvalho de Melo 613890b8d9SJulien Thierrywhile read -r file_entry; do 623890b8d9SJulien Thierry if [ -z "$file_entry" ]; then 633890b8d9SJulien Thierry continue 643890b8d9SJulien Thierry fi 652ffd84aeSArnaldo Carvalho de Melo 663890b8d9SJulien Thierry check $file_entry 673890b8d9SJulien Thierrydone <<EOF 683890b8d9SJulien Thierry$FILES 693890b8d9SJulien ThierryEOF 70d30c7b82SBorislav Petkov 71d30c7b82SBorislav Petkovif [ "$SRCARCH" = "x86" ]; then 72d30c7b82SBorislav Petkov for i in $SYNC_CHECK_FILES; do 73d30c7b82SBorislav Petkov check $i '-I "^.*\/\*.*__ignore_sync_check__.*\*\/.*$"' 74d30c7b82SBorislav Petkov done 75d30c7b82SBorislav Petkovfi 76