[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1 Architectures

BFD’s idea of an architecture is implimented in archures.c. BFD keeps one atom in a BFD describing the architecture of the data attached to the BFD; a pointer to a bfd_arch_info_type. Pointers to structures can be requested independently of a bfd so that an architecture’s information can be interrogated without access to an open bfd. The arch information is provided by each architecture package. The set of default architectures is selected by the #define SELECT_ARCHITECTURES. This is normally set up in the config\/h\- file of your choice. If the name is not defined, then all the architectures supported are included. When BFD starts up, all the architectures are called with an initialize method. It is up to the architecture back end to insert as many items into the list of arches as it wants to, generally this would be one for each machine and one for the default case (an item with a machine field of 0).


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1 bfd_architecture


Description
This enum gives the object file’s CPU architecture, in a global sense. E.g. what processor family does it belong to? There is another field, which indicates what processor within the family is in use. The machine gives a number which distingushes different versions of the architecture, containing for example 2 and 3 for Intel i960 KA and i960 KB, and 68020 and 68030 for Motorola 68020 and 68030.

enum bfd_architecture 
{
  bfd_arch_unknown,    /* File arch not known */
  bfd_arch_obscure,    /* Arch known, not one of these */
  bfd_arch_m68k,       /* Motorola 68xxx */
  bfd_arch_vax,        /* DEC Vax */   
  bfd_arch_i960,       /* Intel 960 */
     /* The order of the following is important.
       lower number indicates a machine type that 
       only accepts a subset of the instructions
       available to machines with higher numbers.
       The exception is the "ca", which is
       incompatible with all other machines except 
       "core". */

#define bfd_mach_i960_core      1
#define bfd_mach_i960_ka_sa     2
#define bfd_mach_i960_kb_sb     3
#define bfd_mach_i960_mc        4
#define bfd_mach_i960_xa        5
#define bfd_mach_i960_ca        6

  bfd_arch_a29k,       /* AMD 29000 */
  bfd_arch_sparc,      /* SPARC */
  bfd_arch_mips,       /* MIPS Rxxxx */
  bfd_arch_i386,       /* Intel 386 */
  bfd_arch_ns32k,      /* National Semiconductor 32xxx */
  bfd_arch_tahoe,      /* CCI/Harris Tahoe */
  bfd_arch_i860,       /* Intel 860 */
  bfd_arch_romp,       /* IBM ROMP PC/RT */
  bfd_arch_alliant,    /* Alliant */
  bfd_arch_convex,     /* Convex */
  bfd_arch_m88k,       /* Motorola 88xxx */
  bfd_arch_pyramid,    /* Pyramid Technology */
  bfd_arch_h8300,      /* Hitachi H8/300 */
  bfd_arch_rs6000,     /* IBM RS/6000 */
  bfd_arch_last
  };


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2 bfd_arch_info


Description
This structure contains information on architectures for use within BFD.

typedef int bfd_reloc_code_type;

typedef struct bfd_arch_info 
{
  int bits_per_word;
  int bits_per_address;
  int bits_per_byte;
  enum bfd_architecture arch;
  long mach;
  char *arch_name;
  CONST  char *printable_name;
  /* true if this is the default machine for the architecture */
 unsigned int section_align_power;
  boolean the_default;	
  CONST struct bfd_arch_info * EXFUN((*compatible),
	(CONST struct bfd_arch_info *a,
	 CONST struct bfd_arch_info *b));

  boolean EXFUN((*scan),(CONST struct bfd_arch_info *,CONST char *));
  unsigned int EXFUN((*disassemble),(bfd_vma addr, CONST char *data,
				     PTR stream));
  CONST struct reloc_howto_struct *EXFUN((*reloc_type_lookup),
    (CONST struct bfd_arch_info *,
    bfd_reloc_code_type  code));

  struct bfd_arch_info *next;

} bfd_arch_info_type;


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.1 bfd_printable_name

Synopsis

CONST char *bfd_printable_name(bfd *abfd);

Description
Return a printable string representing the architecture and machine from the pointer to the arch info structure


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.2 bfd_scan_arch

Synopsis

bfd_arch_info_type *bfd_scan_arch(CONST char *);

Description
This routine is provided with a string and tries to work out if bfd supports any cpu which could be described with the name provided. The routine returns a pointer to an arch_info structure if a machine is found, otherwise NULL.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.3 bfd_arch_get_compatible

Synopsis

CONST bfd_arch_info_type *bfd_arch_get_compatible(
    CONST bfd *abfd,
    CONST bfd *bbfd);

Description
This routine is used to determine whether two BFDs’ architectures and achine types are compatible. It calculates the lowest common denominator between the two architectures and machine types implied by the BFDs and returns a pointer to an arch_info structure describing the compatible machine.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.4 bfd_default_arch_struct

Description
The bfd_default_arch_struct is an item of bfd_arch_info_type which has been initialized to a fairly generic state. A BFD starts life by pointing to this structure, until the correct back end has determined the real architecture of the file.

extern bfd_arch_info_type bfd_default_arch_struct;


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.5 bfd_set_arch_info

Synopsis

void bfd_set_arch_info(bfd *, bfd_arch_info_type *);

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.6 bfd_default_set_arch_mach

Synopsis

boolean bfd_default_set_arch_mach(bfd *abfd,
    enum bfd_architecture arch,
    unsigned long mach);

Description
Set the architecture and machine type in a bfd. This finds the correct pointer to structure and inserts it into the arch_info pointer.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.7 bfd_get_arch

Synopsis

enum bfd_architecture bfd_get_arch(bfd *abfd);

Description
Returns the enumerated type which describes the supplied bfd’s architecture


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.8 bfd_get_mach

Synopsis

unsigned long bfd_get_mach(bfd *abfd);

Description
Returns the long type which describes the supplied bfd’s machine


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.9 bfd_arch_bits_per_byte

Synopsis

unsigned int bfd_arch_bits_per_byte(bfd *abfd);

Description
Returns the number of bits in one of the architectures bytes


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.10 bfd_arch_bits_per_address

Synopsis

unsigned int bfd_arch_bits_per_address(bfd *abfd);

Description
Returns the number of bits in one of the architectures addresses


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.11 bfd_arch_init

Synopsis

void  bfd_arch_init(void);

Description
This routine initializes the architecture dispatch table by calling all installed architecture packages and getting them to poke around.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.12 bfd_arch_linkin

Synopsis

void bfd_arch_linkin(bfd_arch_info_type *);

Description
Link the provided arch info structure into the list


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.13 bfd_default_compatible

Synopsis

CONST bfd_arch_info_type *bfd_default_compatible
   (CONST bfd_arch_info_type *a,
    CONST bfd_arch_info_type *b);

Description
The default function for testing for compatibility.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.14 bfd_default_scan

Synopsis

boolean bfd_default_scan(CONST struct bfd_arch_info *, CONST char *);

Description
The default function for working out whether this is an architecture hit and a machine hit.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.15 bfd_get_arch_info

Synopsis

bfd_arch_info_type * bfd_get_arch_info(bfd *);

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.16 bfd_lookup_arch

Synopsis

bfd_arch_info_type *bfd_lookup_arch
   (enum bfd_architecture
    arch,
    long machine);

Description
Look for the architecure info struct which matches the arguments given. A machine of 0 will match the machine/architecture structure which marks itself as the default.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.17 bfd_printable_arch_mach

Synopsis

CONST char * bfd_printable_arch_mach
   (enum bfd_architecture arch, unsigned long machine);

Description
Return a printable string representing the architecture and machine type. NB. The use of this routine is depreciated.


[Top] [Contents] [Index] [ ? ]

About This Document

This document was generated on December 11, 2024 using texi2html 5.0.

The buttons in the navigation panels have the following meaning:

Button Name Go to From 1.2.3 go to
[ << ] FastBack Beginning of this chapter or previous chapter 1
[ < ] Back Previous section in reading order 1.2.2
[ Up ] Up Up section 1.2
[ > ] Forward Next section in reading order 1.2.4
[ >> ] FastForward Next chapter 2
[Top] Top Cover (top) of document  
[Contents] Contents Table of contents  
[Index] Index Index  
[ ? ] About About (help)  

where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:


This document was generated on December 11, 2024 using texi2html 5.0.