summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/lib/profile/InstrProfilingPort.h5
-rw-r--r--compiler-rt/lib/profile/InstrProfilingWriter.c5
2 files changed, 3 insertions, 7 deletions
diff --git a/compiler-rt/lib/profile/InstrProfilingPort.h b/compiler-rt/lib/profile/InstrProfilingPort.h
index 0f826cbc9cd..9e3fb8389aa 100644
--- a/compiler-rt/lib/profile/InstrProfilingPort.h
+++ b/compiler-rt/lib/profile/InstrProfilingPort.h
@@ -14,10 +14,12 @@
#define COMPILER_RT_ALIGNAS(x) __declspec(align(x))
#define COMPILER_RT_VISIBILITY
#define COMPILER_RT_WEAK __declspec(selectany)
+#define COMPILER_RT_ALLOCA _alloca
#elif __GNUC__
#define COMPILER_RT_ALIGNAS(x) __attribute__((aligned(x)))
#define COMPILER_RT_VISIBILITY __attribute__((visibility("hidden")))
#define COMPILER_RT_WEAK __attribute__((weak))
+#define COMPILER_RT_ALLOCA __builtin_alloca
#endif
#define COMPILER_RT_SECTION(Sect) __attribute__((section(Sect)))
@@ -25,14 +27,11 @@
#define COMPILER_RT_MAX_HOSTLEN 128
#ifdef _MSC_VER
#define COMPILER_RT_GETHOSTNAME(Name, Len) gethostname(Name, Len)
-#define COMPILER_RT_ALLOCA _alloca
#elif defined(__PS4__)
#define COMPILER_RT_GETHOSTNAME(Name, Len) (-1)
-#define COMPILER_RT_ALLOCA alloca
#else
#define COMPILER_RT_GETHOSTNAME(Name, Len) lprofGetHostName(Name, Len)
#define COMPILER_RT_HAS_UNAME 1
-#define COMPILER_RT_ALLOCA alloca
#endif
#if COMPILER_RT_HAS_ATOMICS == 1
diff --git a/compiler-rt/lib/profile/InstrProfilingWriter.c b/compiler-rt/lib/profile/InstrProfilingWriter.c
index da0b58df082..3e90b1d496a 100644
--- a/compiler-rt/lib/profile/InstrProfilingWriter.c
+++ b/compiler-rt/lib/profile/InstrProfilingWriter.c
@@ -10,11 +10,8 @@
#include "InstrProfiling.h"
#include "InstrProfilingInternal.h"
#ifdef _MSC_VER
+/* For _alloca */
#include <malloc.h>
-#elif defined(__FreeBSD__)
-#include <stdlib.h>
-#else
-#include <alloca.h>
#endif
#include <string.h>
OpenPOWER on IntegriCloud