@j.p.s thank you for the response! I'll wait it out and then merge this post with the top post when the time comes.
Release 1.1 is here with three improvements. It can even compile its own code to make a tcc which will then successfully compile programs, but that's far from needed for most use cases, just a nice anecdote.
1. tccmake no longer mounts and unmounts libraries.
2. Command line arguments now work with programs compiled by tcc. int main(int argc, const char * argv[]) are sent to main properly.
3. tcc -run works now
Details:
Spoiler:
1. tccmake was simplified. There's now the two needed linker defined libs, libc & libpthread, directly placed in the tcc directory instead of mounted to /usr/lib. They're also not going to be unmounted each time, since they've not been mounted. The tcc include path by default will look in its own directory for these two files which point to the real libraries. You can see the loading by invoking with ./tcc -vvv in your build.
2.The crt1.o I used from the prior package incorrectly addressed for the argc and argv parameters before calling main. I used gdb at _start to find them. Noticed they're passed into _start in r1 and r2, so just made a little edit to store them off in other registers and then use the arm calling convention to move them into the proper registers immediately before calling main.I left the rest of the init code untouched, which seems to address handling the stack pointer and incorrectly finding argc and argv.
3. Added arm-runmain.o to the tcc directory, so the tcc -run command will work. Have a try:
From SSH or command line in kterm:
Code:
echo -e '#include <stdio.h> \n void main(){ puts("Hey there!\\n");}' | tcc -run -
Yes, please keep the last dash without any character following it. That's to tell tcc to read off of stdin. Also unsure if there's any utility for this, but it's neat to me and now it works.