This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
How can I get info on the UNDEF section or the imports sectionof an object file from BFD?
- From: "Liang, James" <jliang at sandia dot gov>
- To: "'binutils at sources dot redhat dot com'" <binutils at sources dot redhat dot com>
- Date: Thu, 8 Apr 2004 13:00:07 -0600
- Subject: How can I get info on the UNDEF section or the imports sectionof an object file from BFD?
Does anyone know how I can get info on the UNDEF section or the imports
section of an object file from BFD?
Consider that I have a snippet:
extern struct someStruct externData;
void function() {
printf("%d\n",externData.accessCounter);
}
This basically compiles to:
push [externData+8]
push "%d\n"
call printf
Where the push instruction is just a "ff 35 6c 00 00 00"
By looking at it through IDA Pro, I can easily see that the 6c byte is there
because it put externData in a section called UNDEF, that holds all of the
imported symbols, at offset 64. Thus it simply added the offset of +8 to
the 64 where the externData resides and got 6c.
I would like to be able to read info about the UNDEF section using BFD so
that I can see that externData is at offset 64, see the ff 35 6c, and use it
to calculate the "externData +8". The problem is that I can't seem to
figure out how to get info about the imports section using the BFD
libraries. Without this info, I can't figure out how to fixup the extern.
I tried getting this info from objdump, but can't quite seem to get it to
give that either.
Where is this info stored? How can I access it?
James