Go to the first, previous, next, last section, table of contents.

Adding a New Configuration

Most of the work in making GDB compile on a new machine is in specifying the configuration of the machine. This is done in a dizzying variety of header files and configuration scripts, which we hope to make more sensible soon. Let's say your new host is called an xxx (e.g. `sun4'), and its full three-part configuration name is xarch-xvend-xos (e.g. `sparc-sun-sunos4'). In particular:

In the top level directory, edit `config.sub' and add xarch, xvend, and xos to the lists of supported architectures, vendors, and operating systems near the bottom of the file. Also, add xxx as an alias that maps to xarch-xvend-xos. You can test your changes by running

./config.sub xxx

and

./config.sub xarch-xvend-xos

which should both respond with xarch-xvend-xos and no error messages.

Now, go to the `bfd' directory and create a new file `bfd/hosts/h-xxx.h'. Examine the other `h-*.h' files as templates, and create one that brings in the right include files for your system, and defines any host-specific macros needed by BFD, the Binutils, GNU LD, or the Opcodes directories. (They all share the bfd `hosts' directory and the `configure.host' file.)

Then edit `bfd/configure.host'. Add a line to recognize your xarch-xvend-xos configuration, and set my_host to xxx when you recognize it. This will cause your file `h-xxx.h' to be linked to `sysdep.h' at configuration time. When creating the line that recognizes your configuration, only match the fields that you really need to match; e.g. don't match the architecture or manufacturer if the OS is sufficient to distinguish the configuration that your `h-xxx.h' file supports. Don't match the manufacturer name unless you really need to. This should make future ports easier.

Also, if this host requires any changes to the Makefile, create a file `bfd/config/xxx.mh', which includes the required lines.

It's possible that the `libiberty' and `readline' directories won't need any changes for your configuration, but if they do, you can change the `configure.in' file there to recognize your system and map to an `mh-xxx' file. Then add `mh-xxx' to the `config/' subdirectory, to set any makefile variables you need. The only current options in there are things like `-DSYSV'. (This `mh-xxx' naming convention differs from elsewhere in GDB, by historical accident. It should be cleaned up so that all such files are called `xxx.mh'.)

Aha! Now to configure GDB itself! Edit `gdb/configure.in' to recognize your system and set gdb_host to xxx, and (unless your desired target is already available) also set gdb_target to something appropriate (for instance, xxx). To handle new hosts, modify the segment after the comment `# per-host'; to handle new targets, modify after `# per-target'.

Finally, you'll need to specify and define GDB's host-, native-, and target-dependent `.h' and `.c' files used for your configuration; the next two chapters discuss those.


Go to the first, previous, next, last section, table of contents.