Kyle Swenson | 8d8f654 | 2021-03-15 11:02:55 -0600 | [diff] [blame^] | 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 | |
| 14 | set -e |
| 15 | |
| 16 | if [ "$(uname -m)" != "x86_64" ]; then |
| 17 | echo "ERROR: This script only works on x86_64" |
| 18 | exit 1 |
| 19 | fi |
| 20 | |
| 21 | cd $(dirname $0) |
| 22 | |
| 23 | trap 'echo "Might need a more recent version of binutils"' EXIT |
| 24 | |
| 25 | echo "Compiling insn-x86-dat-src.c to 64-bit object" |
| 26 | |
| 27 | gcc -g -c insn-x86-dat-src.c |
| 28 | |
| 29 | objdump -dSw insn-x86-dat-src.o | awk -f gen-insn-x86-dat.awk > insn-x86-dat-64.c |
| 30 | |
| 31 | rm -f insn-x86-dat-src.o |
| 32 | |
| 33 | echo "Compiling insn-x86-dat-src.c to 32-bit object" |
| 34 | |
| 35 | gcc -g -c -m32 insn-x86-dat-src.c |
| 36 | |
| 37 | objdump -dSw insn-x86-dat-src.o | awk -f gen-insn-x86-dat.awk > insn-x86-dat-32.c |
| 38 | |
| 39 | rm -f insn-x86-dat-src.o |
| 40 | |
| 41 | trap - EXIT |
| 42 | |
| 43 | echo "Done (use git diff to see the changes)" |