I'm now working on retargeting C compiler. I can say, it is not easy job for me. I tried read something about LCC but LCC seem a bit hard to retarget, not so hard as GCC, but for example vbcc can be retarget more easily. So I started writing backend for vbcc.
I'm almost done and things like branching, arithmetic are working well, also global and static variables. But I got stuck at stack related parts, this mean calls to others functions, arguments passing, local variables and so on.
If somebody can share link where I can find information about how C Compilers are using stack I will be glad.
Also, it is not clear to me, how to deal with libraries. Have I write my own libraries to be ANSI C compatible? Or is OK to write just backend for vbcc and say "let there be an compiler"? For now I don't want any operating system for my CPU so I suppose, it should be OK to write just backend.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.