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]

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


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