Blame view

tools/objtool/sync-check.sh 1.38 KB
3bd51c5a3   Josh Poimboeuf   objtool: Move ker...
1
2
  #!/bin/sh
  # SPDX-License-Identifier: GPL-2.0
bb090fdb7   Julien Thierry   objtool: Make syn...
3
4
5
6
  if [ -z "$SRCARCH" ]; then
  	echo 'sync-check.sh: error: missing $SRCARCH environment variable' >&2
  	exit 1
  fi
ee819aedf   Julien Thierry   objtool: Make unw...
7
  FILES="include/linux/objtool.h"
bb090fdb7   Julien Thierry   objtool: Make syn...
8
  if [ "$SRCARCH" = "x86" ]; then
ee819aedf   Julien Thierry   objtool: Make unw...
9
  FILES="$FILES
3bd51c5a3   Josh Poimboeuf   objtool: Move ker...
10
11
  arch/x86/include/asm/inat_types.h
  arch/x86/include/asm/orc_types.h
4d65adfcd   Masami Hiramatsu   x86: xen: insn: D...
12
  arch/x86/include/asm/emulate_prefix.h
d046b7254   Josh Poimboeuf   objtool: Move x86...
13
14
  arch/x86/lib/x86-opcode-map.txt
  arch/x86/tools/gen-insn-attr-x86.awk
1e7e47883   Josh Poimboeuf   x86/static_call: ...
15
  include/linux/static_call_types.h
3890b8d92   Julien Thierry   objtool: Group he...
16
17
18
19
20
  arch/x86/include/asm/inat.h     -I '^#include [\"<]\(asm/\)*inat_types.h[\">]'
  arch/x86/include/asm/insn.h     -I '^#include [\"<]\(asm/\)*inat.h[\">]'
  arch/x86/lib/inat.c             -I '^#include [\"<]\(../include/\)*asm/insn.h[\">]'
  arch/x86/lib/insn.c             -I '^#include [\"<]\(../include/\)*asm/in\(at\|sn\).h[\">]' -I '^#include [\"<]\(../include/\)*asm/emulate_prefix.h[\">]'
  "
bb090fdb7   Julien Thierry   objtool: Make syn...
21
  fi
3bd51c5a3   Josh Poimboeuf   objtool: Move ker...
22

2ffd84ae9   Arnaldo Carvalho de Melo   objtool: Update s...
23
24
25
  check_2 () {
    file1=$1
    file2=$2
3bd51c5a3   Josh Poimboeuf   objtool: Move ker...
26

2ffd84ae9   Arnaldo Carvalho de Melo   objtool: Update s...
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
    shift
    shift
  
    cmd="diff $* $file1 $file2 > /dev/null"
  
    test -f $file2 && {
      eval $cmd || {
        echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2
        echo diff -u $file1 $file2
      }
    }
  }
  
  check () {
    file=$1
  
    shift
  
    check_2 tools/$file $file $*
3bd51c5a3   Josh Poimboeuf   objtool: Move ker...
46
47
48
49
50
  }
  
  if [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then
  	exit 0
  fi
2ffd84ae9   Arnaldo Carvalho de Melo   objtool: Update s...
51
  cd ../..
3890b8d92   Julien Thierry   objtool: Group he...
52
53
54
55
  while read -r file_entry; do
      if [ -z "$file_entry" ]; then
  	continue
      fi
2ffd84ae9   Arnaldo Carvalho de Melo   objtool: Update s...
56

3890b8d92   Julien Thierry   objtool: Group he...
57
58
59
60
      check $file_entry
  done <<EOF
  $FILES
  EOF