* Default architecture according --target=...configury? @ 1999-08-18 2:06 Andrew Cagney 1999-08-18 10:29 ` Ian Lance Taylor 0 siblings, 1 reply; 6+ messages in thread From: Andrew Cagney @ 1999-08-18 2:06 UTC (permalink / raw) To: binutils; +Cc: gdb Hello, Is it possible to reliably determine the default architecture (struct bfd_arch_info) as selected by the configuration option --target=.... (even when --enable-targets was specified)? I suspect not but would like to double check. My guess at the change required is for archures.c: static const bfd_arch_info_type * const bfd_archures_list[] = { #ifdef SELECT_ARCHITECTURES SELECT_ARCHITECTURES, #else &bfd_a29k_arch, to be modified to be more like targets.c vs: const bfd_target * const bfd_target_vector[] = { #ifdef SELECT_VECS SELECT_VECS, #else /* not SELECT_VECS */ #ifdef DEFAULT_VECTOR &DEFAULT_VECTOR, #endif (Add DEFAULT_ARCHITECTURE_VECTOR say). The function bfd_lookup_arch() could then be modified to detect a user asking for a default architecture (arch == 0 (bfd_arch_unknown)?). Comments? Andrew PS: Why? I'd like GDB to make a better guess at a default architecture. bfd_default_arch_struct just isn't very interesting. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Default architecture according --target=...configury? 1999-08-18 2:06 Default architecture according --target=...configury? Andrew Cagney @ 1999-08-18 10:29 ` Ian Lance Taylor 1999-08-18 17:14 ` Andrew Cagney 0 siblings, 1 reply; 6+ messages in thread From: Ian Lance Taylor @ 1999-08-18 10:29 UTC (permalink / raw) To: ac131313; +Cc: binutils, gdb Date: Wed, 18 Aug 1999 19:05:43 +1000 From: Andrew Cagney <ac131313@cygnus.com> Is it possible to reliably determine the default architecture (struct bfd_arch_info) as selected by the configuration option --target=.... (even when --enable-targets was specified)? Well, speaking precisely, there is no default architecture. There is a default BFD target, and if an object file is recognized using that format running bfd_check_format will set the architecture appropriately. For example, if the default BFD target is elf32-bigmips, BFD can recognize a file using any of the 16 architectures listed in bfd/cpu-mips.c. So it really depends upon what you mean by the default architecture. For example, if you configure gas for mips4111-elf, then gas will by default generate object files which use the mips4111 architecture. PS: Why? I'd like GDB to make a better guess at a default architecture. bfd_default_arch_struct just isn't very interesting. If you explain further what you mean by this, perhaps we can think of some way to make it work for you. When does gdb want to know the default architecture? What is it going to do with the information? Ian ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Default architecture according --target=...configury? 1999-08-18 10:29 ` Ian Lance Taylor @ 1999-08-18 17:14 ` Andrew Cagney 1999-08-18 17:27 ` Stan Shebs 0 siblings, 1 reply; 6+ messages in thread From: Andrew Cagney @ 1999-08-18 17:14 UTC (permalink / raw) To: Ian Lance Taylor; +Cc: binutils, gdb Ian Lance Taylor wrote: > So it really depends upon what you mean by the default architecture. > For example, if you configure gas for mips4111-elf, then gas will by > default generate object files which use the mips4111 architecture. I'll look at what that does. > PS: Why? I'd like GDB to make a better guess at a default > architecture. bfd_default_arch_struct just isn't very interesting. > > If you explain further what you mean by this, perhaps we can think of > some way to make it work for you. When does gdb want to know the > default architecture? What is it going to do with the information? Consider a GDB which has been built to support several different ISA's (a mips4111, mips4300, ...). What architecture should GDB select by default when it goes to talk to a remote target? Andrew ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Default architecture according --target=...configury? 1999-08-18 17:14 ` Andrew Cagney @ 1999-08-18 17:27 ` Stan Shebs 1999-08-18 18:15 ` Andrew Cagney 0 siblings, 1 reply; 6+ messages in thread From: Stan Shebs @ 1999-08-18 17:27 UTC (permalink / raw) To: cagney; +Cc: ian, binutils, gdb Date: Thu, 19 Aug 1999 10:12:31 +1000 From: Andrew Cagney <ac131313@cygnus.com> > PS: Why? I'd like GDB to make a better guess at a default > architecture. bfd_default_arch_struct just isn't very interesting. > > If you explain further what you mean by this, perhaps we can think of > some way to make it work for you. When does gdb want to know the > default architecture? What is it going to do with the information? Consider a GDB which has been built to support several different ISA's (a mips4111, mips4300, ...). What architecture should GDB select by default when it goes to talk to a remote target? 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. Stan ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Default architecture according --target=...configury? 1999-08-18 17:27 ` Stan Shebs @ 1999-08-18 18:15 ` Andrew Cagney 1999-08-18 18:33 ` Ian Lance Taylor 0 siblings, 1 reply; 6+ messages in thread From: Andrew Cagney @ 1999-08-18 18:15 UTC (permalink / raw) To: Stan Shebs; +Cc: ian, binutils, gdb Stan Shebs wrote: > > Date: Thu, 19 Aug 1999 10:12:31 +1000 > From: Andrew Cagney <ac131313@cygnus.com> > > > PS: Why? I'd like GDB to make a better guess at a default > > architecture. bfd_default_arch_struct just isn't very interesting. > > > > If you explain further what you mean by this, perhaps we can think of > > some way to make it work for you. When does gdb want to know the > > default architecture? What is it going to do with the information? > > Consider a GDB which has been built to support several different ISA's > (a mips4111, mips4300, ...). What architecture should GDB select by > default when it goes to talk to a remote target? > > 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. As an aside, GAS (well opcodes) uses BFD's config.bfd to determine architecture information. GDB has its own special configure.tgt. enjoy, Andrew ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Default architecture according --target=...configury? 1999-08-18 18:15 ` Andrew Cagney @ 1999-08-18 18:33 ` Ian Lance Taylor 0 siblings, 0 replies; 6+ messages in thread From: Ian Lance Taylor @ 1999-08-18 18:33 UTC (permalink / raw) To: ac131313; +Cc: shebs, binutils, gdb 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~1999-08-18 18:33 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 1999-08-18 2:06 Default architecture according --target=...configury? Andrew Cagney 1999-08-18 10:29 ` Ian Lance Taylor 1999-08-18 17:14 ` Andrew Cagney 1999-08-18 17:27 ` Stan Shebs 1999-08-18 18:15 ` Andrew Cagney 1999-08-18 18:33 ` Ian Lance Taylor
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).