xref: /linux/tools/perf/arch/x86/tests/gen-insn-x86-dat.sh (revision fcc8487d477a3452a1d0ccbdd4c5e0e1e3cb8bed)
1#!/bin/sh
2# gen-insn-x86-dat: generate data for the insn-x86 test
3# Copyright (c) 2015, Intel Corporation.
4#
5# This program is free software; you can redistribute it and/or modify it
6# under the terms and conditions of the GNU General Public License,
7# version 2, as published by the Free Software Foundation.
8#
9# This program is distributed in the hope it will be useful, but WITHOUT
10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12# more details.
13
14set -e
15
16if [ "$(uname -m)" != "x86_64" ]; then
17	echo "ERROR: This script only works on x86_64"
18	exit 1
19fi
20
21cd $(dirname $0)
22
23trap 'echo "Might need a more recent version of binutils"' EXIT
24
25echo "Compiling insn-x86-dat-src.c to 64-bit object"
26
27gcc -g -c insn-x86-dat-src.c
28
29objdump -dSw insn-x86-dat-src.o | awk -f gen-insn-x86-dat.awk > insn-x86-dat-64.c
30
31rm -f insn-x86-dat-src.o
32
33echo "Compiling insn-x86-dat-src.c to 32-bit object"
34
35gcc -g -c -m32 insn-x86-dat-src.c
36
37objdump -dSw insn-x86-dat-src.o | awk -f gen-insn-x86-dat.awk > insn-x86-dat-32.c
38
39rm -f insn-x86-dat-src.o
40
41trap - EXIT
42
43echo "Done (use git diff to see the changes)"
44