extracting relocation info from COFF from "section contents" base d on partial_inplace

Ian Lance Taylor ian@wasabisystems.com
Thu Apr 8 18:13:00 GMT 2004


"Liang, James" <jliang@sandia.gov> writes:

> The output of objdump -s and bfd_get_section_contents is just a array of
> bytes.  What I'd like to know is where the Addend and other offset related
> info is stored.

> My problem is that I don't know how to access this information(at least for
> COFF)  Where is this offset info(or "Howto" info) stored?  How can I extract
> this info from the COFF object file?

Given a BFD arelent structure, the address field is the offset within
the section at which the data can be found.  The size of the data is
implied by the relocation type.

Given a COFF reloc structure, the r_vaddr field holds the virtual
address of the data.  You generally have to subtract the section
s_vaddr to get the offset within the section.

Note that the offset info is not the howto info.  The howto tells how
to process the relocation, and it is implied by the reloc type--r_type
in the COFF reloc structure.

Ian



More information about the Binutils mailing list