Restore global descriptor demangling after D138095 "[asan] Keep Itanium mangled names...
authorFangrui Song <i@maskray.me>
Mon, 21 Nov 2022 20:51:52 +0000 (20:51 +0000)
committerFangrui Song <i@maskray.me>
Mon, 21 Nov 2022 20:51:52 +0000 (20:51 +0000)
commitdb7c82231c32074440d5426870051228435c6bce
tree38f76fbb245844e66df927364abd4672db04a157
parentb3f15ccf54cf8094507137d145b38313aa785d61
Restore global descriptor demangling after D138095 "[asan] Keep Itanium mangled names in global metadata"

This amends commit 00be3578e0841dd9abe408e5b4946180de0bf46b to demangle symbol
names in global descriptors. We keep the mangled name for the `__odr_gen_asan_*`
variables and the runtime __cxa_demangle call site change (which fixed possible
leaks for other scenarios: non-fatal diagnostics).

compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp uses
an undefined weak `__cxa_demangle` which does not pull in an archive definition.
A -static-libstdc++ executable link does not get demangled names.

Unfortunately this means we cannot rely on runtime demangling.
See compiler-rt/test/asan/TestCases/global-demangle.cpp
compiler-rt/lib/asan/asan_globals.cpp
compiler-rt/test/asan/TestCases/Linux/odr_indicators.cpp
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
llvm/test/Instrumentation/AddressSanitizer/local_alias.ll