This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: extracting relocation info from COFF from "section contents" base d on partial_inplace
- From: Ian Lance Taylor <ian at wasabisystems dot com>
- To: "Liang, James" <jliang at sandia dot gov>
- Cc: "'binutils at sources dot redhat dot com'" <binutils at sources dot redhat dot com>
- Date: 08 Apr 2004 14:13:30 -0400
- Subject: Re: extracting relocation info from COFF from "section contents" base d on partial_inplace
- References: <71251C7D5FB1D2119C8F0008C7A44ED10379265F@es07snlnt.sandia.gov>
"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