[ASan] Linker-initialize static ScopedInErrorReport::current_error_.
authorAlex Shlyapnikov <alekseys@google.com>
Thu, 14 Jun 2018 18:22:23 +0000 (18:22 +0000)
committerAlex Shlyapnikov <alekseys@google.com>
Thu, 14 Jun 2018 18:22:23 +0000 (18:22 +0000)
commit241b75869011979b6b3aa36692e6871e24040cc7
treefc141e3aef985cb2c4cdf7825f0c60b361122884
parentf56ef90e26bd1bb5cfa8e4b0e09ec56a9142dbfb
[ASan] Linker-initialize static ScopedInErrorReport::current_error_.

Summary:
Static ScopedInErrorReport::current_error_ can be linker initialized to
shave one global ctor call on application startup and be __asan_init-safe.

Global constructors in ASan runtime are bad because __asan_init runs
from preinit_array, before any such constructors.

Issue: https://github.com/google/sanitizers/issues/194

Reviewers: eugenis, morehouse

Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits

Differential Revision: https://reviews.llvm.org/D48141

llvm-svn: 334748
compiler-rt/lib/asan/asan_errors.h
compiler-rt/lib/asan/asan_report.cc