<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, Aug 1, 2017 at 7:52 AM Dean Michael Berris <<a href="mailto:dberris@google.com">dberris@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><blockquote type="cite"><div>On 2 Aug 2017, at 00:49, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:</div><br class="m_-3731131061154773572Apple-interchange-newline"><div><div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Mon, Jul 31, 2017 at 11:18 PM Dean Michael Berris via Phabricator <<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">dberris added a comment.<br>
<br>
In <a href="https://reviews.llvm.org/D36078#826962" rel="noreferrer" target="_blank">https://reviews.llvm.org/D36078#826962</a>, @kpw wrote:<br>
<br>
> What's the primary motivation? Are we trying to avoid the upfront cost of global initialization? The unspecified destructor ordering with multithreaded programs?<br>
<br>
<br>
The primary motivation is to avoid the initialization of atomics at initialization time. This has caused some issues in the past with dynamic linking and relocations.<br></blockquote><div><br>Correctness issues? Performance issues? Seems like it'd be good to have the issues described more fully here (and/or in the commit(s) for posterity/clarity)<br> </div></div></div></div></blockquote><div><br></div></div></div><div style="word-wrap:break-word"><div><div>Runtime crashes during initialisation and incompatibilities. I guess you can call those correctness issues.</div></div></div></blockquote><div><br>Is there more detail that could be documented here - basically a full answer to "why can't xray (or compiler-rt in general?) have global initializers?" (if this is a compiler-rt requirement maybe it should be written down somewhere more centrally, if it's only an xray requirement, at least documenting it fully in the commit messages and maybe in some comments could be good)<br><br>I'd be curious (& I think it'd be good to write down) to better understand the mechanism of action - how does a global initializer lead to a crash in this instance & what's incompatible/why?<br><br>- Dave<br> </div></div></div>