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

6.3 BFD relocation codes

BFD has another way of describing relocations besides the howto structures described above: the enum `bfd_reloc_code_real_type'.

Every known relocation type can be described as a value in this enumeration. The enumeration contains many target specific relocations, but where two or more targets have the same relocation, a single code is used. For example, the single value `BFD_RELOC_32' is used for all simple 32 bit relocation types.

The main purpose of this relocation code is to give the assembler some mechanism to create `arelent' structures. In order for the assembler to create an `arelent' structure, it has to be able to obtain a howto structure. The function `bfd_reloc_type_lookup', which simply calls the target vector entry point `reloc_type_lookup', takes a relocation code and returns a howto structure.

The function `bfd_get_reloc_code_name' returns the name of a relocation code. This is mainly used in error messages.

Using both howto structures and relocation codes can be somewhat confusing. There are many processor specific relocation codes. However, the relocation is only fully defined by the howto structure. The same relocation code will map to different howto structures in different object file formats. For example, the addend handling may be different.

Most of the relocation codes are not really general. The assembler can not use them without already understanding what sorts of relocations can be used for a particular target. It might be possible to replace the relocation codes with something simpler.



This document was generated by system on December, 2 2004 using texi2html