gen-insn-x86-dat.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. set -e
  14. if [ "$(uname -m)" != "x86_64" ]; then
  15. echo "ERROR: This script only works on x86_64"
  16. exit 1
  17. fi
  18. cd $(dirname $0)
  19. trap 'echo "Might need a more recent version of binutils"' EXIT
  20. echo "Compiling insn-x86-dat-src.c to 64-bit object"
  21. gcc -g -c insn-x86-dat-src.c
  22. objdump -dSw insn-x86-dat-src.o | awk -f gen-insn-x86-dat.awk > insn-x86-dat-64.c
  23. rm -f insn-x86-dat-src.o
  24. echo "Compiling insn-x86-dat-src.c to 32-bit object"
  25. gcc -g -c -m32 insn-x86-dat-src.c
  26. objdump -dSw insn-x86-dat-src.o | awk -f gen-insn-x86-dat.awk > insn-x86-dat-32.c
  27. rm -f insn-x86-dat-src.o
  28. trap - EXIT
  29. echo "Done (use git diff to see the changes)"