xref: /openbmc/linux/tools/objtool/sync-check.sh (revision d9e32672)
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3
4FILES='
5arch/x86/include/asm/inat_types.h
6arch/x86/include/asm/orc_types.h
7arch/x86/lib/x86-opcode-map.txt
8arch/x86/tools/gen-insn-attr-x86.awk
9'
10
11check_2 () {
12  file1=$1
13  file2=$2
14
15  shift
16  shift
17
18  cmd="diff $* $file1 $file2 > /dev/null"
19
20  test -f $file2 && {
21    eval $cmd || {
22      echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2
23      echo diff -u $file1 $file2
24    }
25  }
26}
27
28check () {
29  file=$1
30
31  shift
32
33  check_2 tools/$file $file $*
34}
35
36if [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then
37	exit 0
38fi
39
40cd ../..
41
42for i in $FILES; do
43  check $i
44done
45
46check arch/x86/include/asm/inat.h     '-I "^#include [\"<]\(asm/\)*inat_types.h[\">]"'
47check arch/x86/include/asm/insn.h     '-I "^#include [\"<]\(asm/\)*inat.h[\">]"'
48check arch/x86/lib/inat.c             '-I "^#include [\"<]\(../include/\)*asm/insn.h[\">]"'
49check arch/x86/lib/insn.c             '-I "^#include [\"<]\(../include/\)*asm/in\(at\|sn\).h[\">]"'
50
51cd -
52