diff --git a/compiler-rt/lib/profile/InstrProfilingPort.h b/compiler-rt/lib/profile/InstrProfilingPort.h --- a/compiler-rt/lib/profile/InstrProfilingPort.h +++ b/compiler-rt/lib/profile/InstrProfilingPort.h @@ -13,22 +13,28 @@ #define PROFILE_INSTRPROFILING_PORT_H_ #ifdef _MSC_VER -#define COMPILER_RT_ALIGNAS(x) __declspec(align(x)) +#define COMPILER_RT_FTRUNCATE(f, l) _chsize(_fileno(f), l) #define COMPILER_RT_VISIBILITY /* FIXME: selectany does not have the same semantics as weak. */ #define COMPILER_RT_WEAK __declspec(selectany) +#define COMPILER_RT_ALIGNAS(x) __declspec(align(x)) /* Need to include */ #define COMPILER_RT_ALLOCA _alloca /* Need to include and */ -#define COMPILER_RT_FTRUNCATE(f,l) _chsize(_fileno(f),l) #define COMPILER_RT_ALWAYS_INLINE __forceinline #define COMPILER_RT_CLEANUP(x) #elif __GNUC__ -#define COMPILER_RT_ALIGNAS(x) __attribute__((aligned(x))) +#ifdef _WIN32 +#define COMPILER_RT_FTRUNCATE(f, l) _chsize(fileno(f), l) +#define COMPILER_RT_VISIBILITY +#define COMPILER_RT_WEAK __attribute__((selectany)) +#else +#define COMPILER_RT_FTRUNCATE(f, l) ftruncate(fileno(f), l) #define COMPILER_RT_VISIBILITY __attribute__((visibility("hidden"))) #define COMPILER_RT_WEAK __attribute__((weak)) +#endif +#define COMPILER_RT_ALIGNAS(x) __attribute__((aligned(x))) #define COMPILER_RT_ALLOCA __builtin_alloca -#define COMPILER_RT_FTRUNCATE(f,l) ftruncate(fileno(f),l) #define COMPILER_RT_ALWAYS_INLINE inline __attribute((always_inline)) #define COMPILER_RT_CLEANUP(x) __attribute__((cleanup(x))) #endif