Diff Detail
Event Timeline
Looks OK to me, but let's see if Kostya is fine with this change.
lib/Transforms/Instrumentation/AddressSanitizer.cpp | ||
---|---|---|
1286 | if (TargetTriple.isOSWindows()) { ... } |
In fact this turned out to be a bug in appendToGlobalDtors(...), so I'm likely to go fix that function instead.
Reopening per http://llvm.org/bugs/show_bug.cgi?id=22545 (see comments 13-14, 17: fixing LLVM is possible, but pretty hard and it would basically be a workaround for a CRT bug)
lib/Transforms/Instrumentation/AddressSanitizer.cpp | ||
---|---|---|
1286 | Done. |
lib/Transforms/Instrumentation/AddressSanitizer.cpp | ||
---|---|---|
1286 | why can't you call atexit in the run-time lib? |
OK, that's possible.
Since atexit portability restrictions apply, that'd still require
platform-specific instrumentation AND RTL change as well.
Do you suggest to go down that path?
Because global_dtors DO work when the MT runtime is used. Only the MD
runtime doesn't. (See bug)
I don't quite understand your proposal.
Is it
a) leave the instrumentation without any changes
b) in the RTL, make asan_unregister_global a no-op on Windows
c) in the RTL, make asan_register_global call atexit() to schedule
asan::UnregisterGlobal?
Or am I missing something?
Please note atexit() does not allow one to pass arguments/context to the
callee function.
Kostya has almost persuaded me that this should be fixed at the RTL level [offline].
I'm going to try that approach tomorrow...