<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 12/28/15 9:50 AM, Christian Convey
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAPfS4ZyP31mYb4VVJP_p2PG0kHc453s0zwito6O5PFOy-63FHQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div><br>
            </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000"><span class="">
                  <div>On 12/22/15 4:45 AM, Russell Wallace via llvm-dev
                    wrote:<br>
                  </div>
                  <blockquote type="cite">
                    <div dir="ltr">Oh, I just came across
                      Function::hasAddressTaken. Maybe I can just use
                      that instead?<br>
                    </div>
                  </blockquote>
                  <br>
                </span> You could conservatively assume that any
                function that has its address taken has a pointer to it
                that escapes into memory or external code.</div>
            </blockquote>
            <div>
              <div><br>
              </div>
              <div>I wonder if a conservative estimate of pointed-to
                functions would also need to include all functions with
                externally visible linkage? <br>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    This is correct.  Any function that is externally visible can be
    called be external code that is outside the analysis's scope; you
    must therefore treat it is a function that can be called by external
    code (in LLVM CallGraph parlance, it can be called by the external
    calling node).<br>
    <br>
    If you're going to do this analysis, you want to do it in libLTO
    after the Internalize pass has been run.  The Internalize pass finds
    functions which are externally visible (because C linkage needs them
    to be in order for linking to work) and makes them internal since we
    know that we will not link with any more LLVM bitcode files.  You
    should get much better results that way.<br>
    <br>
    As an FYI, DSA tracks this sort of information using the External
    (E) flag on the DSNode.   It can determine (provided it has
    sufficient precision) which heap objects are accessible to external
    code and which are not.<br>
    <br>
    Regards,<br>
    <br>
    John Criswell<br>
    <br>
    <blockquote
cite="mid:CAPfS4ZyP31mYb4VVJP_p2PG0kHc453s0zwito6O5PFOy-63FHQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div><br>
            </div>
            <div>I could imagine a few routes by which that allows such
              a function to have its address show up in the data being
              handled by the Module's own code.</div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
<a class="moz-txt-link-freetext" href="http://www.cs.rochester.edu/u/criswell">http://www.cs.rochester.edu/u/criswell</a></pre>
  </body>
</html>