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).
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.
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.
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*".