summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan/asan_stack.cc
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2012-12-07 22:01:28 +0000
committerAlexey Samsonov <samsonov@google.com>2012-12-07 22:01:28 +0000
commita0e4706fe6561e39a7a2fb4929553fa364feae25 (patch)
tree67349bd6c75ef74aa8682ee86f751a3fd5d7fce7 /compiler-rt/lib/asan/asan_stack.cc
parent9cadaa7ef8f922c5e3a96208852d4e6c1c1e4f4b (diff)
downloadbcm5719-llvm-a0e4706fe6561e39a7a2fb4929553fa364feae25.tar.gz
bcm5719-llvm-a0e4706fe6561e39a7a2fb4929553fa364feae25.zip
ASan: change the strategy we use for installing malloc/free/symbolization hooks on Linux: don't provide a default no-op implementations for hooks in runtime, and optionally call hooks if they are provided by the user. Don't force weak interface functions into runtime.
llvm-svn: 169641
Diffstat (limited to 'compiler-rt/lib/asan/asan_stack.cc')
-rw-r--r--compiler-rt/lib/asan/asan_stack.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler-rt/lib/asan/asan_stack.cc b/compiler-rt/lib/asan/asan_stack.cc
index 53a46470a61..ebf22fd34ca 100644
--- a/compiler-rt/lib/asan/asan_stack.cc
+++ b/compiler-rt/lib/asan/asan_stack.cc
@@ -17,9 +17,15 @@
namespace __asan {
+static bool MaybeCallAsanSymbolize(const void *pc, char *out_buffer,
+ int out_size) {
+ return (&__asan_symbolize) ? __asan_symbolize(pc, out_buffer, out_size)
+ : false;
+}
+
void PrintStack(StackTrace *stack) {
stack->PrintStack(stack->trace, stack->size, flags()->symbolize,
- flags()->strip_path_prefix, __asan_symbolize);
+ flags()->strip_path_prefix, MaybeCallAsanSymbolize);
}
} // namespace __asan
@@ -29,7 +35,7 @@ void PrintStack(StackTrace *stack) {
// Provide default implementation of __asan_symbolize that does nothing
// and may be overriden by user if he wants to use his own symbolization.
// ASan on Windows has its own implementation of this.
-#ifndef _WIN32
+#if !defined(_WIN32) && !SANITIZER_SUPPORTS_WEAK_HOOKS
SANITIZER_WEAK_ATTRIBUTE SANITIZER_INTERFACE_ATTRIBUTE NOINLINE
bool __asan_symbolize(const void *pc, char *out_buffer, int out_size) {
return false;
OpenPOWER on IntegriCloud