CRASH due to uninitialized static TLS for static DR on Windows
After fixing #4030 (closed), the static-DR apps using droption (drcachesim offline) are crashing under VS2017. Their static TLS is not set up and TEB.ThreadLocalStoragePointer is NULL.
In #2117 (closed) we turned off -private_loader for UNIX, but on Windows we have it. Pasting from that issue:
Unlike on Linux, on Windows we don't rely on private libs filling in key TLS pieces for us and we have a less-significant swap. Furthermore, we have a much heavier dependence on -private_loader and -private_peb throughout DR API code. Plus, at least partial library isolation is possible due to the inability to link in static WINAPI libs. Thus, it seems like we should leave it on for Windows.
That makes sense. So I guess we try to leave it on, and we run the i#4030 code on the executable for static DR? Basically running it twice and hoping there are no bad consequences from that?? Or, better to just copy the app TLS data and not call the initializers?