XTC68 C Cross compiler
Posted: Tue Oct 30, 2018 11:46 am
I came across this when I was looking at something else, and fell down the rabbit hole!
The following applies to compiling etc on a Linux 64bit but with the correct packages installed to allow 32 bit code to be compiled and executed.
I've forked the compiler sources from the SinclairQL original at https://github.com/SinclairQL/xtc68 and compiled it. Even with a simple text file:
I get a complete failure to run the as68 phase due to a perceived 'stack overflow exploit' attempt:
I suspect that there might be a bug in the as68 code that's giving this impression. There are certainly a lot of warnings when compiling most of the code in all the utilities. I might have to work through them to see if I can get rid and then I might be able to see the wood for the trees. The generated code from the above C source is:
This doesn't look too bad to me, hence my suspicion that it's internal to as68 itself. If I comment out the two lines at label I_3, so that it effectively does nothing, it will assemble.
Q1. Has anyone attempted to use this compiler? Successfully? It could be I've compiled with the wrong options - instructions are few and far between. Google, in this case, is of little help either.
Q2. I'm not seeing any libraries in this installation, so I suspect the linker (qld) will not work either, leading to a complete lack of executable files?
Thanks.
Cheers,
Norm.
The following applies to compiling etc on a Linux 64bit but with the correct packages installed to allow 32 bit code to be compiled and executed.
I've forked the compiler sources from the SinclairQL original at https://github.com/SinclairQL/xtc68 and compiled it. Even with a simple text file:
Code: Select all
#include <INCLUDE_stdio.h>
int main(int argc, char *argv[]) {
printf("\n\nHello World!\n\n");
return 0;
}
Code: Select all
qcc -o test test.c -I ../support
*** stack smashing detected ***: as68 terminated
Aborted
Code: Select all
! Generated by c68 4.5 27 Feb 99 (Oct 30 2018) from "test.i"
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
I_1:
.data1 0xa,0xa
.ascii "Hello World!"
.data1 0xa,0xa,0x0
.align 2
.extern _main
_main:
bra I_2
I_3:
pea I_1
jsr _printf
move.l #0,d0
I_4:
unlk a6
rts
I_2:
link a6,#0
bra I_3
Q1. Has anyone attempted to use this compiler? Successfully? It could be I've compiled with the wrong options - instructions are few and far between. Google, in this case, is of little help either.
Q2. I'm not seeing any libraries in this installation, so I suspect the linker (qld) will not work either, leading to a complete lack of executable files?
Thanks.
Cheers,
Norm.