[PATCH] D44243: [asan] Make ScopedInErrorReport::current_error_ linker-initialized
Kuba (Brecka) Mracek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 8 11:37:31 PST 2018
kubamracek added inline comments.
================
Comment at: lib/asan/asan_report.cc:205
-ErrorDescription ScopedInErrorReport::current_error_;
+ErrorDescription ScopedInErrorReport::current_error_(LINKER_INITIALIZED);
----------------
delcypher wrote:
> How does `LINKER_INITIALIZED` guarantee that the linker will actually initialize the struct? It looks like it's just a member of an enum, so it doesn't actually do anything.
>
> My naive reading of this code is that you're trying to avoid the call to `internal_memset(this, 0, sizeof(*this))`. It looks like this will mean though that the anonymous union won't be initialized.
For global variables, uninitialized = filled with zeroes. Unfortunately, I don't think there is a reasonable way to enforce this. C++14 has constexpr constructors, but I don't think we can use C++14 in compiler-rt (yet).
I have to admit that the way I "tested" the patch was to build compiler-rt, then disassemble the result and look if the static constructor is there or not.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D44243
More information about the llvm-commits
mailing list