hello-aarch64.sh 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #! /bin/sh
  2. ## Copyright (C) 2017 Jeremiah Orians
  3. ## Copyright (C) 2021 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. TMPDIR="test/test0023/tmp-aarch64"
  20. mkdir -p ${TMPDIR}
  21. # Build the test
  22. bin/M2-Planet \
  23. --architecture aarch64 \
  24. -f M2libc/AArch64/Linux/unistd.h \
  25. -f M2libc/stdlib.c \
  26. -f M2libc/AArch64/Linux/fcntl.h \
  27. -f M2libc/stdio.c \
  28. -f test/test0023/fseek.c \
  29. --debug \
  30. -o ${TMPDIR}/fseek.M1 \
  31. || exit 1
  32. # Build debug footer
  33. blood-elf \
  34. --64 \
  35. -f ${TMPDIR}/fseek.M1 \
  36. --entry _start \
  37. -o ${TMPDIR}/fseek-footer.M1 \
  38. || exit 2
  39. # Macro assemble with libc written in M1-Macro
  40. M1 \
  41. -f M2libc/AArch64/aarch64_defs.M1 \
  42. -f M2libc/AArch64/libc-full.M1 \
  43. -f ${TMPDIR}/fseek.M1 \
  44. -f ${TMPDIR}/fseek-footer.M1 \
  45. --LittleEndian \
  46. --architecture aarch64 \
  47. -o ${TMPDIR}/fseek.hex2 \
  48. || exit 3
  49. # Resolve all linkages
  50. hex2 \
  51. -f M2libc/AArch64/ELF-aarch64-debug.hex2 \
  52. -f ${TMPDIR}/fseek.hex2 \
  53. --LittleEndian \
  54. --architecture aarch64 \
  55. --BaseAddress 0x400000 \
  56. -o test/results/test0023-aarch64-binary \
  57. --exec_enable \
  58. || exit 4
  59. # Ensure binary works if host machine supports test
  60. if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ]
  61. then
  62. . ./sha256.sh
  63. # Verify that the resulting file works
  64. ./test/results/test0023-aarch64-binary test/test0023/question >| test/test0023/proof
  65. [ 0 = $? ] || exit 5
  66. out=$(sha256_check test/test0023/proof.answer)
  67. [ "$out" = "test/test0023/proof: OK" ] || exit 6
  68. fi
  69. exit 0