[compiler-rt] [compiler-rt] Avoid pulling in __cxa_pure_virtual (PR #84613)

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 8 23:59:54 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Alexander Richardson (arichardson)

<details>
<summary>Changes</summary>

When building optimized versions of the runtime libraries the compiler
is generally able to elide these references, but when building them
for maximum debug info (with -O0), these references remain which causes
the test suite to fail for tests that do not pull in the C++ standard
library.


---
Full diff: https://github.com/llvm/llvm-project/pull/84613.diff


1 Files Affected:

- (modified) compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.h (+9-4) 


``````````diff
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.h b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.h
index 10361a32034452..869eab9352c4c1 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.h
@@ -30,10 +30,13 @@ class StackTracePrinter {
 
   virtual void RenderFrame(InternalScopedString *buffer, const char *format,
                            int frame_no, uptr address, const AddressInfo *info,
-                           bool vs_style,
-                           const char *strip_path_prefix = "") = 0;
+                           bool vs_style, const char *strip_path_prefix = "") {
+    Abort();  // Should be pure virtual but avoid pulling in __cxa_pure_virtual.
+  }
 
-  virtual bool RenderNeedsSymbolization(const char *format) = 0;
+  virtual bool RenderNeedsSymbolization(const char *format) {
+    Abort();  // Should be pure virtual but avoid pulling in __cxa_pure_virtual.
+  }
 
   void RenderSourceLocation(InternalScopedString *buffer, const char *file,
                             int line, int column, bool vs_style,
@@ -44,7 +47,9 @@ class StackTracePrinter {
                             const char *strip_path_prefix);
   virtual void RenderData(InternalScopedString *buffer, const char *format,
                           const DataInfo *DI,
-                          const char *strip_path_prefix = "") = 0;
+                          const char *strip_path_prefix = "") {
+    Abort();  // Should be pure virtual but avoid pulling in __cxa_pure_virtual.
+  }
 
  private:
   // To be called from StackTracePrinter::GetOrInit

``````````

</details>


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


More information about the llvm-commits mailing list