Sunday, May 27, 2007

gcc as a cross-compiler

I've been following the steps outlined on Patrice Mandin's site to set up a cross-compiling version of gcc-3.3.3 that will produce outputs for the m68k-atari-mint target. I'm not running MiNT, but this seems to be the closest thing to building an Atari TOS compatible binary.
What I don't understand is the amount of work necessary to do so. I first have to compile an oldish binutils with a native x86 linux target, then start using that binutils to build the same version of binutils, this time for the 68k Atari target... then build the entire gcc-3.3.3 for x86, and then again for 68k. Jesus.

I thought the whole idea of a modular compiler design was that it wouldn't cost too much to implement a new target machine - just a separate backend that can be plugged into your existing compiler, that accepts intermediate representation code from the frontend and produces assembly specific to the target machine which it can assemble and link.

So why do I have to recompile binutils and the entire gcc twice each? This doesn't seem right.
But then, I don't know much at all about gcc - perhaps there are other, much easier ways of accomplishing the same goal.
Please comment if you know anything about adding new backends to gcc!

No comments:

Post a Comment