<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 9/8/11 7:57 PM, Kostya Serebryany wrote:
    <blockquote
cite="mid:CAN=P9phTgbv3a2TKKSDGcPNqxBP4VO+B2p+bHN5ikzcU2ZSsEg@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <div class="gmail_quote">
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex;">
          <div class="HOEnZb">
            <div class="h5"><br>
              <br>
            </div>
          </div>
          A couple review comments:<br>
          <br>
          AddressSanitizer::appendToGlobalCtors is messy at best; </blockquote>
        <div><br>
        </div>
        <div>Agree (the code is stolen from some other part of LLVM and
          fixed to actually work).  </div>
        <div><br>
        </div>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex;">
          is there<br>
          really no better way to get the asan init function to run when
          it<br>
          needs to?<br>
        </blockquote>
        <div><br>
        </div>
        <div>I see no other way other than to append
          to llvm.global_ctors.</div>
        <div>Given that I didn't find whether LLVM guaranties the
          particular order of CTOR execution, I have to call them twice,
          at the beginning and at the end of llvm.global_ctors</div>
        <div>Suggestions?</div>
      </div>
    </blockquote>
    <br>
    SAFECode also adds calls in llvm.global_ctors in
    lib/InsertPoolChecks/RegisterRuntimeInitializer.cpp (line 144).  At
    the time I wrote the code, ctor priorities were not honored as
    documented in the Language Reference Manual.  Through
    experimentation, I determined that they were executed in one order
    on Linux and another on Mac OS X, and the code in
    RegisterRuntimeInitializer.cpp uses that information.<br>
    <br>
    That said, I seem to recall seeing a commit recently that may have
    fixed the problem with ctor priority numbers.  Has that, in fact,
    been fixed?  If so, it would be better to rely upon the documented
    priority numbers instead of on undocumented behavior observed in the
    wild.<br>
    :)<br>
    <br>
    -- John T.<br>
    <br>
    <br>
    <blockquote
cite="mid:CAN=P9phTgbv3a2TKKSDGcPNqxBP4VO+B2p+bHN5ikzcU2ZSsEg@mail.gmail.com"
      type="cite">
      <div class="gmail_quote">
        <div> </div>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex;">
          <br>
          Please get rid of blockHasException and the dependent code;
          the<br>
          eh_exception intrinsic is going away very soon, and you
          shouldn't run<br>
          into similar issues with the new exception handling framework.<br>
        </blockquote>
        <div><br>
        </div>
        <div>Done. </div>
        <div><br>
        </div>
        <div> </div>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex;">
          <br>
          +  GlobalValue *asan_mapping_offset =<br>
          +      new GlobalVariable(M, IntPtrTy, true,
          GlobalValue::LinkOnceODRLinkage,<br>
          +                     ConstantInt::get(IntPtrTy, 1ULL <<
          MappingOffsetLog),<br>
          +                     "__asan_mapping_offset");<br>
          +  GlobalValue *asan_mapping_scale =<br>
          +      new GlobalVariable(M, IntPtrTy, true,
          GlobalValue::LinkOnceODRLinkage,<br>
          +                         ConstantInt::get(IntPtrTy,
          MappingScale),<br>
          +                         "__asan_mapping_scale");<br>
          <br>
          If you use WeakLinkage for these, you won't need the fake
          loads.<br>
        </blockquote>
        <div><br>
        </div>
        <div>Surprisingly these globals *were* optimized away at -O3, at
          least at some point. </div>
        <div>Dropped the fake loads for now. </div>
        <div> </div>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex;">
          <span class="HOEnZb"><font color="#888888"><br>
              -Eli<br>
            </font></span></blockquote>
      </div>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
llvm-commits mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>