summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2014-04-22 18:49:32 +0000
committerAlexey Samsonov <samsonov@google.com>2014-04-22 18:49:32 +0000
commitda2d42d0d39a7e45ddf4f0061d633cf8f83b86df (patch)
treebf195e9e4ef92bd755ef735fb4ec2222d77fc1f2
parent1079cb91e8e1ea4202a5aa990859fc49fc2338e1 (diff)
downloadcompiler-rt-da2d42d0d39a7e45ddf4f0061d633cf8f83b86df.tar.gz
[profile] Flatten profile runtime - define platform-specific code in sources, not in the build system
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@206915 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/profile/CMakeLists.txt25
-rw-r--r--lib/profile/InstrProfilingPlatformDarwin.c2
-rw-r--r--lib/profile/InstrProfilingPlatformOther.c3
3 files changed, 14 insertions, 16 deletions
diff --git a/lib/profile/CMakeLists.txt b/lib/profile/CMakeLists.txt
index 4165374fd..2255277ed 100644
--- a/lib/profile/CMakeLists.txt
+++ b/lib/profile/CMakeLists.txt
@@ -1,27 +1,20 @@
add_custom_target(profile)
-if(APPLE)
- set(PROFILE_SOURCES
- GCDAProfiling.c
- InstrProfiling.c
- InstrProfilingBuffer.c
- InstrProfilingFile.c
- InstrProfilingPlatformDarwin.c
- InstrProfilingRuntime.cc)
+set(PROFILE_SOURCES
+ GCDAProfiling.c
+ InstrProfiling.c
+ InstrProfilingBuffer.c
+ InstrProfilingFile.c
+ InstrProfilingPlatformDarwin.c
+ InstrProfilingPlatformOther.c
+ InstrProfilingRuntime.cc)
+if(APPLE)
add_compiler_rt_osx_static_runtime(clang_rt.profile_osx
ARCH ${PROFILE_SUPPORTED_ARCH}
SOURCES ${PROFILE_SOURCES})
add_dependencies(profile clang_rt.profile_osx)
else()
- set(PROFILE_SOURCES
- GCDAProfiling.c
- InstrProfiling.c
- InstrProfilingBuffer.c
- InstrProfilingFile.c
- InstrProfilingPlatformOther.c
- InstrProfilingRuntime.cc)
-
foreach(arch ${PROFILE_SUPPORTED_ARCH})
add_compiler_rt_runtime(clang_rt.profile-${arch} ${arch} STATIC
SOURCES ${PROFILE_SOURCES})
diff --git a/lib/profile/InstrProfilingPlatformDarwin.c b/lib/profile/InstrProfilingPlatformDarwin.c
index 1ba672d1e..6e34db612 100644
--- a/lib/profile/InstrProfilingPlatformDarwin.c
+++ b/lib/profile/InstrProfilingPlatformDarwin.c
@@ -9,6 +9,7 @@
#include "InstrProfiling.h"
+#if defined(__APPLE__)
/* Use linker magic to find the bounds of the Data section. */
extern __llvm_profile_data DataStart __asm("section$start$__DATA$__llvm_prf_data");
extern __llvm_profile_data DataEnd __asm("section$end$__DATA$__llvm_prf_data");
@@ -27,3 +28,4 @@ const char *__llvm_profile_names_begin(void) { return &NamesStart; }
const char *__llvm_profile_names_end(void) { return &NamesEnd; }
uint64_t *__llvm_profile_counters_begin(void) { return &CountersStart; }
uint64_t *__llvm_profile_counters_end(void) { return &CountersEnd; }
+#endif
diff --git a/lib/profile/InstrProfilingPlatformOther.c b/lib/profile/InstrProfilingPlatformOther.c
index 69b59254f..e5a5fc54a 100644
--- a/lib/profile/InstrProfilingPlatformOther.c
+++ b/lib/profile/InstrProfilingPlatformOther.c
@@ -8,6 +8,8 @@
\*===----------------------------------------------------------------------===*/
#include "InstrProfiling.h"
+
+#if !defined(__APPLE__)
#include <stdlib.h>
static const __llvm_profile_data *DataFirst = NULL;
@@ -62,3 +64,4 @@ const char *__llvm_profile_names_begin(void) { return NamesFirst; }
const char *__llvm_profile_names_end(void) { return NamesLast; }
uint64_t *__llvm_profile_counters_begin(void) { return CountersFirst; }
uint64_t *__llvm_profile_counters_end(void) { return CountersLast; }
+#endif