[compiler-rt] [sanitizer_common] Implement address sanitizer on AIX: demangling (PR #138556)
Hubert Tong via llvm-commits
llvm-commits at lists.llvm.org
Tue May 6 14:46:51 PDT 2025
================
@@ -38,10 +38,36 @@
// because we do not require a C++ ABI library to be linked to a program
// using sanitizers; if it's not present, we'll just use the mangled name.
namespace __cxxabiv1 {
+# if !SANITIZER_AIX
extern "C" SANITIZER_WEAK_ATTRIBUTE char *__cxa_demangle(const char *mangled,
char *buffer,
size_t *length,
int *status);
+# else
+// `weak` attribute without definition on AIX will cause linking time undefined
+// symbol error, we use dlopen/dlsym here to find related symbol.
+typedef char *__cxa_demangle_t(const char *mangled, char *buffer,
+ size_t *length, int *status);
+
+char *__cxa_demangle(const char *mangled, char *buffer, size_t *length,
----------------
hubert-reinterpretcast wrote:
The sanitizer _should not_ define a `__cxa_demangle` that could satisfy a link dependency from the user program.
https://github.com/llvm/llvm-project/pull/138556
More information about the llvm-commits
mailing list