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:

> I'm writing a port of objcopy that takes COFF as input.  The problem is that
> I can't seem to get all of the relocation
> information I need.  Specifically, I'm missing some info from some imported
> symbols.  The Howto section does not give me
> enough information to relocate, but does give me 'true" flags for pcrel and
> partial_inplace.
> 
> From the info section of BFD, I get that these flags mean they're stored in
> the "section contents", but I have no idea how to extract them.
> How do I get these values?

I'm not sure what the real problem is here.

Relocations generally apply to some part of the object file.  That's
what they do--they relocate information in the object file to some
specific address.  A relocation applies some computation, typically
including the value of some symbol.  When a relocation is marked
partial_inplace, it means that part of the computation includes the
existing data in the object file.  Those are the "section contents"
which you refer to.  It's the data in the section, the data which can
be dumped using objdump -s.

You can read the section contents by calling bfd_get_section_contents.

Hope that helps.  If it doesn't, try to clarify what your real problem
is.

Ian


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