hello-aarch64.sh 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 -x
  19. # Build the test
  20. ./bin/M2-Planet --architecture aarch64 \
  21. -f test/common_aarch64/functions/exit.c \
  22. -f test/common_aarch64/functions/file.c \
  23. -f functions/file_print.c \
  24. -f test/common_aarch64/functions/malloc.c \
  25. -f functions/calloc.c \
  26. -f functions/match.c \
  27. -f functions/in_set.c \
  28. -f functions/numerate_number.c \
  29. -f functions/string.c \
  30. -f functions/require.c \
  31. -f test/test0102/M1-macro.c \
  32. --debug \
  33. --bootstrap-mode \
  34. -o test/test0102/M1-macro.M1 || exit 1
  35. # Build debug footer
  36. blood-elf --64 -f test/test0102/M1-macro.M1 \
  37. --entry _start \
  38. -o test/test0102/M1-macro-footer.M1 || exit 2
  39. # Macro assemble with libc written in M1-Macro
  40. M1 -f test/common_aarch64/aarch64_defs.M1 \
  41. -f test/common_aarch64/libc-core.M1 \
  42. -f test/test0102/M1-macro.M1 \
  43. -f test/test0102/M1-macro-footer.M1 \
  44. --LittleEndian \
  45. --architecture aarch64 \
  46. -o test/test0102/M1-macro.hex2 || exit 3
  47. # Resolve all linkages
  48. hex2 -f test/common_aarch64/ELF-aarch64-debug.hex2 \
  49. -f test/test0102/M1-macro.hex2 \
  50. --LittleEndian \
  51. --architecture aarch64 \
  52. --BaseAddress 0x400000 \
  53. -o test/results/test0102-aarch64-binary \
  54. --exec_enable || exit 4
  55. # Ensure binary works if host machine supports test
  56. if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ]
  57. then
  58. # Verify that the compiled program returns the correct result
  59. out=$(./test/results/test0102-aarch64-binary --version 2>&1 )
  60. [ 0 = $? ] || exit 5
  61. [ "$out" = "M1 1.0.0" ] || exit 6
  62. # Verify that the resulting file works
  63. ./test/results/test0102-aarch64-binary -f \
  64. test/common_x86/x86_defs.M1 \
  65. -f test/common_x86/libc-core.M1 \
  66. -f test/test0100/test.M1 \
  67. --LittleEndian \
  68. --architecture x86 \
  69. -o test/test0102/proof || exit 7
  70. . ./sha256.sh
  71. out=$(sha256_check test/test0102/proof.answer)
  72. [ "$out" = "test/test0102/proof: OK" ] || exit 8
  73. fi
  74. exit 0