^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) #!/bin/sh
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) # SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) if [ -z "$SRCARCH" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) echo 'sync-check.sh: error: missing $SRCARCH environment variable' >&2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) FILES="include/linux/objtool.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) if [ "$SRCARCH" = "x86" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) FILES="$FILES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) arch/x86/include/asm/inat_types.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) arch/x86/include/asm/orc_types.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) arch/x86/include/asm/emulate_prefix.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) arch/x86/lib/x86-opcode-map.txt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) arch/x86/tools/gen-insn-attr-x86.awk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) include/linux/static_call_types.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) arch/x86/include/asm/inat.h -I '^#include [\"<]\(asm/\)*inat_types.h[\">]'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) arch/x86/include/asm/insn.h -I '^#include [\"<]\(asm/\)*inat.h[\">]'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) arch/x86/lib/inat.c -I '^#include [\"<]\(../include/\)*asm/insn.h[\">]'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) arch/x86/lib/insn.c -I '^#include [\"<]\(../include/\)*asm/in\(at\|sn\).h[\">]' -I '^#include [\"<]\(../include/\)*asm/emulate_prefix.h[\">]'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) check_2 () {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) file1=$1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) file2=$2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) shift
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) shift
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) cmd="diff $* $file1 $file2 > /dev/null"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) test -f $file2 && {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) eval $cmd || {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) echo diff -u $file1 $file2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) check () {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) file=$1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) shift
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) check_2 tools/$file $file $*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) if [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) exit 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) cd ../..
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) while read -r file_entry; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) if [ -z "$file_entry" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) continue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) check $file_entry
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) done <<EOF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) $FILES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) EOF