[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4. Porting GAS

Each GAS target specifies two main things: the CPU file and the object format file. Two main switches in the `configure.in' file handle this. The first switches on CPU type to set the shell variable cpu_type. The second switches on the entire target to set the shell variable fmt.

The configure script uses the value of cpu_type to select two files in the `config' directory: `tc-CPU.c' and `tc-CPU.h'. The configuration process will create a file named `targ-cpu.h' in the build directory which includes `tc-CPU.h'.

The configure script also uses the value of fmt to select two files: `obj-fmt.c' and `obj-fmt.h'. The configuration process will create a file named `obj-format.h' in the build directory which includes `obj-fmt.h'.

You can also set the emulation in the configure script by setting the em variable. Normally the default value of `generic' is fine. The configuration process will create a file named `targ-env.h' in the build directory which includes `te-em.h'.

There is a special case for COFF. For historical reason, the GNU COFF assembler doesn't follow the documented behavior on certain debug symbols for the compatibility with other COFF assemblers. A port can define STRICTCOFF in the configure script to make the GNU COFF assembler to follow the documented behavior.

Porting GAS to a new CPU requires writing the `tc-CPU' files. Porting GAS to a new object file format requires writing the `obj-fmt' files. There is sometimes some interaction between these two files, but it is normally minimal.

The best approach is, of course, to copy existing files. The documentation below assumes that you are looking at existing files to see usage details.

These interfaces have grown over time, and have never been carefully thought out or designed. Nothing about the interfaces described here is cast in stone. It is possible that they will change from one version of the assembler to the next. Also, new macros are added all the time as they are needed.

4.1 Writing a CPU backend  
4.2 Writing an object format backend  
4.3 Writing emulation files  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by system on December, 2 2004 using texi2html