hello-aarch64.sh 2.0 KB

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