[ASan] Collect unmangled names of global variables in Clang to print them in error...
authorAlexey Samsonov <vonosmas@gmail.com>
Sat, 12 Jul 2014 00:42:52 +0000 (00:42 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Sat, 12 Jul 2014 00:42:52 +0000 (00:42 +0000)
commitb2d259060d121ba22db18797d230a10c6a95ef62
tree77f8523b89395abb5bd006f8de81cafb766b5301
parentcc6a41860059dd2085781a242721c434a9685d0e
[ASan] Collect unmangled names of global variables in Clang to print them in error reports.

Currently ASan instrumentation pass creates a string with global name
for each instrumented global (to include global names in the error report). Global
name is already mangled at this point, and we may not be able to demangle it
at runtime (e.g. there is no __cxa_demangle on Android).

Instead, create a string with fully qualified global name in Clang, and pass it
to ASan instrumentation pass in llvm.asan.globals metadata. If there is no metadata
for some global, ASan will use the original algorithm.

This fixes https://code.google.com/p/address-sanitizer/issues/detail?id=264.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212872 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Instrumentation/AddressSanitizer.cpp
test/Instrumentation/AddressSanitizer/global_metadata.ll
test/Instrumentation/AddressSanitizer/instrument_global.ll
test/Instrumentation/AddressSanitizer/instrument_initializer_metadata.ll