[PATCH] D48733: 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.
Jordan Rupprecht via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 28 11:57:09 PDT 2018
rupprecht created this revision.
rupprecht added a reviewer: saugustine.
Herald added subscribers: cfe-commits, chrib, christof.
Repository:
rUNW libunwind
https://reviews.llvm.org/D48733
Files:
src/AddressSpace.hpp
Index: src/AddressSpace.hpp
===================================================================
--- src/AddressSpace.hpp
+++ 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::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) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48733.153365.patch
Type: text/x-patch
Size: 936 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180628/f10e7b27/attachment-0001.bin>
More information about the cfe-commits
mailing list