[compiler-rt] [ubsan-minimal] Switch to weak symbols for callbacks to allow overriding in client code (PR #119242)

Kirill Stoimenov via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 13:22:48 PST 2024


================
@@ -98,8 +99,9 @@ constexpr unsigned kAddrBuf = SANITIZER_WORDSIZE / 4;
 
 #define HANDLER_RECOVER(name, msg)                               \
   INTERFACE void __ubsan_handle_##name##_minimal() {             \
-    uintptr_t caller = GET_CALLER_PC();                  \
-    if (!report_this_error(caller)) return;                      \
+    uintptr_t caller = GET_CALLER_PC();                          \
+    if (!__sanitizer_report_ubsan_error(caller, #name))          \
----------------
kstoimenov wrote:

We will need the name if we want to increment a counter. The way I am thinking about this is that we will have a 2 dimensional hash map and the logic will be to increment error_count[caller][name]. We additionally could pass the message also. 

https://github.com/llvm/llvm-project/pull/119242


More information about the llvm-commits mailing list