[asan darwin] Allow clients to implement `__sanitizer_report_error_summary`
authorDave MacLachlan <dmaclach@google.com>
Mon, 6 Mar 2023 23:47:13 +0000 (15:47 -0800)
committerVitaly Buka <vitalybuka@google.com>
Tue, 7 Mar 2023 00:37:45 +0000 (16:37 -0800)
commit28dc3aa7bc9f20f7f283663d63744ed4785a6e7b
treea78bc702220fecc2928a58d2ab6696599a1c5d76
parentaa728ff754e9de91f20fca1e2847d69a81cccb75
[asan darwin] Allow clients to implement `__sanitizer_report_error_summary`

`__sanitizer_report_error_summary` is declared `llvm/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_interface_internal.h` as being able to be overridden by the client. On darwin the sanitizer runtime uses this symbol to find references to the sanitizer libraries, so if you override it you end up with the error `=ERROR: Interceptors are not working. This may be because AddressSanitizer is loaded too late (e.g. via dlopen). Please launch the executable with:` at launch time.

Replace uses of `__sanitizer_report_error_summary` for finding the sanitizer libraries with using the address of a local function.

Reviewed By: yln, vitalybuka

Differential Revision: https://reviews.llvm.org/D144830
compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp
compiler-rt/test/asan/TestCases/report_error_summary.cpp [new file with mode: 0644]