Skip to content

Commit 52b7510

Browse files
committed
[Sanitizer] Attempt to fix linker error on ARM variants
Previous commit: llvm@a0884da llvm-svn: 355046
1 parent 8edffdb commit 52b7510

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

compiler-rt/lib/ubsan/ubsan_diag.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@
2626

2727
using namespace __ubsan;
2828

29+
// Weak linkage: UBSan is combined with runtimes that already provide this
30+
// functionality (e.g., ASan) as well as runtimes that lack it (e.g., scudo).
31+
SANITIZER_WEAK_ATTRIBUTE
32+
void __sanitizer::GetStackTrace(BufferedStackTrace *stack, uptr max_depth,
33+
uptr pc, uptr bp, void *context, bool fast) {
34+
uptr top = 0;
35+
uptr bottom = 0;
36+
if (StackTrace::WillUseFastUnwind(fast)) {
37+
GetThreadStackTopAndBottom(false, &top, &bottom);
38+
stack->Unwind(max_depth, pc, bp, nullptr, top, bottom, true);
39+
} else
40+
stack->Unwind(max_depth, pc, bp, context, 0, 0, false);
41+
}
42+
2943
static void MaybePrintStackTrace(uptr pc, uptr bp) {
3044
// We assume that flags are already parsed, as UBSan runtime
3145
// will definitely be called when we print the first diagnostics message.

compiler-rt/lib/ubsan/ubsan_diag_standalone.cc

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,6 @@
1414
#if CAN_SANITIZE_UB
1515
#include "ubsan_diag.h"
1616

17-
void __sanitizer::GetStackTrace(BufferedStackTrace *stack, uptr max_depth,
18-
uptr pc, uptr bp, void *context, bool fast) {
19-
uptr top = 0;
20-
uptr bottom = 0;
21-
if (StackTrace::WillUseFastUnwind(fast)) {
22-
GetThreadStackTopAndBottom(false, &top, &bottom);
23-
stack->Unwind(max_depth, pc, bp, nullptr, top, bottom, true);
24-
} else
25-
stack->Unwind(max_depth, pc, bp, context, 0, 0, false);
26-
}
27-
2817
using namespace __ubsan;
2918

3019
extern "C" {

0 commit comments

Comments
 (0)