This is the mail archive of the binutils@sourceware.org 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: Trying to use libbfd to lookup symbol offset in PE/COFF (Windows) library.


> -----Original Message-----
> From: binutils-owner@sourceware.org [mailto:binutils-
> owner@sourceware.org] On Behalf Of Zac Salwasser
> Sent: Thursday, July 22, 2010 11:56
> To: binutils@sourceware.org
> Subject: Trying to use libbfd to lookup symbol offset in PE/COFF (Windows)
> library.
> 
> Hi, I apologize if this should have been obvious to me, but I'd like to use
> libbfd to take a library symbol and get the symbol offset in return, specifically
> using Windows PE/COFF libraries.  I've had a hard time finding any function
> that promises to do this or something similar, but I know that the capability is
> there, because I'm not asking for any information you can't get from
> objdump -x.
> 
> So my first question is, is there a function or function(s) in the libbfd front-
> end that will get me this information?
> 
> My second question, is, assuming the answer is no, I'd like to add a function
> that does this to my local copy of libbfd, using the functionality laid out in
> pe_print_adata() (peXXigen.c:~1362).
> However, I'm having a very hard time adding new functions to libbfd, as the
> headers seem to be automatically generated from the source, but the
> automatic generation script seems to be intent on ignoring any functions I
> add.  I can't figure out how it is specified for the other functions in the library
> to end up in the automatically generated headers.  Can anyone give me a
> hint as to how this is accomplished?
> 
> Thanks for your help.
> -Zac Salwasser



Look for a similar question about "read/write header characteristics of Win32/PE executable".
My estimate, if you simply try to go with plain winapi, you'll get what you want in 3-4 hours and you'll know much more about WinPE.
Bfd is supposed to be a library that should be used for this kind of stuff, but I think it's impossible for anybody with zero knowledge of bfd and winpe to get to do anything with bfd&winpe. I spent like 10 times more time to read bfd code, googling code on the web and reading docs than it took me to learn almost everything about winpe and write all I needed to do myself using straight winapi
 Needless to say, that time I spent dealing with bfd were wasted with no benefit: when I actually needed to make some changes in bfd/binutils (because I needed to fix something in gcc) I'm still at the same position just like anybody else who never knew anything about bfd at all, I'm just scared to touch bfd/binutils




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