[asan/win] Add init hooks to .CRT$XLAB
User applications may register hooks in the .CRT$XL* callback list,
which is called very early by the loader. This is very common in
This has flown under the radar for a long time because the loader
appears to catch exceptions originating from these callbacks. It's a
real problem when you're debugging an asan application, though, since it
makes the program crash early.
The solution is to add our own callback to this list, and sort it very
early in the list like we do elsewhere. Also add a test with such an
instrumented callback, and test that it gets called with asan.
Subscribers: llvm-commits, kubabrecka
Differential Revision: https://reviews.llvm.org/D26404