hello-aarch64.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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/test0000/return.c \
  22. -o test/test0000/return.M1 || exit 1
  23. # Macro assemble with libc written in M1-Macro
  24. M1 -f test/common_aarch64/aarch64_defs.M1 \
  25. -f test/common_aarch64/libc-core.M1 \
  26. -f test/test0000/return.M1 \
  27. --LittleEndian \
  28. --architecture aarch64 \
  29. -o test/test0000/return.hex2 || exit 2
  30. # Resolve all linkages
  31. hex2 -f test/common_aarch64/ELF-aarch64.hex2 \
  32. -f test/test0000/return.hex2 \
  33. --LittleEndian \
  34. --architecture aarch64 \
  35. --BaseAddress 0x400000 \
  36. -o test/results/test0000-aarch64-binary \
  37. --exec_enable || exit 3
  38. # Ensure binary works if host machine supports test
  39. if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ]
  40. then
  41. # Verify that the compiled program returns the correct result
  42. ./test/results/test0000-aarch64-binary
  43. [ 42 = $? ] || exit 4
  44. fi
  45. exit 0