<div dir="ltr"><div><div>Hi John,<br>Thanks for your answer. <br></div><br>The CallGraph pass did the work for me. But since I actually have several modules and my toolchain looked like <br><br></div>llvm-link<br><div><div><CallGraph extraction pass><br>opt<br>llc<br><br> I've found that llvm-lto is great for doing all the work: greedy linkage, optimization and further MC generation. <br>Here the command line I'm using for that:<br>llvm-lto -exported-symbol=main -save-merged-module -filetype=asm <or obj> -o %t2 %t1<br>(I've attached corresponding llvm-lit test.)<br><br></div><div>Now I'm wondering if there is any possibility to use LTO within the linker like ld (mingw) to build a dynamic library from my IR code?<br></div><div><br></div><div>Best regards,<br></div><div>Alexey Zasenko<br></div><div><br></div><div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-10-28 16:33 GMT+03:00 John Criswell <span dir="ltr"><<a href="mailto:jtcriswel@gmail.com" target="_blank">jtcriswel@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><span class="">
    <div class="m_-7698986923138529790moz-cite-prefix">On 10/27/16 11:18 AM, Aliaksei Zasenka
      via llvm-dev wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div>
          <div>
            <div>Hi all,<br>
            </div>
            Can anyone give me advice about an appropriate way for
            extracting number of functions from module recursively
            (starting from entry point). Actually it may be more than
            one entry point so all dependent functions and global values
            must be extracted. <br>
            <br>
            I've tried llvm-extract tool but it can't do work
            recursively. Maybe it would be good to write some Call Graph
            pass or something. Any thoughts?<br>
          </div>
        </div>
      </div>
    </blockquote>
    <br></span>
    I thought llvm-extract conservatively extracted anything that was
    relevant to what it was asked to extract.<br>
    <br>
    In any event, if you need a call graph analysis, there are two call
    graph passes available for LLVM.<br>
    <br>
    The first is the CallGraph pass that comes in the LLVM source tree. 
    It is very conservative with function pointers, but its results are
    conservatively correct.<br>
    <br>
    The second is the CallGraph analysis within DSA.  You should be able
    to find a copy for LLVM 3.7 or LLVM 3.8 here
    (<a class="m_-7698986923138529790moz-txt-link-freetext" href="https://github.com/jtcriswell/safecode-llvm37" target="_blank">https://github.com/<wbr>jtcriswell/safecode-llvm37</a>) and here
    (<a class="m_-7698986923138529790moz-txt-link-freetext" href="https://github.com/jtcriswell/llvm-dsa" target="_blank">https://github.com/<wbr>jtcriswell/llvm-dsa</a>).<br>
    <br>
    Regards,<br>
    <br>
    John Criswell<br>
    <blockquote type="cite"><span class="">
      <div dir="ltr">
        <div>
          <div><br>
          </div>
          <div><br>
          </div>
          Thanks in advance,<br>
        </div>
        Alexey Zasenko<br>
      </div>
      <br>
      <fieldset class="m_-7698986923138529790mimeAttachmentHeader"></fieldset>
      <br>
      </span><pre>______________________________<wbr>_________________
LLVM Developers mailing list
<a class="m_-7698986923138529790moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>
<a class="m_-7698986923138529790moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><span class="HOEnZb"><font color="#888888">
</font></span></pre><span class="HOEnZb"><font color="#888888">
    </font></span></blockquote><span class="HOEnZb"><font color="#888888">
    <br>
    <p><br>
    </p>
    <pre class="m_-7698986923138529790moz-signature" cols="72">-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
<a class="m_-7698986923138529790moz-txt-link-freetext" href="http://www.cs.rochester.edu/u/criswell" target="_blank">http://www.cs.rochester.edu/u/<wbr>criswell</a></pre>
  </font></span></div>

</blockquote></div><br></div>