From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Lance Taylor To: ac131313@cygnus.com Cc: shebs@cygnus.com, binutils@sourceware.cygnus.com, gdb@sourceware.cygnus.com Subject: Re: Default architecture according --target=...configury? Date: Wed, 18 Aug 1999 18:33:00 -0000 Message-id: <19990819013244.11118.qmail@daffy.airs.com> References: <199908190027.RAA25601@andros.cygnus.com> <37BB5A35.50A1F9C2@cygnus.com> X-SW-Source: 1999-08/msg00112.html Date: Thu, 19 Aug 1999 11:13:25 +1000 From: Andrew Cagney > 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