summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_platform_limits_posix.h
diff options
context:
space:
mode:
authorViktor Kutuzov <vkutuzov@accesssoftek.com>2015-01-30 12:43:52 +0000
committerViktor Kutuzov <vkutuzov@accesssoftek.com>2015-01-30 12:43:52 +0000
commit0534d70a97ccca49e0047e8e49c9ebcf3682edb7 (patch)
treeaaa8011bdc68332f097d098785749b7464ad4fe0 /lib/sanitizer_common/sanitizer_platform_limits_posix.h
parent08b87673616ac3bb3a2deb5176b1d5e568414472 (diff)
[Sanitizers] Introduce GET_LINK_MAP_BY_DLOPEN_HANDLE() macro
Differential Revision: http://reviews.llvm.org/D7233 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@227570 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_platform_limits_posix.h')
-rw-r--r--lib/sanitizer_common/sanitizer_platform_limits_posix.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
index e7c20e2ff..d375e01a2 100644
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -18,6 +18,15 @@
#include "sanitizer_internal_defs.h"
#include "sanitizer_platform.h"
+#if SANITIZER_FREEBSD
+// FreeBSD's dlopen() returns a pointer to an Obj_Entry structure that
+// incroporates the map structure.
+# define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) \
+ ((link_map*)((handle) == nullptr ? nullptr : ((char*)(handle) + 544)))
+#else
+# define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) ((link_map*)(handle))
+#endif // !SANITIZER_FREEBSD
+
namespace __sanitizer {
extern unsigned struct_utsname_sz;
extern unsigned struct_stat_sz;