hello-aarch64.sh 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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/test0021/tmp-aarch64"
  20. mkdir -p ${TMPDIR}
  21. # Build the test
  22. bin/M2-Planet \
  23. --architecture aarch64 \
  24. -f test/common_aarch64/functions/chdir.c \
  25. -f test/common_aarch64/functions/malloc.c \
  26. -f test/common_aarch64/functions/getcwd.c \
  27. -f test/common_aarch64/functions/exit.c \
  28. -f test/common_aarch64/functions/file.c \
  29. -f functions/calloc.c \
  30. -f functions/match.c \
  31. -f functions/file_print.c \
  32. -f test/test0021/chdir.c \
  33. --debug \
  34. --bootstrap-mode \
  35. -o ${TMPDIR}/chdir.M1 \
  36. || exit 1
  37. # Build debug footer
  38. blood-elf \
  39. --64 \
  40. -f ${TMPDIR}/chdir.M1 \
  41. --entry _start \
  42. -o ${TMPDIR}/chdir-footer.M1 \
  43. || exit 2
  44. # Macro assemble with libc written in M1-Macro
  45. M1 \
  46. -f test/common_aarch64/aarch64_defs.M1 \
  47. -f test/common_aarch64/libc-core.M1 \
  48. -f ${TMPDIR}/chdir.M1 \
  49. -f ${TMPDIR}/chdir-footer.M1 \
  50. --LittleEndian \
  51. --architecture aarch64 \
  52. -o ${TMPDIR}/chdir.hex2 \
  53. || exit 3
  54. # Resolve all linkages
  55. hex2 \
  56. -f test/common_aarch64/ELF-aarch64-debug.hex2 \
  57. -f ${TMPDIR}/chdir.hex2 \
  58. --LittleEndian \
  59. --architecture aarch64 \
  60. --BaseAddress 0x400000 \
  61. -o test/results/test0021-aarch64-binary \
  62. --exec_enable \
  63. || exit 4
  64. # Ensure binary works if host machine supports test
  65. if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ]
  66. then
  67. . ./sha256.sh
  68. # Verify that the resulting file works
  69. ./test/results/test0021-aarch64-binary
  70. [ 0 = $? ] || exit 5
  71. fi
  72. exit 0