summaryrefslogtreecommitdiffstats
path: root/compiler-rt
diff options
context:
space:
mode:
authorViktor Kutuzov <vkutuzov@accesssoftek.com>2014-08-08 06:21:09 +0000
committerViktor Kutuzov <vkutuzov@accesssoftek.com>2014-08-08 06:21:09 +0000
commit7a2716078047da54fefca0f8ec6aca05681105d5 (patch)
treedc65cd4a70847e93d95ac466806759c8bdb90512 /compiler-rt
parentfe8c7540b08367feeed884506308dba248dd0c3c (diff)
downloadbcm5719-llvm-7a2716078047da54fefca0f8ec6aca05681105d5.tar.gz
bcm5719-llvm-7a2716078047da54fefca0f8ec6aca05681105d5.zip
Support getting process maps for sanitizers needs on FreeBSD in 32-bit mode
Differential Revision: http://reviews.llvm.org/D4807 llvm-svn: 215185
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_freebsd.h26
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_procmaps_freebsd.cc8
2 files changed, 34 insertions, 0 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_freebsd.h b/compiler-rt/lib/sanitizer_common/sanitizer_freebsd.h
index eea248f8ae0..c9bba8064af 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_freebsd.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_freebsd.h
@@ -23,10 +23,13 @@
# include <osreldate.h>
# if __FreeBSD_version <= 902001 // v9.2
# include <link.h>
+# include <sys/param.h>
# include <ucontext.h>
namespace __sanitizer {
+typedef unsigned long long __xuint64_t;
+
typedef __int32_t __xregister_t;
typedef struct __xmcontext {
@@ -75,6 +78,29 @@ typedef struct __xucontext {
int __spare__[4];
} xucontext_t;
+struct xkinfo_vmentry {
+ int kve_structsize;
+ int kve_type;
+ __xuint64_t kve_start;
+ __xuint64_t kve_end;
+ __xuint64_t kve_offset;
+ __xuint64_t kve_vn_fileid;
+ __uint32_t kve_vn_fsid;
+ int kve_flags;
+ int kve_resident;
+ int kve_private_resident;
+ int kve_protection;
+ int kve_ref_count;
+ int kve_shadow_count;
+ int kve_vn_type;
+ __xuint64_t kve_vn_size;
+ __uint32_t kve_vn_rdev;
+ __uint16_t kve_vn_mode;
+ __uint16_t kve_status;
+ int _kve_ispare[12];
+ char kve_path[PATH_MAX];
+};
+
typedef struct {
__uint32_t p_type;
__uint32_t p_offset;
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_freebsd.cc b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_freebsd.cc
index 157e3019e87..5011b1ff14b 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_freebsd.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_freebsd.cc
@@ -20,6 +20,14 @@
#include <sys/sysctl.h>
#include <sys/user.h>
+// Fix 'kinfo_vmentry' definition on FreeBSD prior v9.2 in 32-bit mode.
+#if SANITIZER_FREEBSD && (SANITIZER_WORDSIZE == 32)
+# include <osreldate.h>
+# if __FreeBSD_version <= 902001 // v9.2
+# define kinfo_vmentry xkinfo_vmentry
+# endif
+#endif
+
namespace __sanitizer {
void ReadProcMaps(ProcSelfMapsBuff *proc_maps) {
OpenPOWER on IntegriCloud