How do I go about porting gcc to a new architecture? I am specifically interested in the following architectures:
- ARM (TI OMAPs)
- TI MSP430
- x86
but guidance on how to port to any architecture would go some way to solving my problem.
How do I go about porting gcc to a new architecture? I am specifically interested in the following architectures:
but guidance on how to port to any architecture would go some way to solving my problem.
In all likelihood GCC is already available for the architecture you want, in which case you want GCC as a cross-compiler (f.e. on a x86 machine with Windows, use gcc to cross-compile for ARM chips). You can see the targets for gcc here.
Note that in all likelihood you will need to compile GCC yourself with that target.
BTW, what is your target architecture?
Learning to port gcc is going to be a significantly non-trivial task. As a rough guide of what to expect, you will need to know:
In order to start the process, you would typically start with the C-to-assembly translation on your host architecture, such that you could compile something for the target architecture (but on your host). You would then get to the stage where you can compile a compiler for your target architecture on your host. At this stage, you produce a compiler on the target which can then self-compile, so you now have gcc on the target.
Once this work has been done, actually porting gcc is simply a case of building gcc from the host on the target. If that's all you're interested in, Linux from scratch is a very good guide for doing everything you'll need to do (as gcc would, amongst other things, be a prerequisite for porting the kernel).