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.


On 22/07/2010 16:56, Zac Salwasser wrote:
> 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?

  See "2.7.1 Reading symbols" in the bfd manual / info page for an example of
using the bfd_canonicalize_symtab call.  This reads the whole symbol table and
you have to scan it manually for the one you're looking for; there isn't AFAIK
a BFD interface to look up a single symbol.  If you're proposing adding such
an API to BFD, that sounds like a pretty reasonable idea to me.

    cheers,
      DaveK
-- 
(*) -
http://sourceware.org/binutils/docs-2.20/bfd/Reading-Symbols.html
(**) -
http://sourceware.org/binutils/docs-2.20/bfd/symbol-handling-functions.html#index-bfd_005fcanonicalize_005fsymtab-64


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