Next: , Previous: , Up: Top   [Contents]


2 Porting GCC

Porting GCC requires two things, neither of which has anything to do with GCC. If GCC already supports a processor type, then all the work in porting GCC is really a linker issue. All GCC has to do is produce assembler output in the proper syntax. Most of the work is done by the linker, which is described elsewhere.

Mostly all GCC does is format the command line for the linker pass. The command line for GCC is set in the various config subdirectories of gcc. The options of interest to us are CPP_SPEC and STARTFILE_SPEC. CPP_SPEC sets the builtin defines for your environment. If you support multiple environments with the same processor, then OS specific defines will need to be elsewhere.

STARTFILE_SPEC

Once you have linker support, GCC will be able to produce a fully linked executable image. The only part of GCC that the linker wants is a crt0.o, and a memory map. If you plan on running any programs that do I/O of any kind, you’ll need to write support for the C library, which is described elsewhere.