Skip to content

Commit

Permalink
[Sanitizer] Attempt to fix linker error on ARM variants
Browse files Browse the repository at this point in the history
Previous commit:
llvm@a0884da

llvm-svn: 355046
  • Loading branch information
yln committed Feb 27, 2019
1 parent 8edffdb commit 52b7510
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
14 changes: 14 additions & 0 deletions compiler-rt/lib/ubsan/ubsan_diag.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 0 additions & 11 deletions compiler-rt/lib/ubsan/ubsan_diag_standalone.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down

0 comments on commit 52b7510

Please sign in to comment.