[LLVMdev] How to get the symbols from a .so file?

Dimitar Dobrev dpldobrev at yahoo.com
Tue Jul 22 17:05:55 PDT 2014


    Hello Alexey,

    I did so a little after sending the e-mail (the tip is good nevertheless). I copied the relevant path in code and it worked fine. Thank you for your reply.



On Tuesday, July 22, 2014 11:31 PM, Alexey Samsonov <vonosmas at gmail.com> wrote:
 


Hi Dimitar,

This is pretty weird that createObjectFile() doesn't work. What errors do you observe? You may take a look at a various LLVM commandline tools that walk the symbol table of the file for inspiration.
See tools/llvm-nm/llvm-nm.cpp for example. (it uses createBinary()) function.



On Tue, Jul 22, 2014 at 11:09 AM, Dimitar Dobrev <dpldobrev at yahoo.com> wrote:


>    Hello all,
>
>    I develop a project based on Clang where I need to read all symbols from a library. For symbols libraries (.a/.lib) I use the following code:
>
>    auto &FM = C->getFileManager();
>    ...
>    auto Buffer = FM.getBufferForFile(FileEntry);
>    ...
>    auto Object = llvm::object::ObjectFile::createObjectFile(Buffer);
>
>    This code crashes at the last line if the file in question is a shared object (.so).
 Apparently I need to use different code to parse a shared object but I have little idea what. Any help will be appreciated.
>
>    Thank you for your time,
>    Dimitar Dobrev
>
>
>_______________________________________________
>LLVM Developers mailing list
>LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>


-- 

Alexey Samsonov
vonosmas at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140722/0dd1fbfe/attachment.html>


More information about the llvm-dev mailing list