This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


"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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]