Skip to content

Commit c4d340b

Browse files
mati865cuviper
authored andcommitted
Fix profiler building with MinGW GCC (llvm#72)
Differential Revision: https://reviews.llvm.org/D86405
1 parent 2e65486 commit c4d340b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: compiler-rt/lib/profile/InstrProfilingPort.h

+8-2
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,17 @@
2424
#define COMPILER_RT_ALWAYS_INLINE __forceinline
2525
#define COMPILER_RT_CLEANUP(x)
2626
#elif __GNUC__
27-
#define COMPILER_RT_ALIGNAS(x) __attribute__((aligned(x)))
27+
#ifdef _WIN32
28+
#define COMPILER_RT_FTRUNCATE(f, l) _chsize(fileno(f), l)
29+
#define COMPILER_RT_VISIBILITY
30+
#define COMPILER_RT_WEAK __attribute__((selectany))
31+
#else
32+
#define COMPILER_RT_FTRUNCATE(f, l) ftruncate(fileno(f), l)
2833
#define COMPILER_RT_VISIBILITY __attribute__((visibility("hidden")))
2934
#define COMPILER_RT_WEAK __attribute__((weak))
35+
#endif
36+
#define COMPILER_RT_ALIGNAS(x) __attribute__((aligned(x)))
3037
#define COMPILER_RT_ALLOCA __builtin_alloca
31-
#define COMPILER_RT_FTRUNCATE(f,l) ftruncate(fileno(f),l)
3238
#define COMPILER_RT_ALWAYS_INLINE inline __attribute((always_inline))
3339
#define COMPILER_RT_CLEANUP(x) __attribute__((cleanup(x)))
3440
#endif

0 commit comments

Comments
 (0)