Sanne Wouda
4550eec19e
Extend macro #define support
...
- now supports #if defined(FOO)
- translation of #define FOO 1 to CONSTANT FOO 1 is still supported
2021-01-08 21:31:43 +00:00
Jeremiah Orians
3c4c09b95e
Added hacky version of #define support
2021-01-06 19:24:16 -05:00
Jeremiah Orians
25fd5e66c9
Another set of segfaults cleared out
2021-01-05 23:22:26 -05:00
Jeremiah Orians
bdd4e65580
Catch some basic segfaults
2021-01-05 23:00:58 -05:00
Sanne Wouda
63bb59404d
Improve error reporting for unexpected non-newline
2021-01-05 22:56:30 +00:00
Sanne Wouda
49fbe8942f
Add error checking for unexpected #endif
2021-01-05 22:56:30 +00:00
Sanne Wouda
89c6513cd8
Add support for conditional inclusion
...
- support for #if, #elif, #else, #endif, but no macro expansion just
yet. Any macro is treated as undefined and expands to 0.
for example:
./bin/M2-Planet -E test.c
#if 1 == FOO
foo
#else
bar
#endif
results in
bar
2021-01-05 22:54:30 +00:00
Sanne Wouda
cd96f65a23
Add macro directives to token_list
...
- change the lexer to not remove preprocessor directives
- preprocess() removes any lines starting with a macro directive that it
doesn't understand (which is currently all of them)
2021-01-05 22:53:39 +00:00
Sanne Wouda
7b8a99db3c
Add a preprocessor-only mode
...
- Very useful for testing and debugging
- Add preprocess() stub and skip compilation in preprocessor mode
2021-01-05 22:53:04 +00:00
Sanne Wouda
a18e0c1782
Add newline tokens to parse stream
...
- needed to determine start and end of macro directives
- the main parser doesn't need them, so strip out the newline tokens
before parsing to avoid changing it
2021-01-05 22:23:15 +00:00
Jeremiah Orians
921cc86ce6
First generation implemention of typedef
2021-01-02 22:00:02 -05:00
Jeremiah Orians
358b6cfb96
Fix modulus behavior that is wrong.
...
Thank you janneke
2021-01-01 16:39:27 -05:00
Jeremiah Orians
e451abd667
Fix e25c1995aa
SCM MES regression
2021-01-01 15:55:34 -05:00
Jeremiah Orians
cc1a17a040
Revert "file.c: introduce output buffering for x86"
...
This reverts commit 5afeb0743e
.
2021-01-01 15:28:30 -05:00
Jeremiah Orians
07baf02efe
Looks like I got x86/AMD64 signed and unsigned division backwards.
...
Thanks for finding that janneke
2021-01-01 10:52:23 -05:00
Jeremiah Orians
c220d14928
Catching some segfaults
2020-12-31 09:53:05 -05:00
Jeremiah Orians
e25c1995aa
Make types more proper
2020-12-27 21:51:46 -05:00
Jeremiah Orians
0ed81de9e1
Merge remote-tracking branch 'mihi/io-buffering-x86'
2020-12-22 22:19:44 -05:00
Jeremiah Orians
4de11b1bc6
Update checksums to reflect new fclose
2020-12-21 22:26:22 -05:00
Michael Schierl
5afeb0743e
file.c: introduce output buffering for x86
...
Note that this is a backwards incompatible change: Unlike POSIX, exit()
will not flush all open streams, so you are responsible for flushing or
closing all your streams before successful exit.
Also, file.c will now also require calloc.c (and malloc.c).
Updated the test cases accordingly.
Only implemented and tested for x86.
2020-12-21 16:57:17 +01:00
Michael Schierl
91bab2ef98
Close files that were fopen:ed
2020-12-21 16:57:17 +01:00
Jeremiah Orians
6fe6f44a29
Make type information localized to the inside of statements
2020-12-19 16:35:33 -05:00
Jeremiah Orians
e7a0ecd244
Cleared out non-essential string primitives and added support for --max-string
2020-12-19 09:46:22 -05:00
Jeremiah Orians
d9504e3872
Allow M2-Planet to support larger outputs without hitting a segfault
2020-12-19 06:50:11 -05:00
Sanne Wouda
968fdfea65
AArch64 support for unsigned comparison
2020-12-17 00:01:17 +00:00
Jeremiah Orians
e5befc4fee
armv7l support for unsigned comparisons
2020-12-15 21:09:26 -05:00
Jeremiah Orians
f2cae3d501
AMD64 support for unsigned comparisons
2020-12-15 20:28:04 -05:00
Jeremiah Orians
eaf3861954
Fix failing tests on x86
2020-12-15 19:02:32 -05:00
Jeremiah Orians
132e685f97
Fix x86 behavior on unsigned compares
2020-12-15 17:46:45 -05:00
Jeremiah Orians
9da48c5ece
match gcc behavior in regards to if(-1 > 0)
2020-12-15 07:24:07 -05:00
Jeremiah Orians
5c22aac02d
Change knight-posix HEAP behavior and leverage better relational choices for knight-posix
2020-12-15 06:02:38 -05:00
Sanne Wouda
a63b8837c0
[AArch64] Use arithmetic right shift for signed
...
- as discussed with deesix, this is the proper fix
- the test1000 checksum changes as it uses the M2-Planet source as input
2020-12-05 14:59:16 +00:00
Sanne Wouda
58b563435b
[AArch64] Use arithmetic right shift
...
- fixes a test failure if hex2 was compiled with M2-Planet
2020-12-04 19:37:29 +00:00
Sanne Wouda
624a5ac92d
[AArch64] Fix LSEEK syscall number
2020-12-04 15:45:06 +00:00
Jeremiah Orians
0615223052
Broke tests into processor specific sets and updated the M1 test
2020-12-01 22:24:36 -05:00
Jeremiah Orians
67dbbbdcfc
Enable support for C multi-strings
2020-11-15 18:58:25 -05:00
Jeremiah Orians
57264eb157
Catch potential segfaulting behavior in generated binaries
2020-11-08 21:13:12 -05:00
Jeremiah Orians
39915de931
harmonize integer behavior when reading strings
2020-10-17 13:50:25 -04:00
Jeremiah Orians
c4a636c99d
Fix shift behavior to better match C standard
2020-10-16 22:07:06 -04:00
nimaje
52114585bf
fix malloc to accept FreeBSD's behavior and fix failing binaries
2020-10-16 17:26:39 -04:00
nimaje
028bdaf951
Update ELF headers and sha256 function to better support FreeBSD
2020-10-16 12:00:42 -04:00
Jeremiah Orians
87672ddfdb
Release 1.6.0
2020-04-30 22:35:22 -04:00
deesix
205c383c5f
lib: fflush stub
...
Paraphrasing OriansJ's IRC message while working on kaem:
GCC needs fflush(stdout) to get matching behavior, as M2-Planet doesn't
buffer. I guess we will need to make a fflush function (it'll do nothing
but return 0).
2020-03-01 18:55:32 +01:00
Jeremiah Orians
09783ac089
Fixed continue behavior and added a test to verify correct behavior
2020-02-28 18:48:58 -05:00
Jeremiah Orians
6343e48600
Major relocation of tests to better structure for future additions
2020-02-28 18:27:12 -05:00
deesix
b2ece54864
aarch64: do not generate a wasteful stack anymore
...
Until now, each element on the compiled program stack was 128 bits long,
half of them unused because only one 64 bits value was stored.
Now it's 64 bits long, so we don't waste all that memory.
We workaround the architectural alignment restriction of the SP register by
using a free regular register. X18 is for platform use so it seems a good
candidate for this task.
At _start we copy the value of SP into X18. SP is not used anymore. When a
definition refers to SP it doesn't mean it literaly now, because here we
redefine (without renaming) the involved M1 macro definitions to operate
on X18 (easier transition; abstraction). INIT_SP is introduced.
The function arguments are passed via stack, so the offset from the Base
Pointer ("depth") to each of them is different now. Changes both to
compiler code (cc_core.c) and libc reflect that the arguments are 8 bytes
(instead of 16 bytes) apart now. Note that SUB_X0_32 and SUB_X0_48 are
removed, because we only need 8, 16 and 24 bytes subtraction to reach the
arguments from asm libc functions. SUB_X0_8 and SUB_X0_24 are introduced.
2020-02-08 00:16:54 +01:00
deesix
b2b1e13b03
aarch64: test27 links to the usual 0x400000 base address
2020-02-05 13:20:58 +01:00
Jeremiah Orians
aad1198faf
Revised tests to include dwarf stubs
2020-02-01 17:50:26 -05:00
fosslinux
831de6bc4a
Update kaem test to new kaem.c
2020-02-02 09:18:27 +11:00
fosslinux
510d4203ec
Add chdir family and getcwd family tests
2020-02-02 09:11:06 +11:00
Jeremiah Orians
71062011cd
Release 1.5.0
2020-02-01 16:21:10 -05:00
deesix
7dc280a10d
aarch64: tests
2020-02-01 21:23:49 +01:00
deesix
fbc2bf3333
aarch64: statement
2020-02-01 21:23:49 +01:00
deesix
803cf4ffa3
aarch64: flow control
2020-02-01 21:23:49 +01:00
deesix
ebb0e4a3f9
aarch64: expression
2020-02-01 21:23:49 +01:00
deesix
c32cb92daa
aarch64: arithmetic, relational and bitwise expressions
2020-02-01 21:23:49 +01:00
deesix
39936d81cb
aarch64: primary, postfix and unary expressions
2020-02-01 21:23:49 +01:00
deesix
b581244df0
aarch64: load of function, constant, global and variable
2020-02-01 21:23:49 +01:00
deesix
02bac66940
aarch64: function, function call, arguments, locals and return
2020-02-01 21:23:49 +01:00
deesix
0737a2acf0
aarch64: common recursion
2020-02-01 21:23:49 +01:00
deesix
0bded017b9
aarch64: recognize the new AArch64 target architecture
...
Now, aarch64 is valid for --architecture on the command-line. Accordingly,
the global variable Architecture is set to the new AARCH64 constant.
Manual page updated.
Register size is configured to 8 bytes.
2020-02-01 21:23:49 +01:00
Jeremiah Orians
095664e680
Fix knight-native to be able to support much larger binaries
2020-01-31 22:43:51 -05:00
Jeremiah Orians
5c4c6aee71
prevent void foo () { if(0) {} class of segfaults
2020-01-30 18:40:45 -05:00
Jeremiah Orians
0709770730
Enabled forgotten cleanup scripts and add logic to catch ?alloc errors
2020-01-25 14:15:45 -05:00
Jeremiah Orians
4601fbe0e0
Add basic error catching to primitives and cc_strings.c
2020-01-25 11:35:28 -05:00
Jeremiah Orians
4b2a048f14
Start reducing number of segfaults possible in M2-Planet
2020-01-22 18:03:28 -05:00
Jeremiah Orians
923784c797
Starting to restrict bad input
2020-01-21 17:50:26 -05:00
Jeremiah Orians
1221a5e6dc
Replace NOP with NULL because that is what is really ment by it
2020-01-06 20:21:26 -05:00
Jeremiah Orians
375fa888d0
added support for nested structs thanks to fosslinux
2019-12-23 06:39:45 -05:00
Jeremiah Orians
a10d822cff
fix segfault found thanks to fosslinux
2019-12-18 19:43:28 -05:00
Jeremiah Orians
64a3a1b674
Get division on x86/AMD64 a closer approximation of what is correct
2019-11-29 12:55:55 -05:00
Jan Nieuwenhuizen
b87ddb0051
[PATCH] numerate_number: Support lower case hex.
2019-11-07 22:57:53 -05:00
Jeremiah Orians
1fc2aeab48
Removed unneeded chars as toupper eliminates them as possibilities
2019-11-02 08:35:54 -04:00
Jeremiah Orians
9eb0a8706e
Fixed amd64's xchg behavior, removed fixup_int32 and updated Changelog
2019-10-31 20:54:43 -04:00
Jeremiah Orians
dea4f902b7
Adding support for additional type compatibility with C and backported
...
regression fix for ARMv7l debug headers
2019-10-27 12:55:07 -04:00
Jeremiah Orians
18a66f6296
Rearranged types to ensure better compliance with C type rules
2019-10-26 22:45:02 -04:00
Jeremiah Orians
c2cbc518f9
Fixed missing updated test23 answers and added support for mes.c types
2019-10-26 15:40:35 -04:00
Jeremiah Orians
4c34e69c83
Added support for \a and \b
2019-10-19 14:25:51 -04:00
Jeremiah Orians
465b4c9c31
Fixup behavior on 64bit platforms
2019-06-19 21:43:34 -04:00
Jeremiah Orians
f43aa4a44c
Minor tweaks to better match amd64 assembly
2019-06-03 21:01:14 -04:00
Jeremiah Orians
27cf071ee9
Release_1.3.0
2019-04-22 19:30:08 -04:00
Jeremiah Orians
e55dc78597
4/24 working tests for AMD64
2019-04-19 17:43:59 -04:00
deesix
a3acf66077
Global string (char*) value indirect store, to fix segfault
...
Because, as OriansJ found, we don't want to read the first bytes of the
value as a pointer. See global_load() for programs like:
char* s = "xyzzy\n";
int main(void){ file_print(s, 1); return 0; }
There's an alternative: "fix the GLOBAL behavior to be type sensitive" but
this indirect store was choosen because it "preserve[s] the ability to
assign new strings to a global char*".
2019-04-18 16:48:41 +02:00
Jeremiah Orians
420f8b62b9
1/24 working tests for AMD64 Port
2019-04-17 20:19:17 -04:00
Jeremiah Orians
99f2881546
Release_1.2.0
2019-04-14 10:24:13 -04:00
Jeremiah Orians
5384977d5a
23/24 working tests for armv7l
2019-04-14 08:49:11 -04:00
Jeremiah Orians
119226d569
Fixed ARMV7l stack behavior thanks to dddddd
2019-04-13 08:31:39 -04:00
Jeremiah Orians
442601197c
17/24 working tests for armv7l
2019-03-30 09:25:52 -04:00
Jeremiah Orians
c3ad31d66a
15/24 working tests for armv7l
2019-03-23 18:29:19 -04:00
Jeremiah Orians
87b1daaaa9
13/24 working tests for armv7l
2019-03-17 22:34:26 -04:00
Jeremiah Orians
95107d9fb6
10/24 working tests for armv7l
2019-03-17 10:08:56 -04:00
Jeremiah Orians
fe95136b49
8/24 working tests for ARMv7l
2019-03-17 06:15:20 -04:00
Jeremiah Orians
b61144efd7
6/24 working tests for ARMv7l
2019-03-16 23:27:52 -04:00
Jeremiah Orians
eb034f51e8
5/24 working tests for ARMv7l
2019-03-16 20:03:56 -04:00
Jeremiah Orians
f357464727
4/24 working tests for ARMv7l
2019-03-10 13:07:19 -04:00
Jeremiah Orians
740f376828
Test02 for ARMv7l
2019-03-10 11:24:13 -04:00
Jeremiah Orians
8f247d9716
Added second working test for ARMv7l
2019-03-10 09:33:45 -04:00
Jeremiah Orians
d1036c60c8
First working test for ARMv7l
2019-03-09 20:22:29 -05:00
Jeremiah Orians
d5d64bb254
knight-posix is now fully supported
2019-03-09 15:25:29 -05:00
Jeremiah Orians
f01f805803
Upgraded to 23/24 working tests
2019-03-09 11:56:16 -05:00
Jeremiah Orians
01658364e5
Upgraded to 16/24 working tests
2019-02-28 20:52:01 -05:00
Jeremiah Orians
577f19dea9
Upgraded to 14/24 working tests
2019-02-26 18:04:49 -05:00
Jeremiah Orians
d3965e811f
Incorporated 2 more working tests for knight-posix
2019-02-24 20:53:45 -05:00
Jeremiah Orians
69c319ef6c
Added working HEAP to knight-posix
2019-02-24 17:46:05 -05:00
Jeremiah Orians
c6ac46292f
Added test05 for knight-posix
2019-02-24 09:58:47 -05:00
Jeremiah Orians
a1309ae4b9
Added support for test03 for knight-posix
2019-02-24 06:48:31 -05:00
Jeremiah Orians
65f47417d4
Fixed test02 for knight-posix
2019-02-23 21:36:26 -05:00
Jeremiah Orians
ee1abde0d4
Add test2 for knight-posix
2019-02-23 20:18:53 -05:00
Jeremiah Orians
b085022577
Added initial draft of knight-posix support and first knight-posix test
2019-02-23 18:33:57 -05:00
Jeremiah Orians
a456bcc21d
Prepare for major change involving multi-arch support
2019-02-23 15:08:59 -05:00
Jeremiah Orians
0eefa0feb2
Update in preperation for mescc-tools 0.6.0 release
2019-02-23 11:05:20 -05:00
Jeremiah Orians
25d57d7d59
Adding support for octal and binary numbers
2019-01-27 22:35:44 -05:00
Jeremiah Orians
c1b3f4c60d
Adding custom type for mes.h
2019-01-14 19:05:49 -05:00
Jeremiah Orians
6f6dc7b48d
Slow_Lisp prototype update
2018-11-10 09:55:09 -05:00
Jeremiah Orians
4629a2e842
Fixed Linux 4.17 regression
2018-11-05 19:45:15 -05:00
Jeremiah Orians
56db0fcad4
Breaking change in M2-Planet
2018-10-17 16:08:04 -04:00
Jeremiah Orians
608d85b820
Fixed version number bug
2018-08-31 16:32:53 -04:00
Jeremiah Orians
32f2adafda
Pull patches from janneke
2018-08-26 21:15:32 -04:00
Jeremiah Orians
e249069cac
Release 1.0.0
2018-08-26 16:34:31 -04:00
Jeremiah Orians
951d259339
Minor reorganization
2018-08-20 20:41:37 -04:00
Jeremiah Orians
95b1fe029f
Broke out OUT and FUNCTION to silence a single GCC warning
2018-08-18 15:23:58 -04:00
Jeremiah Orians
51b8b275fd
More cleaning to simplify assembly bootstrap
2018-08-17 04:55:56 -04:00
Jeremiah Orians
162df4f378
Enhanced core to simplify implementation
2018-08-16 12:01:55 -04:00
Jeremiah Orians
2e1148fe3e
Release 0.3
2018-08-12 13:11:02 -04:00
Jeremiah Orians
df451c1728
Code Clean up done during knight platform bootstrap work
2018-08-10 17:30:48 -04:00
Jeremiah Orians
eb8b3e4eb4
Reduced Memory usage by another 50%
2018-07-26 19:51:44 -04:00
Jeremiah Orians
7833cd5660
Reduced Memory allocation from 4KB per token string to size of string
...
+ fixed null padding
2018-07-26 18:27:32 -04:00
Jeremiah Orians
929bfa968c
Good Catch Gio
2018-07-25 21:32:45 -04:00
Jeremiah Orians
dc94afb558
Lots of clean and enhancements to simplify task of writing it in assembly.
2018-07-19 22:33:02 -04:00
Jeremiah Orians
64531def3b
Performance enhancement by elimination of string copying
2018-06-28 16:40:51 -04:00
Jeremiah Orians
c454008656
Adding initial support for global initializers
2018-06-26 17:03:17 -04:00
Jeremiah Orians
94a986bf44
Made output even more deterministic
2018-06-08 15:43:36 -04:00
Jeremiah Orians
688b546281
Added debug support for M2-Planet output
2018-06-06 21:37:19 -04:00
Jeremiah Orians
482858ae7c
Added M1-macro test
2018-06-01 22:52:30 -04:00
Jeremiah Orians
dc32e7d4ba
Adding Hex2_linker test
2018-06-01 21:45:48 -04:00
Jeremiah Orians
faed59f88c
Adding blood-elf test
2018-06-01 21:13:45 -04:00
Jeremiah Orians
280b2ade52
bug clean up and new functionality
2018-06-01 20:05:27 -04:00
Jeremiah Orians
cba66b015b
Catching up on enhancements
2018-05-26 16:33:00 -04:00
Jeremiah Orians
847184a0da
Added support for Local functions
2018-05-03 19:07:44 -04:00
Jeremiah Orians
fdbb577784
Added support for passing of function pointers via FUNCTION
2018-05-02 20:56:44 -04:00
Jeremiah Orians
a035d955e9
Add support for anonymous unions inside of structs
2018-04-27 15:57:48 -04:00
Jeremiah Orians
3f9808a19a
Added type promotion to allow progress on mes.c
2018-04-23 21:35:27 -04:00
Jeremiah Orians
589217b3b6
Minor cleanup and removal of unneeded whitespace
2018-03-05 19:13:20 -05:00
Jeremiah Orians
426a92ab09
Finally became self-hosting
2018-02-23 21:18:23 -05:00
Jeremiah Orians
35c9d4036f
Incorporate breaks into loops and reduce library dependencies
2018-01-31 23:14:40 -05:00
Jeremiah Orians
f6752b2802
Added additional functionality such as mixed structs, do while loops,
...
gotos and tests for the new functionality
2018-01-24 20:00:22 -05:00
Jeremiah Orians
9a919d20ea
Minor reordering of tests and the addition of unary - and ! support
2018-01-21 14:42:09 -05:00
Jeremiah Orians
4602adb0b1
Converted from legacy M2-Planet Input.c Output.c to M2-Planet -f input.c ... -f inputN.c -o output.M1
2018-01-20 22:56:50 -05:00
Jeremiah Orians
49c8b5b87d
Converted for.c example into a test
2018-01-20 18:21:20 -05:00
Jeremiah Orians
e1650309c9
Proving M2-Planet can compile real programs with the help of mescc-tools
2018-01-20 17:24:45 -05:00