[compiler-rt] r270928 - Add portable macro in common header

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Thu May 26 15:15:16 PDT 2016


Author: davidxl
Date: Thu May 26 17:15:12 2016
New Revision: 270928

URL: http://llvm.org/viewvc/llvm-project?rev=270928&view=rev
Log:
Add portable macro in common header

Modified:
    compiler-rt/trunk/lib/profile/InstrProfilingPort.h
    compiler-rt/trunk/lib/profile/InstrProfilingValue.c

Modified: compiler-rt/trunk/lib/profile/InstrProfilingPort.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingPort.h?rev=270928&r1=270927&r2=270928&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingPort.h (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingPort.h Thu May 26 17:15:12 2016
@@ -22,7 +22,17 @@
 #define COMPILER_RT_ALLOCA __builtin_alloca
 #endif
 
+#if defined(__APPLE__)
+#define COMPILER_RT_SEG "__DATA,"
+#else
+#define COMPILER_RT_SEG ""
+#endif
+
+#ifdef _MSC_VER
+#define COMPILER_RT_SECTION(Sect) __declspec(allocate(Sect))
+#else
 #define COMPILER_RT_SECTION(Sect) __attribute__((section(Sect)))
+#endif
 
 #define COMPILER_RT_MAX_HOSTLEN 128
 #ifdef _MSC_VER

Modified: compiler-rt/trunk/lib/profile/InstrProfilingValue.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingValue.c?rev=270928&r1=270927&r2=270928&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingValue.c (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingValue.c Thu May 26 17:15:12 2016
@@ -26,16 +26,11 @@ static int hasNonDefaultValsPerSite = 0;
 #define INSTR_PROF_VNODE_POOL_SIZE 1024
 
 #ifndef _MSC_VER
-#if defined(__APPLE__)
-#define VPSEG "__DATA,"
-#else
-#define VPSEG ""
-#endif
 /* A shared static pool in addition to the vnodes statically
  * allocated by the compiler.  */
 COMPILER_RT_VISIBILITY ValueProfNode
     lprofValueProfNodes[INSTR_PROF_VNODE_POOL_SIZE] COMPILER_RT_SECTION(
-       VPSEG INSTR_PROF_VNODES_SECT_NAME_STR);
+       COMPILER_RT_SEG INSTR_PROF_VNODES_SECT_NAME_STR);
 #endif
 
 COMPILER_RT_VISIBILITY uint32_t VPMaxNumValsPerSite =




More information about the llvm-commits mailing list