[compiler-rt] 879c1db - [Compiler-RT] Fix profiler building with MinGW GCC

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 00:23:42 PDT 2020


Author: Mateusz Mikuła
Date: 2020-08-25T10:22:53+03:00
New Revision: 879c1db5d24dcb0ac03f9f6282a09996ff3dc291

URL: https://github.com/llvm/llvm-project/commit/879c1db5d24dcb0ac03f9f6282a09996ff3dc291
DIFF: https://github.com/llvm/llvm-project/commit/879c1db5d24dcb0ac03f9f6282a09996ff3dc291.diff

LOG: [Compiler-RT] Fix profiler building with MinGW GCC

Differential Revision: https://reviews.llvm.org/D86405

Added: 
    

Modified: 
    compiler-rt/lib/profile/InstrProfilingPort.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/profile/InstrProfilingPort.h b/compiler-rt/lib/profile/InstrProfilingPort.h
index 4493dd512ff0..cb66c5964ad1 100644
--- a/compiler-rt/lib/profile/InstrProfilingPort.h
+++ b/compiler-rt/lib/profile/InstrProfilingPort.h
@@ -24,11 +24,17 @@
 #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


        


More information about the llvm-commits mailing list