[compiler-rt] [UBSan] [compiler-rt] add preservecc variants of handlers (PR #168643)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 20 11:00:10 PST 2025


================
@@ -89,6 +89,17 @@ SANITIZER_INTERFACE_WEAK_DEF(void, __ubsan_report_error, const char *kind,
   }
 }
 
+SANITIZER_INTERFACE_WEAK_DEF(void, __ubsan_report_error_preserve,
+                             const char *kind, uintptr_t caller,
+                             const uintptr_t *address)
+[[clang::preserve_all]] {
+  // Additional indirecton so the user can override this with their own
+  // preserve_all function. This would allow, e.g., a function that reports the
+  // first error only, so for all subsequent calls we can skip the register save
----------------
vitalybuka wrote:

I guess you can refactor most of __ubsan_report_error into parts so it can be used here.

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


More information about the llvm-commits mailing list