[compiler-rt] [sanitizer_common][AIX] Avoid weak symbol __cxa_demangle (PR #138556)

Jake Egan via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 16 08:34:02 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,
----------------
jakeegan wrote:

Is adding `__attribute__((visibility("hidden")))` sufficient? 

https://github.com/llvm/llvm-project/pull/138556


More information about the llvm-commits mailing list