<div dir="ltr">Thanks for the diagnosis and patch! I applied it in r245377.<div><br></div><div>We're all set on the licensing front because you appear to also be the original author of the code you cited in the mozilla repo, and since you're sending us a patch, I'm assuming that you're OK with distributing that code under the UIUC license (pretty vanilla BSD).</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 18, 2015 at 2:18 PM, David Major via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Windows, it's not possible to hook malloc using<br>
GetProcAddress(...,"malloc") because the GetProcAddress API will run the<br>
target DLL's initialize routine, which can cause mallocs to happen<br>
before the hook is installed. This was observed in<br>
<a href="https://llvm.org/bugs/show_bug.cgi?id=24237#c2" rel="noreferrer" target="_blank">https://llvm.org/bugs/show_bug.cgi?id=24237#c2</a>.<br>
<br>
This patch adds a GetProcAddress replacement that manually walks the<br>
target library's export table, without calling the initialization<br>
routine.<br>
<br>
(A large part of this is taken from Mozilla code at<br>
<a href="https://hg.mozilla.org/mozilla-central/file/tip/toolkit/xre/WindowsCrtPatch.h" rel="noreferrer" target="_blank">https://hg.mozilla.org/mozilla-central/file/tip/toolkit/xre/WindowsCrtPatch.h</a>.<br>
I hope that's okay license-wise.)<br>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div>