diff --git a/CHANGELOG.org b/CHANGELOG.org index 7eb1134..06a010b 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -16,7 +16,7 @@ * Current ** Added -Added 6/24 working tests for armv7l +Added 8/24 working tests for armv7l ** Changed diff --git a/cc_core.c b/cc_core.c index 0654369..fd6f1a7 100644 --- a/cc_core.c +++ b/cc_core.c @@ -1077,7 +1077,7 @@ void process_do() else if(X86 == Architecture) emit_out("TEST\nJUMP_NE %DO_"); else if(ARMV7L == Architecture) emit_out("!0 CMPI8 R0 IMM_ALWAYS\n^~DO_"); uniqueID_out(function->s, number_string); - if(ARMV7L == Architecture) emit_out(" JUMP_NE\t"); + if(ARMV7L == Architecture) emit_out(" JUMP_NE\n"); emit_out(":DO_END_"); uniqueID_out(function->s, number_string); @@ -1179,12 +1179,13 @@ void process_break() if(KNIGHT_POSIX == Architecture) emit_out("JUMP @"); else if(X86 == Architecture) emit_out("JUMP %"); - else if(ARMV7L == Architecture) emit_out("PLACEHOLDER\t#process_break\n"); + else if(ARMV7L == Architecture) emit_out("^~"); emit_out(break_target_head); emit_out(break_target_func); emit_out("_"); emit_out(break_target_num); + if(ARMV7L == Architecture) emit_out(" JUMP_ALWAYS"); emit_out("\n"); require_match("ERROR in break statement\nMissing ;\n", ";"); } @@ -1278,8 +1279,9 @@ void statement() global_token = global_token->next; if(KNIGHT_POSIX == Architecture) emit_out("JUMP @"); else if(X86 == Architecture) emit_out("JUMP %"); - else if(ARMV7L == Architecture) emit_out("PLACEHOLDER\t#\n"); + else if(ARMV7L == Architecture) emit_out("^~"); emit_out(global_token->s); + if(ARMV7L == Architecture) emit_out(" JUMP_ALWAYS"); emit_out("\n"); global_token = global_token->next; require_match("ERROR in statement\nMissing ;\n", ";"); diff --git a/makefile b/makefile index e52696a..71c1088 100644 --- a/makefile +++ b/makefile @@ -98,6 +98,9 @@ test: test00-knight-posix-binary \ test06-armv7l-binary \ test07-armv7l-binary \ test08-armv7l-binary \ + test09-armv7l-binary \ + test10-armv7l-binary \ + test11-armv7l-binary \ test00-x86-binary \ test01-x86-binary \ test02-x86-binary \ @@ -235,6 +238,15 @@ test07-armv7l-binary: M2-Planet | results test08-armv7l-binary: M2-Planet | results test/test08/hello-armv7l.sh +test09-armv7l-binary: M2-Planet | results + test/test09/hello-armv7l.sh + +test10-armv7l-binary: M2-Planet | results + test/test10/hello-armv7l.sh + +test11-armv7l-binary: M2-Planet | results + test/test11/hello-armv7l.sh + test00-x86-binary: M2-Planet | results test/test00/hello-x86.sh diff --git a/test/test.answers b/test/test.answers index 6796926..790f42d 100644 --- a/test/test.answers +++ b/test/test.answers @@ -25,12 +25,15 @@ a9a3e332d13ded5f80d7431f8717f26527b3722b33ea57760a9a5723dffc099c test/results/t 1e23922a948e4ed066e8277899eefdd4e1b30621cac39d99a58728b9867d45e7 test/results/test08-armv7l-binary b824859fd0e39f1417742a1b9a1cec18ade78afdd80ce2c64cb54cdf7683f53a test/results/test08-knight-posix-binary f1c01feb865c4d552033186d9ce50dd39468a7e8aebf762886c13ad3e03b5011 test/results/test08-x86-binary +c3c230a7cb41de90f3838752731ac102c6635f0ae937f5994c7880dfc13c31ef test/results/test09-armv7l-binary 0feaacc13ad24c2b513fd9d46a58c38b1af57e77275c9a148cafb4a0d3cc7b7a test/results/test09-knight-posix-binary 3b39e72f3de90ed690adfaf6145af46157cef2ec5e72867ac577fa27a0229894 test/results/test09-x86-binary +2cd8d061bb1593016278f303c0772a367e5473e9dd763e50934a7e3d3738cbe5 test/results/test10-armv7l-binary c1b5a2a3cd46c5e95e5540e871c2a916e028684ca80f51c001ef489342e27625 test/results/test10-knight-posix-binary 020e86020819cc4963e6185b22e534fcf8306b6cb116f12643f254a24688ff0a test/results/test10-x86-binary -2ab9dbf623d09807db89e38ba837fe65234538441f0152e170edb78a0aba6c7a test/results/test100-knight-posix-binary -0fabd4489381a382d04ec114d8279b9ad846f449479b238a8c9050c9f14fa67b test/results/test100-x86-binary +e7129da32a2d2b63c926463efcb064ad7165f4e23d0baa977932f516693b504c test/results/test100-knight-posix-binary +01ab3efcf5b57c11573fd774072ed3fd4ec42cca4bf5d64a35a1b878c63f6976 test/results/test100-x86-binary +aec370b762dc586ac9035c4fdfc98302a79628e9199ec28706765ab17a26b6d8 test/results/test11-armv7l-binary 63fd5fbf389d1b19031026df193ec55e98d923b8568007125b80bc246c094496 test/results/test11-knight-posix-binary 3fd11bad4a426ce1ff8fd9c6d7d2b943effae9f3f5740b7376e426e9b0555851 test/results/test11-x86-binary 313536f9209d29d4c3b40f6ada898f81c1fb3b650ca1a84754f90b1db3b9e001 test/results/test12-knight-posix-binary diff --git a/test/test09/hello-armv7l.sh b/test/test09/hello-armv7l.sh new file mode 100755 index 0000000..724cb8e --- /dev/null +++ b/test/test09/hello-armv7l.sh @@ -0,0 +1,44 @@ +#! /bin/sh +## Copyright (C) 2017 Jeremiah Orians +## This file is part of M2-Planet. +## +## M2-Planet is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## M2-Planet is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with M2-Planet. If not, see . + +set -x +# Build the test +bin/M2-Planet --architecture armv7l -f test/common_armv7l/functions/putchar.c \ + -f test/common_armv7l/functions/exit.c \ + -f test/test09/goto.c \ + -o test/test09/goto.M1 || exit 1 + +# Macro assemble with libc written in M1-Macro +M1 -f test/common_armv7l/armv7l_defs.M1 \ + -f test/common_armv7l/libc-core.M1 \ + -f test/test09/goto.M1 \ + --LittleEndian \ + --architecture armv7l \ + -o test/test09/goto.hex2 || exit 2 + +# Resolve all linkages +hex2 -f test/common_armv7l/ELF-armv7l.hex2 -f test/test09/goto.hex2 --LittleEndian --architecture armv7l --BaseAddress 0x10000 -o test/results/test09-armv7l-binary --exec_enable || exit 3 + +# Ensure binary works if host machine supports test +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] +then + # Verify that the compiled program returns the correct result + out=$(./test/results/test09-armv7l-binary 2>&1 ) + [ 42 = $? ] || exit 4 + [ "$out" = "Hello mes" ] || exit 5 +fi +exit 0 diff --git a/test/test10/hello-armv7l.sh b/test/test10/hello-armv7l.sh new file mode 100755 index 0000000..f772a86 --- /dev/null +++ b/test/test10/hello-armv7l.sh @@ -0,0 +1,45 @@ +#! /bin/sh +## Copyright (C) 2017 Jeremiah Orians +## This file is part of M2-Planet. +## +## M2-Planet is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## M2-Planet is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with M2-Planet. If not, see . + +set -x +# Build the test +bin/M2-Planet --architecture armv7l -f test/common_armv7l/functions/putchar.c \ + -f test/common_armv7l/functions/exit.c \ + -f test/common_armv7l/functions/malloc.c \ + -f test/test10/nested_struct.c \ + -o test/test10/nested_struct.M1 || exit 1 + +# Macro assemble with libc written in M1-Macro +M1 -f test/common_armv7l/armv7l_defs.M1 \ + -f test/common_armv7l/libc-core.M1 \ + -f test/test10/nested_struct.M1 \ + --LittleEndian \ + --architecture armv7l \ + -o test/test10/nested_struct.hex2 || exit 2 + +# Resolve all linkages +hex2 -f test/common_armv7l/ELF-armv7l.hex2 -f test/test10/nested_struct.hex2 --LittleEndian --architecture armv7l --BaseAddress 0x10000 -o test/results/test10-armv7l-binary --exec_enable || exit 3 + +# Ensure binary works if host machine supports test +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] +then + # Verify that the compiled program returns the correct result + out=$(./test/results/test10-armv7l-binary 2>&1 ) + [ 12 = $? ] || exit 4 + [ "$out" = "35419896642975313541989657891634" ] || exit 5 +fi +exit 0 diff --git a/test/test100/proof.answer b/test/test100/proof.answer index 8627648..c7c92b4 100644 --- a/test/test100/proof.answer +++ b/test/test100/proof.answer @@ -1 +1 @@ -eef31f88977f516d52af0f0fa20876fd5cc271dfd3686ea207352c965b25b1e6 test/test100/proof +db5953b6829313313f43b9f0474891c6436addd283de27f78436ad8e60da8b74 test/test100/proof diff --git a/test/test11/hello-armv7l.sh b/test/test11/hello-armv7l.sh new file mode 100755 index 0000000..843d758 --- /dev/null +++ b/test/test11/hello-armv7l.sh @@ -0,0 +1,44 @@ +#! /bin/sh +## Copyright (C) 2017 Jeremiah Orians +## This file is part of M2-Planet. +## +## M2-Planet is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## M2-Planet is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with M2-Planet. If not, see . + +set -ex +# Build the test +bin/M2-Planet --architecture armv7l -f test/common_armv7l/functions/putchar.c \ + -f test/common_armv7l/functions/exit.c \ + -f test/test11/break-do.c \ + -o test/test11/break-do.M1 || exit 1 + +# Macro assemble with libc written in M1-Macro +M1 -f test/common_armv7l/armv7l_defs.M1 \ + -f test/common_armv7l/libc-core.M1 \ + -f test/test11/break-do.M1 \ + --LittleEndian \ + --architecture armv7l \ + -o test/test11/break-do.hex2 || exit 2 + +# Resolve all linkages +hex2 -f test/common_armv7l/ELF-armv7l.hex2 -f test/test11/break-do.hex2 --LittleEndian --architecture armv7l --BaseAddress 0x10000 -o test/results/test11-armv7l-binary --exec_enable || exit 3 + +# Ensure binary works if host machine supports test +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] +then + # Verify that the resulting file works + ./test/results/test11-armv7l-binary >| test/test11/proof || exit 4 + out=$(sha256sum -c test/test11/proof.answer) + [ "$out" = "test/test11/proof: OK" ] || exit 5 +fi +exit 0