hello-aarch64.sh 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 test/common_aarch64/functions/stat.c \
  30. -f test/test0101/hex2_linker.c \
  31. --debug \
  32. --bootstrap-mode \
  33. -o test/test0101/hex2_linker.M1 || exit 1
  34. # Build debug footer
  35. blood-elf --64 -f test/test0101/hex2_linker.M1 \
  36. --entry _start \
  37. -o test/test0101/hex2_linker-footer.M1 || exit 2
  38. # Macro assemble with libc written in M1-Macro
  39. M1 -f test/common_aarch64/aarch64_defs.M1 \
  40. -f test/common_aarch64/libc-core.M1 \
  41. -f test/test0101/hex2_linker.M1 \
  42. -f test/test0101/hex2_linker-footer.M1 \
  43. --LittleEndian \
  44. --architecture aarch64 \
  45. -o test/test0101/hex2_linker.hex2 || exit 3
  46. # Resolve all linkages
  47. hex2 -f test/common_aarch64/ELF-aarch64-debug.hex2 \
  48. -f test/test0101/hex2_linker.hex2 \
  49. --LittleEndian \
  50. --architecture aarch64 \
  51. --BaseAddress 0x400000 \
  52. -o test/results/test0101-aarch64-binary \
  53. --exec_enable || exit 4
  54. # Ensure binary works if host machine supports test
  55. if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ]
  56. then
  57. # Verify that the compiled program returns the correct result
  58. out=$(./test/results/test0101-aarch64-binary --version 2>&1 )
  59. [ 0 = $? ] || exit 5
  60. [ "$out" = "hex2 0.3" ] || exit 6
  61. . ./sha256.sh
  62. # Verify that the resulting file works
  63. ./test/results/test0101-aarch64-binary \
  64. -f test/common_x86/ELF-i386.hex2\
  65. -f test/test0101/test.hex2 \
  66. --LittleEndian \
  67. --architecture x86 \
  68. --BaseAddress 0x8048000 \
  69. -o test/test0101/proof || exit 7
  70. out=$(sha256_check test/test0101/proof.answer)
  71. [ "$out" = "test/test0101/proof: OK" ] || exit 8
  72. fi
  73. exit 0