xref: /openbmc/linux/tools/objtool/sync-check.sh (revision 1e7e47883830aae5e8246a22ca2fc6883c61acdf)
13bd51c5aSJosh Poimboeuf#!/bin/sh
23bd51c5aSJosh Poimboeuf# SPDX-License-Identifier: GPL-2.0
33bd51c5aSJosh Poimboeuf
43bd51c5aSJosh PoimboeufFILES='
53bd51c5aSJosh Poimboeufarch/x86/include/asm/inat_types.h
63bd51c5aSJosh Poimboeufarch/x86/include/asm/orc_types.h
74d65adfcSMasami Hiramatsuarch/x86/include/asm/emulate_prefix.h
8d046b725SJosh Poimboeufarch/x86/lib/x86-opcode-map.txt
9d046b725SJosh Poimboeufarch/x86/tools/gen-insn-attr-x86.awk
10*1e7e4788SJosh Poimboeufinclude/linux/static_call_types.h
113bd51c5aSJosh Poimboeuf'
123bd51c5aSJosh Poimboeuf
132ffd84aeSArnaldo Carvalho de Melocheck_2 () {
142ffd84aeSArnaldo Carvalho de Melo  file1=$1
152ffd84aeSArnaldo Carvalho de Melo  file2=$2
163bd51c5aSJosh Poimboeuf
172ffd84aeSArnaldo Carvalho de Melo  shift
182ffd84aeSArnaldo Carvalho de Melo  shift
192ffd84aeSArnaldo Carvalho de Melo
202ffd84aeSArnaldo Carvalho de Melo  cmd="diff $* $file1 $file2 > /dev/null"
212ffd84aeSArnaldo Carvalho de Melo
222ffd84aeSArnaldo Carvalho de Melo  test -f $file2 && {
232ffd84aeSArnaldo Carvalho de Melo    eval $cmd || {
242ffd84aeSArnaldo Carvalho de Melo      echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2
252ffd84aeSArnaldo Carvalho de Melo      echo diff -u $file1 $file2
262ffd84aeSArnaldo Carvalho de Melo    }
272ffd84aeSArnaldo Carvalho de Melo  }
282ffd84aeSArnaldo Carvalho de Melo}
292ffd84aeSArnaldo Carvalho de Melo
302ffd84aeSArnaldo Carvalho de Melocheck () {
312ffd84aeSArnaldo Carvalho de Melo  file=$1
322ffd84aeSArnaldo Carvalho de Melo
332ffd84aeSArnaldo Carvalho de Melo  shift
342ffd84aeSArnaldo Carvalho de Melo
352ffd84aeSArnaldo Carvalho de Melo  check_2 tools/$file $file $*
363bd51c5aSJosh Poimboeuf}
373bd51c5aSJosh Poimboeuf
383bd51c5aSJosh Poimboeufif [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then
393bd51c5aSJosh Poimboeuf	exit 0
403bd51c5aSJosh Poimboeuffi
413bd51c5aSJosh Poimboeuf
422ffd84aeSArnaldo Carvalho de Melocd ../..
432ffd84aeSArnaldo Carvalho de Melo
443bd51c5aSJosh Poimboeuffor i in $FILES; do
453bd51c5aSJosh Poimboeuf  check $i
463bd51c5aSJosh Poimboeufdone
472ffd84aeSArnaldo Carvalho de Melo
48ae31a514SArnaldo Carvalho de Melocheck arch/x86/include/asm/inat.h     '-I "^#include [\"<]\(asm/\)*inat_types.h[\">]"'
49ae31a514SArnaldo Carvalho de Melocheck arch/x86/include/asm/insn.h     '-I "^#include [\"<]\(asm/\)*inat.h[\">]"'
50ae31a514SArnaldo Carvalho de Melocheck arch/x86/lib/inat.c             '-I "^#include [\"<]\(../include/\)*asm/insn.h[\">]"'
514d65adfcSMasami Hiramatsucheck arch/x86/lib/insn.c             '-I "^#include [\"<]\(../include/\)*asm/in\(at\|sn\).h[\">]" -I "^#include [\"<]\(../include/\)*asm/emulate_prefix.h[\">]"'
52