diff options
author | Jordan Rupprecht <rupprecht@google.com> | 2018-06-29 20:41:50 +0000 |
---|---|---|
committer | Jordan Rupprecht <rupprecht@google.com> | 2018-06-29 20:41:50 +0000 |
commit | 1f736b07f64e00071b6cb0f34e592fe30ab6fa90 (patch) | |
tree | 5c5dd1136e32edd5e2c3a1f4f09ebe9732c5fd62 | |
parent | 8b44248919f6e4d2a9b5ae1d67c65f5ac3668cf8 (diff) | |
download | libunwind_llvm-1f736b07f64e00071b6cb0f34e592fe30ab6fa90.tar.gz |
Introduce a separate preprocessor macro, _LIBUNWIND_USE_DLADDR, for directly controlling a dependency on dladdr(). This will allow us to use libunwind without adding a libdl dependency.
Reviewers: saugustine
Subscribers: christof, chrib, cfe-commits, echristo
Differential Revision: https://reviews.llvm.org/D48733
git-svn-id: https://llvm.org/svn/llvm-project/libunwind/trunk@336014 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | src/AddressSpace.hpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/AddressSpace.hpp b/src/AddressSpace.hpp index 32ff1f3..e3a7e40 100644 --- a/src/AddressSpace.hpp +++ b/src/AddressSpace.hpp @@ -18,7 +18,15 @@ #include <stdlib.h> #include <string.h> -#if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32) +#ifndef _LIBUNWIND_USE_DLADDR + #if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32) + #define _LIBUNWIND_USE_DLADDR 1 + #else + #define _LIBUNWIND_USE_DLADDR 0 + #endif +#endif + +#if _LIBUNWIND_USE_DLADDR #include <dlfcn.h> #endif @@ -576,7 +584,7 @@ inline bool LocalAddressSpace::findOtherFDE(pint_t targetAddr, pint_t &fde) { inline bool LocalAddressSpace::findFunctionName(pint_t addr, char *buf, size_t bufLen, unw_word_t *offset) { -#if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32) +#if _LIBUNWIND_USE_DLADDR Dl_info dyldInfo; if (dladdr((void *)addr, &dyldInfo)) { if (dyldInfo.dli_sname != NULL) { |