<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Dear Pierre,<br>
      <br>
      Stepping up a level, what is your goal in replacing calls to
      malloc() and free()?  Is it any different than what SAFECode,
      SoftBound, or ASan do?<br>
      <br>
      Regards,<br>
      <br>
      John Criswell<br>
      <br>
      On 5/25/16 8:05 AM, Pierre Gagelin via llvm-dev wrote:<br>
    </div>
    <blockquote
cite="mid:CALAmmgRO_LWcw8BvEB_0m7BqQ=wmjcW1zyS_bQNrTjLO=cHrHg@mail.gmail.com"
      type="cite">
      <meta http-equiv="Context-Type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>Hi everyone,<br>
                <br>
              </div>
              I am having troubles but this shouldn't be hard to solve
              for many people here. I am beginning a runtime feature for
              the BoundsChecking pass and I want to replace the libc
              malloc&free. I followed the design of AddressSanitizer
              (Asan) and tried to use the INTERCEPTOR macro from the
              interception.h file of compiler-rt library.<br>
              <br>
            </div>
            Here is the problem. The file I modify (BoundsCheking.cpp)
            is in lib/Transforms/Instrumentation/ and I can't include
            properly interception.h (which is in
            projects/compiler-rt/lib/interception/). I looked at the
            CMakeLists.txt and how other files included interception.h
            but they are all from compiler-rt lib directory.<br>
            <br>
          </div>
          I assume this is normal as runtime project should be
          developped under the correct directory but I don't see how
          this should be designed in order that the code optimized by
          BoundsCheking Pass uses my own malloc&free functions.<br>
          <br>
          I spent quite some time on Asan runtime code and found that
          runtime could be initialized with a call to __asan_init()
          (function defined in asan_rtl.cc) from the instrumented code
          directly but I don't know if it's the only way to do it or how
          to reproduce it...<br>
          <br>
        </div>
        <div>So to resume, I want to make my own malloc and free
          function to be called by the code I instrument with
          BoundsChecking. Any suggestion is welcome =)<br>
          <br>
        </div>
        <div>Thanks,<br>
        </div>
        <div>Pierre<br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
    </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>