diff options
-rwxr-xr-x | llvm/cmake/config-ix.cmake | 1 | ||||
-rw-r--r-- | llvm/include/llvm/Config/config.h.cmake | 3 | ||||
-rw-r--r-- | llvm/lib/Support/Unix/Path.inc | 2 | ||||
-rw-r--r-- | llvm/lib/Support/Unix/Signals.inc | 2 |
4 files changed, 6 insertions, 2 deletions
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index a96a722f34d..50bcc508a80 100755 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -227,6 +227,7 @@ if( HAVE_DLFCN_H ) list(APPEND CMAKE_REQUIRED_LIBRARIES dl) endif() check_symbol_exists(dlopen dlfcn.h HAVE_DLOPEN) + check_symbol_exists(dladdr dlfcn.h HAVE_DLADDR) if( HAVE_LIBDL ) list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES dl) endif() diff --git a/llvm/include/llvm/Config/config.h.cmake b/llvm/include/llvm/Config/config.h.cmake index 30a31ecd27f..3ee48a0d1ba 100644 --- a/llvm/include/llvm/Config/config.h.cmake +++ b/llvm/include/llvm/Config/config.h.cmake @@ -51,6 +51,9 @@ /* Define if dlopen() is available on this platform. */ #cmakedefine HAVE_DLOPEN ${HAVE_DLOPEN} +/* Define if dladdr() is available on this platform. */ +#cmakedefine HAVE_DLADDR ${HAVE_DLADDR} + /* Define to 1 if you have the <errno.h> header file. */ #cmakedefine HAVE_ERRNO_H ${HAVE_ERRNO_H} diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc index ecc9a2ea8e2..10e21af5371 100644 --- a/llvm/lib/Support/Unix/Path.inc +++ b/llvm/lib/Support/Unix/Path.inc @@ -180,7 +180,7 @@ std::string getMainExecutable(const char *argv0, void *MainAddr) { if (getprogpath(exe_path, argv0)) return exe_path; } -#elif defined(HAVE_DLFCN_H) +#elif defined(HAVE_DLFCN_H) && defined(HAVE_DLADDR) // Use dladdr to get executable path if available. Dl_info DLInfo; int err = dladdr(MainAddr, &DLInfo); diff --git a/llvm/lib/Support/Unix/Signals.inc b/llvm/lib/Support/Unix/Signals.inc index 9752b70644c..081b2fe33a6 100644 --- a/llvm/lib/Support/Unix/Signals.inc +++ b/llvm/lib/Support/Unix/Signals.inc @@ -412,7 +412,7 @@ void llvm::sys::PrintStackTrace(raw_ostream &OS) { if (printSymbolizedStackTrace(Argv0, StackTrace, depth, OS)) return; -#if HAVE_DLFCN_H && __GNUG__ && !defined(__CYGWIN__) +#if HAVE_DLFCN_H && HAVE_DLADDR int width = 0; for (int i = 0; i < depth; ++i) { Dl_info dlinfo; |