[prev in list] [next in list] [prev in thread] [next in thread] 

List:       llvm-dev
Subject:    Re: [LLVMdev] How to get the symbols from a .so file?
From:       Dimitar Dobrev <dpldobrev () yahoo ! com>
Date:       2014-07-23 0:05:55
Message-ID: 1406073955.4325.YahooMailNeo () web122404 ! mail ! ne1 ! yahoo ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]



    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@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@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@cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> 
> 


-- 

Alexey Samsonov
vonosmas@gmail.com


[Attachment #5 (text/html)]

<html><body><div style="color:#000; background-color:#fff; \
font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, \
sans-serif;font-size:12pt"><div style="color: rgb(0, 0, 0); font-size: \
16px; font-family: serif; background-color: transparent; font-style: \
normal;"><br><span class="tab">&nbsp;&nbsp;&nbsp; Hello \
Alexey,</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; \
font-family: serif; background-color: transparent; font-style: \
normal;"><span class="tab"><br></span></div><div style="color: rgb(0, 0, \
0); font-size: 16px; font-family: serif; background-color: transparent; \
font-style: normal;"><span class="tab">&nbsp;&nbsp;&nbsp; I did so a little \
after sending the e-mail (the tip is good nevertheless)</span>. I copied \
the relevant path in code and it worked fine. Thank you for your \
reply.<span class="tab"><br></span></div> <div \
class="qtdSeparateBR"><br><br></div><div style="display: block;" \
class="yahoo_quoted"> <div  style="font-family: HelveticaNeue, Helvetica \
Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div \
style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida \
Grande, sans-serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" \
size="2"> On Tuesday, July 22, 2014 11:31 PM, Alexey Samsonov \
&lt;vonosmas@gmail.com&gt; wrote:<br> </font> </div>  <br><br> <div \
class="y_msg_container"><div id="yiv5453233746"><div><div dir="ltr">Hi \
Dimitar,<div><br clear="none"></div><div>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.</div> <div>See tools/llvm-nm/llvm-nm.cpp for example. \
(it uses createBinary()) function.</div></div><div \
class="yiv5453233746gmail_extra"><br clear="none"><br clear="none"><div \
class="yiv5453233746gmail_quote">On Tue, Jul 22, 2014 at 11:09 AM, Dimitar \
Dobrev <span dir="ltr">&lt;<a rel="nofollow" shape="rect" \
ymailto="mailto:dpldobrev@yahoo.com" target="_blank" \
href="mailto:dpldobrev@yahoo.com">dpldobrev@yahoo.com</a>&gt;</span> \
wrote:<br clear="none"> <blockquote class="yiv5453233746gmail_quote" \
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div \
class="yiv5453233746yqt9711864702" id="yiv5453233746yqt39161"><div><div \
style="color:#000;background-color:#fff;font-family:HelveticaNeue, \
Helvetica Neue, Helvetica, Arial, Lucida Grande, \
sans-serif;font-size:12pt;"> <br clear="none">&nbsp;&nbsp;&nbsp; Hello \
all,<br clear="none"><br clear="none">&nbsp;&nbsp;&nbsp; I develop <a \
rel="nofollow" shape="rect" target="_blank" \
href="https://github.com/mono/CppSharp">a project based on Clang</a> where \
I need to read all symbols from a library. For symbols libraries (.a/.lib) \
I use the following code:<br clear="none"> <br \
clear="none">&nbsp;&nbsp;&nbsp; auto &amp;FM = C-&gt;getFileManager();<br \
clear="none">&nbsp;&nbsp;&nbsp; ...<br clear="none">&nbsp;&nbsp;&nbsp; auto \
Buffer = FM.getBufferForFile(FileEntry);<br clear="none">&nbsp;&nbsp;&nbsp; \
...<br clear="none">&nbsp;&nbsp;&nbsp; auto Object = \
llvm::object::ObjectFile::createObjectFile(Buffer);<br clear="none"><br \
clear="none">&nbsp;&nbsp;&nbsp; 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.<br clear="none"><br \
clear="none">&nbsp;&nbsp;&nbsp; Thank you for your time,<br \
clear="none">&nbsp;&nbsp;&nbsp; Dimitar Dobrev<br clear="none"><br \
clear="none"><div><div><div \
style="color:#000;background-color:#fff;font-family:HelveticaNeue, \
Helvetica Neue, Helvetica, Arial, Lucida Grande, \
sans-serif;font-size:12pt;"> <div><div><div \
style="color:#000;background-color:#fff;font-family:HelveticaNeue, \
Helvetica Neue, Helvetica, Arial, Lucida Grande, \
sans-serif;font-size:12pt;"><div></div></div></div></div></div></div></div></div></div></div><br \
clear="none">_______________________________________________<br \
clear="none">

LLVM Developers mailing list<br clear="none">
<a rel="nofollow" shape="rect" ymailto="mailto:LLVMdev@cs.uiuc.edu" \
target="_blank" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> \
&nbsp; &nbsp; &nbsp; &nbsp; <a rel="nofollow" shape="rect" target="_blank" \
href="http://llvm.cs.uiuc.edu/">http://llvm.cs.uiuc.edu</a><br \
clear="none"> <a rel="nofollow" shape="rect" target="_blank" \
href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br \
clear="none"> <br clear="none"></blockquote></div><br clear="none"><br \
clear="all"><div><br clear="none"></div>-- <br clear="none"><div \
dir="ltr">Alexey Samsonov<br clear="none"><a rel="nofollow" shape="rect" \
ymailto="mailto:vonosmas@gmail.com" target="_blank" \
href="mailto:vonosmas@gmail.com">vonosmas@gmail.com</a></div> \
</div></div></div><br><br></div>  </div> </div>  </div> \
</div></body></html>



_______________________________________________
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic