[PATCH] D36078: [XRay][compiler-rt] Remove use of std::mutex and std::shared_ptr from global scope.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 07:54:52 PDT 2017


On Tue, Aug 1, 2017 at 7:52 AM Dean Michael Berris <dberris at google.com>
wrote:

> On 2 Aug 2017, at 00:49, David Blaikie <dblaikie at gmail.com> wrote:
>
>
>
> On Mon, Jul 31, 2017 at 11:18 PM Dean Michael Berris via Phabricator <
> reviews at reviews.llvm.org> wrote:
>
>> dberris added a comment.
>>
>> In https://reviews.llvm.org/D36078#826962, @kpw wrote:
>>
>> > What's the primary motivation? Are we trying to avoid the upfront cost
>> of global initialization? The unspecified destructor ordering with
>> multithreaded programs?
>>
>>
>> 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.
>>
>
> 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)
>
>
>
> Runtime crashes during initialisation and incompatibilities. I guess you
> can call those correctness issues.
>

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)

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?

- Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170801/b2db22b0/attachment.html>


More information about the llvm-commits mailing list