Default architecture according --target=...configury?

Ian Lance Taylor ian@zembu.com
Wed Aug 18 18:33:00 GMT 1999


   Date: Thu, 19 Aug 1999 11:13:25 +1000
   From: Andrew Cagney <ac131313@cygnus.com>

   > I don't think it should be BFD's place to choose GDB's default target
   > architecture.  BFD is just an object file reader.  GDB should assume
   > an architecture compatible with the executable it is handed, and it
   > should try to get it from the remote target if possible.  If neither
   > is helpful or available, the default should be defined in GDB's
   > configury somewhere.

   When GDB is handed an executable it analyzes it (using BFD) and sets its
   architecture accordingly.  For a remote target it should auto-detect the
   architecture and again, for a few cases, it does that two.

   The problem arises when there is no additional information available. 
   As you suggest, one possibly is for GDB to configure a default arch
   internally.  It just seems strange to me that GAS, BFD and GDB are all
   doing it their own special way.

Well, BFD doesn't really do it at all.  BFD always either has an
object to analyze, or it requires the caller to set the architecture.

gas always needs to know which architecture to generate.  The
processor family (i386, mips, etc.) is fixed by the gas configuration.
The specific processor type is defined by the definition of
TARGET_MACH and by calls to bfd_set_arch_mach in the gas backend.  In
the MIPS case, for example, it uses a complex set of conditions at the
start of md_begin in gas/config/tc-mips.c.  The default is based on
the target configuration triplet.

If you know the processor family, maybe you can get a default
architecture by turning it into a string and calling bfd_scan_arch.

   As an aside, GAS (well opcodes) uses BFD's config.bfd to determine
   architecture information.  GDB has its own special configure.tgt.

Of course, opcodes uses config.bfd to determine which architectures
are available, but it does not use config.bfd to determine which
architecture is the default.  opcodes does not have a default.

The gdb configure.tgt file does not do the same thing as the BFD
config.bfd file.  configure.tgt selects a configuration file from
gdb/config/*.  config.bfd selects a BFD target vector and a BFD
architecture.

Ian


More information about the Gdb mailing list