Details
Diff Detail
Event Timeline
Based on other code that uses LINKER_INITIALIZED this seems reasonable. However I have no idea how this is supposed to actually work.
lib/asan/asan_report.cc | ||
---|---|---|
205 | 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. |
lib/asan/asan_report.cc | ||
---|---|---|
205 | 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. |
lib/asan/asan_report.cc | ||
---|---|---|
205 |
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. |
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.