[compiler-rt] 5c3d629 - Revert "Use InernalAlloc in DemangleCXXABI"
Alex Lorenz via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 22 16:40:31 PDT 2023
Author: Alex Lorenz
Date: 2023-08-22T16:40:23-07:00
New Revision: 5c3d62937625b3edc9b9bf0745c6698d57e87d80
URL: https://github.com/llvm/llvm-project/commit/5c3d62937625b3edc9b9bf0745c6698d57e87d80
DIFF: https://github.com/llvm/llvm-project/commit/5c3d62937625b3edc9b9bf0745c6698d57e87d80.diff
LOG: Revert "Use InernalAlloc in DemangleCXXABI"
This reverts commit 649004ae9ea3cff905bbc0b2777ec12056558129.
This commit caused regression in TSAN tests on Darwin:
https://green.lab.llvm.org/green/job/clang-stage1-RA/35380/
These tests have been failing:
SanitizerCommon-tsan-x86_64-Darwin.Darwin.symbolizer-function-offset-dladdr.cpp
SanitizerCommon-tsan-x86_64h-Darwin.Darwin.symbolizer-function-offset-dladdr.cpp
ThreadSanitizer-x86_64.Darwin.symbolizer-dladdr.cpp
ThreadSanitizer-x86_64h.Darwin.symbolizer-dladdr.cpp
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
index 969c642f267595..1a5e38faea8874 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
@@ -46,20 +46,15 @@ namespace __sanitizer {
// Attempts to demangle the name via __cxa_demangle from __cxxabiv1.
const char *DemangleCXXABI(const char *name) {
- // __cxa_demangle aggressively insists on allocating memory.
+ // 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
- // it does not allocate). For now, we just call it anyway, and use
- // InternalAlloc to prevent lsan error.
- if (&__cxxabiv1::__cxa_demangle) {
- if (char *demangled_name = __cxxabiv1::__cxa_demangle(name, 0, 0, 0)) {
- size_t size = internal_strlen(demangled_name) + 1;
- char *buf = (char *)InternalAlloc(size);
- internal_memcpy(buf, demangled_name, size);
- free(demangled_name);
- return buf;
- }
- }
+ // it does not allocate). For now, we just call it anyway, and we leak
+ // the returned value.
+ if (&__cxxabiv1::__cxa_demangle)
+ if (const char *demangled_name =
+ __cxxabiv1::__cxa_demangle(name, 0, 0, 0))
+ return demangled_name;
return name;
}
More information about the llvm-commits
mailing list