<div dir="ltr">This is <a href="https://code.google.com/p/address-sanitizer/issues/detail?id=215">https://code.google.com/p/address-sanitizer/issues/detail?id=215</a>, isn't it? </div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Wed, May 7, 2014 at 4:07 AM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">This is a good idea, because it will catch more bugs.  Consider this C++:<div><br><div><div>int foo();</div><div>template <int N> struct X { static int x; };</div><div>template <int N> int X<N>::x = foo();</div>

<div>int main() { return X<0>::x + X<2>::x + X<3>::x + X<4>::x; }</div></div><div><br></div><div>This will put 4 entries into llvm.global_ctors, none of which are called _GLOBAL__*.  We should probably have an ASan integration test in compiler-rt for this, when foo accesses some global in a different TU.</div>

</div><div><br></div><div>On the other hand, all this poisoning and unpoisoning may be expensive.  We could batch up all the initializers of equal priority and merge them into one initializer bracketed by calls to poison and unpoison.</div>

</div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Tue, May 6, 2014 at 4:55 PM, Nico Weber <span dir="ltr"><<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>></span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">Hi,<br>
<br>
here's how the global_ctors version would look. I haven't tested this<br>
much (it's different in that it could now instrument multiple<br>
constructors per module).<br>
<br>
Feel free to play with this, and then land this with tweaks, land it<br>
as-is, or don't land it, up to you :-)<br>
<span><font color="#888888"><br>
Nico<br>
</font></span><br></div></div>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div>