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

Alexey Samsonov vonosmas at gmail.com
Tue Jul 22 16:31:58 PDT 2014


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 <https://github.com/mono/CppSharp>
> 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/5c64d671/attachment.html>


More information about the llvm-dev mailing list