summaryrefslogtreecommitdiff
path: root/lib/profile/GCDAProfiling.c
diff options
context:
space:
mode:
authorViktor Kutuzov <vkutuzov@accesssoftek.com>2014-03-10 16:50:53 +0000
committerViktor Kutuzov <vkutuzov@accesssoftek.com>2014-03-10 16:50:53 +0000
commitd80804396c20de6b01c00061e80e8803b841c5e5 (patch)
treeb41db509977d950a3599c8c434897a29e0da2d3c /lib/profile/GCDAProfiling.c
parent48e09bce1abd0224c1c4df8d17452a6051ff21f6 (diff)
downloadcompiler-rt-d80804396c20de6b01c00061e80e8803b841c5e5.tar.gz
A fix for platform-dependent types in sanitizers' profiling support lib on x64 FreeBSD in 32-bit mode
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@203470 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/profile/GCDAProfiling.c')
-rw-r--r--lib/profile/GCDAProfiling.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/profile/GCDAProfiling.c b/lib/profile/GCDAProfiling.c
index cf6372628..41b795c96 100644
--- a/lib/profile/GCDAProfiling.c
+++ b/lib/profile/GCDAProfiling.c
@@ -25,18 +25,33 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
#include <sys/mman.h>
-#include <sys/types.h>
#ifdef _WIN32
#include <direct.h>
#endif
-#ifndef _MSC_VER
+#define I386_FREEBSD (defined(__FreeBSD__) && defined(__i386__))
+
+#if !I386_FREEBSD
+#include <sys/stat.h>
+#include <sys/types.h>
+#endif
+
+#if !defined(_MSC_VER) && !I386_FREEBSD
#include <stdint.h>
-#else
+#endif
+
+#if defined(_MSC_VER)
typedef unsigned int uint32_t;
typedef unsigned int uint64_t;
+#elif I386_FREEBSD
+/* System headers define 'size_t' incorrectly on x64 FreeBSD (prior to
+ * FreeBSD 10, r232261) when compiled in 32-bit mode.
+ */
+typedef unsigned char uint8_t;
+typedef unsigned int uint32_t;
+typedef unsigned long long uint64_t;
+int mkdir(const char*, unsigned short);
#endif
/* #define DEBUG_GCDAPROFILING */