hello-aarch64.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 -f test/test0105/lisp.h \
  21. -f test/common_aarch64/functions/malloc.c \
  22. -f functions/calloc.c \
  23. -f functions/in_set.c \
  24. -f test/common_aarch64/functions/file.c \
  25. -f test/common_aarch64/functions/exit.c \
  26. -f functions/numerate_number.c \
  27. -f functions/match.c \
  28. -f functions/file_print.c \
  29. -f test/test0105/lisp.c \
  30. -f test/test0105/lisp_cell.c \
  31. -f test/test0105/lisp_eval.c \
  32. -f test/test0105/lisp_print.c \
  33. -f test/test0105/lisp_read.c \
  34. --debug \
  35. --bootstrap-mode \
  36. -o test/test0105/lisp.M1 || exit 1
  37. # Build debug footer
  38. blood-elf --64 -f test/test0105/lisp.M1 \
  39. --entry _start \
  40. -o test/test0105/lisp-footer.M1 || exit 2
  41. # Macro assemble with libc written in M1-Macro
  42. M1 -f test/common_aarch64/aarch64_defs.M1 \
  43. -f test/common_aarch64/libc-core.M1 \
  44. -f test/test0105/lisp.M1 \
  45. -f test/test0105/lisp-footer.M1 \
  46. --LittleEndian \
  47. --architecture aarch64 \
  48. -o test/test0105/lisp.hex2 || exit 3
  49. # Resolve all linkages
  50. hex2 -f test/common_aarch64/ELF-aarch64-debug.hex2 \
  51. -f test/test0105/lisp.hex2 \
  52. --LittleEndian \
  53. --architecture aarch64 \
  54. --BaseAddress 0x400000 \
  55. -o test/results/test0105-aarch64-binary \
  56. --exec_enable || exit 4
  57. # Ensure binary works if host machine supports test
  58. if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ]
  59. then
  60. # Verify that the compiled program returns the correct result
  61. out=$(./test/results/test0105-aarch64-binary --version 2>&1 )
  62. [ 0 = $? ] || exit 5
  63. [ "$out" = "Slow_Lisp 0.1" ] || exit 6
  64. # Verify that the resulting file works
  65. out=$(./test/results/test0105-aarch64-binary --file test/test0105/test.scm)
  66. [ "$out" = "42" ] || exit 7
  67. fi
  68. exit 0