diff options
author | Viktor Kutuzov <vkutuzov@accesssoftek.com> | 2014-03-10 16:50:53 +0000 |
---|---|---|
committer | Viktor Kutuzov <vkutuzov@accesssoftek.com> | 2014-03-10 16:50:53 +0000 |
commit | f31e53661f1f23bdfe22122c20e6c16fd27fba73 (patch) | |
tree | ec846a7d8cec5a49cddbb9012eabb1de252e8f8d | |
parent | 96b7402bac1ebdccad4f608dc210ae908d010c81 (diff) | |
download | bcm5719-llvm-f31e53661f1f23bdfe22122c20e6c16fd27fba73.tar.gz bcm5719-llvm-f31e53661f1f23bdfe22122c20e6c16fd27fba73.zip |
A fix for platform-dependent types in sanitizers' profiling support lib on x64 FreeBSD in 32-bit mode
llvm-svn: 203470
-rw-r--r-- | compiler-rt/lib/profile/GCDAProfiling.c | 23 | ||||
-rw-r--r-- | compiler-rt/lib/profile/PGOProfiling.c | 20 |
2 files changed, 36 insertions, 7 deletions
diff --git a/compiler-rt/lib/profile/GCDAProfiling.c b/compiler-rt/lib/profile/GCDAProfiling.c index cf6372628d7..41b795c9617 100644 --- a/compiler-rt/lib/profile/GCDAProfiling.c +++ b/compiler-rt/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 */ diff --git a/compiler-rt/lib/profile/PGOProfiling.c b/compiler-rt/lib/profile/PGOProfiling.c index d82ac315c25..986fd8459b2 100644 --- a/compiler-rt/lib/profile/PGOProfiling.c +++ b/compiler-rt/lib/profile/PGOProfiling.c @@ -7,15 +7,29 @@ |* \*===----------------------------------------------------------------------===*/ -#include <inttypes.h> #include <stdio.h> #include <stdlib.h> -#ifndef _MSC_VER +#define I386_FREEBSD (defined(__FreeBSD__) && defined(__i386__)) + +#if !I386_FREEBSD +#include <inttypes.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. + */ +#define PRIu64 "llu" +typedef unsigned int uint32_t; +typedef unsigned long long uint64_t; #endif static FILE *OutputFile = NULL; |