[profile] Flatten profile runtime - define platform-specific code in sources, not in the build system

llvm-svn: 206915
This commit is contained in:
Alexey Samsonov 2014-04-22 18:49:32 +00:00
parent 6a9cf2629a
commit 01be4280be
3 changed files with 14 additions and 16 deletions

View File

@ -1,27 +1,20 @@
add_custom_target(profile)
if(APPLE)
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})

View File

@ -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

View File

@ -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