Next: Host Prev: New Architectures Up: Top

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

     ./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.

automatically generated by info2www