summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@bec.de>2013-04-27 22:12:32 +0000
committerJoerg Sonnenberger <joerg@bec.de>2013-04-27 22:12:32 +0000
commit66241831dc9d33af810895cd622174cb9bdc6e4c (patch)
treeb346a19627546a4861603c86c830e5e8b82aff42
parenta39fe8c59e45dbee6407f1deb540815c162f0c68 (diff)
downloadbcm5719-llvm-66241831dc9d33af810895cd622174cb9bdc6e4c.tar.gz
bcm5719-llvm-66241831dc9d33af810895cd622174cb9bdc6e4c.zip
Only use cxxabi.h's demangler, if it is actually available.
llvm-svn: 180684
-rw-r--r--llvm/autoconf/configure.ac2
-rwxr-xr-xllvm/cmake/config-ix.cmake1
-rwxr-xr-xllvm/configure2
-rw-r--r--llvm/include/llvm/Config/config.h.cmake3
-rw-r--r--llvm/include/llvm/Config/config.h.in3
-rw-r--r--llvm/lib/Support/Unix/Signals.inc10
6 files changed, 17 insertions, 4 deletions
diff --git a/llvm/autoconf/configure.ac b/llvm/autoconf/configure.ac
index 9c116f7c006..3101e9a5a16 100644
--- a/llvm/autoconf/configure.ac
+++ b/llvm/autoconf/configure.ac
@@ -1507,7 +1507,7 @@ AC_HEADER_STAT
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
-AC_CHECK_HEADERS([dlfcn.h execinfo.h fcntl.h inttypes.h limits.h link.h])
+AC_CHECK_HEADERS([cxxabi.h dlfcn.h execinfo.h fcntl.h inttypes.h limits.h link.h])
AC_CHECK_HEADERS([malloc.h setjmp.h signal.h stdint.h termios.h unistd.h])
AC_CHECK_HEADERS([utime.h windows.h])
AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/resource.h sys/time.h sys/uio.h])
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index 7c4285a299b..e5bcc0e9b11 100755
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -37,6 +37,7 @@ endfunction()
check_include_file(argz.h HAVE_ARGZ_H)
check_include_file(assert.h HAVE_ASSERT_H)
check_include_file(ctype.h HAVE_CTYPE_H)
+check_include_file(cxxabi.h HAVE_CXXABI_H)
check_include_file(dirent.h HAVE_DIRENT_H)
check_include_file(dl.h HAVE_DL_H)
check_include_file(dld.h HAVE_DLD_H)
diff --git a/llvm/configure b/llvm/configure
index 26b612d2799..4e146189e6f 100755
--- a/llvm/configure
+++ b/llvm/configure
@@ -14868,7 +14868,7 @@ fi
-for ac_header in dlfcn.h execinfo.h fcntl.h inttypes.h limits.h link.h
+for ac_header in cxxabi.h dlfcn.h execinfo.h fcntl.h inttypes.h limits.h link.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
diff --git a/llvm/include/llvm/Config/config.h.cmake b/llvm/include/llvm/Config/config.h.cmake
index 97af6955d9e..93c2582ae23 100644
--- a/llvm/include/llvm/Config/config.h.cmake
+++ b/llvm/include/llvm/Config/config.h.cmake
@@ -69,6 +69,9 @@
/* Define to 1 if you have the `closedir' function. */
#cmakedefine HAVE_CLOSEDIR ${HAVE_CLOSEDIR}
+/* Define to 1 if you have the <cxxabi.h> header file. */
+#cmakedefine HAVE_CXXABI_H ${HAVE_CXXABI_H}
+
/* Define to 1 if you have the <CrashReporterClient.h> header file. */
#undef HAVE_CRASHREPORTERCLIENT_H
diff --git a/llvm/include/llvm/Config/config.h.in b/llvm/include/llvm/Config/config.h.in
index 7f75f4df69c..0cffd0febec 100644
--- a/llvm/include/llvm/Config/config.h.in
+++ b/llvm/include/llvm/Config/config.h.in
@@ -69,6 +69,9 @@
/* Define to 1 if you have the `closedir' function. */
#undef HAVE_CLOSEDIR
+/* Define to 1 if you have the <cxxabi.h> header file. */
+#undef HAVE_CXXABI_H
+
/* Define to 1 if you have the <CrashReporterClient.h> header file. */
#undef HAVE_CRASHREPORTERCLIENT_H
diff --git a/llvm/lib/Support/Unix/Signals.inc b/llvm/lib/Support/Unix/Signals.inc
index 66338f17d88..1f8c8158d7f 100644
--- a/llvm/lib/Support/Unix/Signals.inc
+++ b/llvm/lib/Support/Unix/Signals.inc
@@ -27,9 +27,11 @@
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
-#if HAVE_DLFCN_H && __GNUG__
+#if HAVE_CXXABI_H
+#include cxxabi.h>
+#endif
+#if HAVE_DLFCN_H
#include <dlfcn.h>
-#include <cxxabi.h>
#endif
#if HAVE_MACH_MACH_H
#include <mach/mach.h>
@@ -292,7 +294,11 @@ void llvm::sys::PrintStackTrace(FILE *FD) {
if (dlinfo.dli_sname != NULL) {
int res;
fputc(' ', FD);
+# if HAVE_CXXABI_H
char* d = abi::__cxa_demangle(dlinfo.dli_sname, NULL, NULL, &res);
+# else
+ char* d = NULL;
+# endif
if (d == NULL) fputs(dlinfo.dli_sname, FD);
else fputs(d, FD);
free(d);
OpenPOWER on IntegriCloud