[PATCH] A fix for platform-dependent types in sanitizers' profiling support lib on x64 FreeBSD in 32-bit mode
Ivan A. Kosarev
ivan at ivan-labs.com
Fri Feb 28 03:23:21 PST 2014
Hello Justin,
Just updated the patch:
http://llvm-reviews.chandlerc.com/D2866
Thanks.
On 02/27/2014 01:24 AM, Justin Bogner wrote:
> Viktor Kutuzov <vkutuzov at accesssoftek.com> writes:
>> Index: lib/profile/GCDAProfiling.c
>> ===================================================================
>> --- lib/profile/GCDAProfiling.c
>> +++ lib/profile/GCDAProfiling.c
>> @@ -25,18 +25,25 @@
>> #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
>> -#include <stdint.h>
>> -#else
>> +#if defined(_MSC_VER)
>> typedef unsigned int uint32_t;
>> typedef unsigned int uint64_t;
>> +#elif defined(__FreeBSD__) && defined(__i386__)
>> +// 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);
>> +#else
>> +#include <stdint.h>
>> +#include <sys/stat.h>
>> +#include <sys/types.h>
>> #endif
> Are sys/stat.h and stdint.h not used for some reason in the _MSC_VER
> case? This looks like a behaviour change that probably breaks windows.
>
>> /* #define DEBUG_GCDAPROFILING */
>> Index: lib/profile/PGOProfiling.c
>> ===================================================================
>> --- lib/profile/PGOProfiling.c
>> +++ lib/profile/PGOProfiling.c
>> @@ -7,15 +7,22 @@
>> |*
>> \*===----------------------------------------------------------------------===*/
>>
>> -#include <inttypes.h>
>> #include <stdio.h>
>> #include <stdlib.h>
>>
>> -#ifndef _MSC_VER
>> -#include <stdint.h>
>> -#else
>> +#if defined(_MSC_VER)
>> +#include <inttypes.h>
>> typedef unsigned int uint32_t;
>> typedef unsigned int uint64_t;
>> +#elif defined(__FreeBSD__) && defined(__i386__)
>> +// 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;
>> +#else
>> +#include <inttypes.h>
>> +#include <stdint.h>
>> #endif
> Duplicating the include of inttypes in _MSC_VER and in the else seems
> fairly awkward here.
>
> Overall, this approach really doesn't seem scalable at all, and it will
> be very difficult for people adding things in this area to get it right
> without submitting to buildbots.
>
>>
>> static FILE *OutputFile = NULL;
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
--
More information about the llvm-commits
mailing list