[PATCH] D44243: [asan] Make ScopedInErrorReport::current_error_ linker-initialized
Dan Liew via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 16 13:13:28 PDT 2018
delcypher added inline comments.
================
Comment at: lib/asan/asan_report.cc:205
-ErrorDescription ScopedInErrorReport::current_error_;
+ErrorDescription ScopedInErrorReport::current_error_(LINKER_INITIALIZED);
----------------
kubamracek wrote:
> 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.
> For global variables, uninitialized = filled with zeroes.
For simple structs yes. For unions inside structs, I'm not sure what happens.
Regardless of that all that, I think an explanation of why this change is being made is the only thing that is missing to accept this patch.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D44243
More information about the llvm-commits
mailing list