hello-amd64.sh 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #! /bin/sh
  2. ## Copyright (C) 2017 Jeremiah Orians
  3. ## This file is part of M2-Planet.
  4. ##
  5. ## M2-Planet is free software: you can redistribute it and/or modify
  6. ## it under the terms of the GNU General Public License as published by
  7. ## the Free Software Foundation, either version 3 of the License, or
  8. ## (at your option) any later version.
  9. ##
  10. ## M2-Planet is distributed in the hope that it will be useful,
  11. ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ## GNU General Public License for more details.
  14. ##
  15. ## You should have received a copy of the GNU General Public License
  16. ## along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
  17. set -x
  18. # Build the test
  19. bin/M2-Planet --architecture amd64 \
  20. -f test/common_amd64/functions/malloc.c \
  21. -f test/common_amd64/functions/file.c \
  22. -f test/common_amd64/functions/exit.c \
  23. -f functions/in_set.c \
  24. -f functions/numerate_number.c \
  25. -f functions/calloc.c \
  26. -f functions/file_print.c \
  27. -f test/test0022/continue.c \
  28. --debug \
  29. --bootstrap-mode \
  30. -o test/test0022/continue.M1 || exit 1
  31. # Build debug footer
  32. blood-elf --64 -f test/test0022/continue.M1 \
  33. --entry _start \
  34. -o test/test0022/continue-footer.M1 || exit 2
  35. # Macro assemble with libc written in M1-Macro
  36. M1 -f test/common_amd64/amd64_defs.M1 \
  37. -f test/common_amd64/libc-core.M1 \
  38. -f test/test0022/continue.M1 \
  39. -f test/test0022/continue-footer.M1 \
  40. --LittleEndian \
  41. --architecture amd64 \
  42. -o test/test0022/continue.hex2 || exit 3
  43. # Resolve all linkages
  44. hex2 -f test/common_amd64/ELF-amd64-debug.hex2 \
  45. -f test/test0022/continue.hex2 \
  46. --LittleEndian \
  47. --architecture amd64 \
  48. --BaseAddress 0x00600000 \
  49. -o test/results/test0022-amd64-binary \
  50. --exec_enable || exit 4
  51. # Ensure binary works if host machine supports test
  52. if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ]
  53. then
  54. . ./sha256.sh
  55. # Verify that the resulting file works
  56. ./test/results/test0022-amd64-binary >| test/test0022/proof
  57. [ 0 = $? ] || exit 5
  58. out=$(sha256_check test/test0022/proof.answer)
  59. [ "$out" = "test/test0022/proof: OK" ] || exit 6
  60. fi
  61. exit 0