[compiler-rt] r355046 - [Sanitizer] Attempt to fix linker error on ARM variants

Julian Lettner via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 27 15:47:00 PST 2019


Author: yln
Date: Wed Feb 27 15:47:00 2019
New Revision: 355046

URL: http://llvm.org/viewvc/llvm-project?rev=355046&view=rev
Log:
[Sanitizer] Attempt to fix linker error on ARM variants

Previous commit:
https://github.com/llvm/llvm-project/commit/a0884da62a471f08c65a03e337aea23203a43eb8

Modified:
    compiler-rt/trunk/lib/ubsan/ubsan_diag.cc
    compiler-rt/trunk/lib/ubsan/ubsan_diag_standalone.cc

Modified: compiler-rt/trunk/lib/ubsan/ubsan_diag.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/ubsan_diag.cc?rev=355046&r1=355045&r2=355046&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/ubsan_diag.cc (original)
+++ compiler-rt/trunk/lib/ubsan/ubsan_diag.cc Wed Feb 27 15:47:00 2019
@@ -26,6 +26,20 @@
 
 using namespace __ubsan;
 
+// Weak linkage: UBSan is combined with runtimes that already provide this
+// functionality (e.g., ASan) as well as runtimes that lack it (e.g., scudo).
+SANITIZER_WEAK_ATTRIBUTE
+void __sanitizer::GetStackTrace(BufferedStackTrace *stack, uptr max_depth,
+                                uptr pc, uptr bp, void *context, bool fast) {
+  uptr top = 0;
+  uptr bottom = 0;
+  if (StackTrace::WillUseFastUnwind(fast)) {
+    GetThreadStackTopAndBottom(false, &top, &bottom);
+    stack->Unwind(max_depth, pc, bp, nullptr, top, bottom, true);
+  } else
+    stack->Unwind(max_depth, pc, bp, context, 0, 0, false);
+}
+
 static void MaybePrintStackTrace(uptr pc, uptr bp) {
   // We assume that flags are already parsed, as UBSan runtime
   // will definitely be called when we print the first diagnostics message.

Modified: compiler-rt/trunk/lib/ubsan/ubsan_diag_standalone.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/ubsan_diag_standalone.cc?rev=355046&r1=355045&r2=355046&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/ubsan_diag_standalone.cc (original)
+++ compiler-rt/trunk/lib/ubsan/ubsan_diag_standalone.cc Wed Feb 27 15:47:00 2019
@@ -14,17 +14,6 @@
 #if CAN_SANITIZE_UB
 #include "ubsan_diag.h"
 
-void __sanitizer::GetStackTrace(BufferedStackTrace *stack, uptr max_depth,
-                                uptr pc, uptr bp, void *context, bool fast) {
-  uptr top = 0;
-  uptr bottom = 0;
-  if (StackTrace::WillUseFastUnwind(fast)) {
-    GetThreadStackTopAndBottom(false, &top, &bottom);
-    stack->Unwind(max_depth, pc, bp, nullptr, top, bottom, true);
-  } else
-    stack->Unwind(max_depth, pc, bp, context, 0, 0, false);
-}
-
 using namespace __ubsan;
 
 extern "C" {




More information about the llvm-commits mailing list