[compiler-rt] Revert "[UBSan] [compiler-rt] add preservecc variants of handlers" (PR #168973)

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 20 16:00:20 PST 2025


https://github.com/fmayer created https://github.com/llvm/llvm-project/pull/168973

Reverts llvm/llvm-project#168643

>From cc5837d4fad0578ed67bebc32555766f2364b7e4 Mon Sep 17 00:00:00 2001
From: Florian Mayer <florian.mayer at bitsrc.org>
Date: Thu, 20 Nov 2025 15:59:54 -0800
Subject: [PATCH] Revert "[UBSan] [compiler-rt] add preservecc variants of
 handlers (#168643)"

This reverts commit 49e46a57cc1575271179c8c9c6fec5639781e9c6.
---
 .../ubsan_minimal/ubsan_minimal_handlers.cpp  | 19 -------------------
 .../TestCases/test-darwin-interface.c         |  1 -
 2 files changed, 20 deletions(-)

diff --git a/compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp b/compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp
index 0a2d6f35a539a..a2a2e36e8523d 100644
--- a/compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp
+++ b/compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp
@@ -89,17 +89,6 @@ 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
-  // / restore.
-  __ubsan_report_error(kind, caller, address);
-}
-
 SANITIZER_INTERFACE_WEAK_DEF(void, __ubsan_report_error_fatal, const char *kind,
                              uintptr_t caller, const uintptr_t *address) {
   // Use another handlers, in case it's already overriden.
@@ -141,10 +130,6 @@ void NORETURN CheckFailed(const char *file, int, const char *cond, u64, u64) {
 #define HANDLER_RECOVER(name, kind)                                            \
   INTERFACE void __ubsan_handle_##name##_minimal() {                           \
     __ubsan_report_error(kind, GET_CALLER_PC(), nullptr);                      \
-  }                                                                            \
-  INTERFACE void __ubsan_handle_##name##_minimal_preserve()                    \
-      [[clang::preserve_all]] {                                                \
-    __ubsan_report_error_preserve(kind, GET_CALLER_PC(), nullptr);             \
   }
 
 #define HANDLER_NORECOVER(name, kind)                                          \
@@ -161,10 +146,6 @@ void NORETURN CheckFailed(const char *file, int, const char *cond, u64, u64) {
 #define HANDLER_RECOVER_PTR(name, kind)                                        \
   INTERFACE void __ubsan_handle_##name##_minimal(const uintptr_t address) {    \
     __ubsan_report_error(kind, GET_CALLER_PC(), &address);                     \
-  }                                                                            \
-  INTERFACE void __ubsan_handle_##name##_minimal_preserve(                     \
-      const uintptr_t address) [[clang::preserve_all]] {                       \
-    __ubsan_report_error_preserve(kind, GET_CALLER_PC(), &address);            \
   }
 
 #define HANDLER_NORECOVER_PTR(name, kind)                                      \
diff --git a/compiler-rt/test/ubsan_minimal/TestCases/test-darwin-interface.c b/compiler-rt/test/ubsan_minimal/TestCases/test-darwin-interface.c
index 3c76e5aadc087..abc1073e02073 100644
--- a/compiler-rt/test/ubsan_minimal/TestCases/test-darwin-interface.c
+++ b/compiler-rt/test/ubsan_minimal/TestCases/test-darwin-interface.c
@@ -4,7 +4,6 @@
 // REQUIRES: x86_64-darwin
 
 // RUN: nm -jgU `%clangxx_min_runtime -fsanitize-minimal-runtime -fsanitize=undefined %s -o %t '-###' 2>&1 | grep "libclang_rt.ubsan_minimal_osx_dynamic.dylib" | sed -e 's/.*"\(.*libclang_rt.ubsan_minimal_osx_dynamic.dylib\)".*/\1/'` | grep "^___ubsan_handle" \
-// RUN:  | grep -vE "_minimal_preserve" \
 // RUN:  | sed 's/_minimal//g' \
 // RUN:  > %t.minimal.symlist
 //



More information about the llvm-commits mailing list