diff options
author | Kuba Brecka <kuba.brecka@gmail.com> | 2015-11-13 20:47:29 +0000 |
---|---|---|
committer | Kuba Brecka <kuba.brecka@gmail.com> | 2015-11-13 20:47:29 +0000 |
commit | 1f219dcb985610c5feec090b1a3e3e33b511d2e4 (patch) | |
tree | f9f1bec3f67136d1d1d70bb604115a4c41f4775a | |
parent | 7291b88e9ad07a14ce6ff9db11ab04a887e74482 (diff) | |
download | bcm5719-llvm-1f219dcb985610c5feec090b1a3e3e33b511d2e4.tar.gz bcm5719-llvm-1f219dcb985610c5feec090b1a3e3e33b511d2e4.zip |
[tsan] Don't demangle names not starting with "_Z"
I noticed that when a symbol is named just "x", it gets demangled to "long long". On POSIX, AFAIK, mangled names always start with "_Z", so lets just require that.
Differential Revision: http://reviews.llvm.org/D14637
llvm-svn: 253080
-rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc | 3 | ||||
-rw-r--r-- | compiler-rt/test/tsan/Darwin/symbolizer-dladdr.cc | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc index a19b0a67862..c4bc9b8d934 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc @@ -48,6 +48,9 @@ namespace __sanitizer { // Attempts to demangle the name via __cxa_demangle from __cxxabiv1. const char *DemangleCXXABI(const char *name) { + if (name[0] != '_' || name[1] != 'Z') + return name; + // FIXME: __cxa_demangle aggressively insists on allocating memory. // There's not much we can do about that, short of providing our // own demangler (libc++abi's implementation could be adapted so that diff --git a/compiler-rt/test/tsan/Darwin/symbolizer-dladdr.cc b/compiler-rt/test/tsan/Darwin/symbolizer-dladdr.cc index d5356378c47..a7782c01a35 100644 --- a/compiler-rt/test/tsan/Darwin/symbolizer-dladdr.cc +++ b/compiler-rt/test/tsan/Darwin/symbolizer-dladdr.cc @@ -3,10 +3,12 @@ #include "../test.h" int GlobalData[10]; +long long x; void *Thread(void *a) { barrier_wait(&barrier); GlobalData[2] = 42; + x = 7; return 0; } @@ -18,6 +20,7 @@ int main() { pthread_t t; pthread_create(&t, 0, Thread, 0); GlobalData[2] = 43; + x = 8; barrier_wait(&barrier); pthread_join(t, 0); } @@ -27,3 +30,5 @@ int main() { // CHECK: addr=[[ADDR:0x[0-9,a-f]+]] // CHECK: WARNING: ThreadSanitizer: data race // CHECK: Location is global 'GlobalData' at [[ADDR]] ({{.*}}+0x{{[0-9,a-f]+}}) +// CHECK: WARNING: ThreadSanitizer: data race +// CHECK: Location is global 'x' at {{.*}} ({{.*}}+0x{{[0-9,a-f]+}}) |