diff --git a/compiler-rt/lib/profile/CMakeLists.txt b/compiler-rt/lib/profile/CMakeLists.txt index 4165374fd7c1..2255277ed1d9 100644 --- a/compiler-rt/lib/profile/CMakeLists.txt +++ b/compiler-rt/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/compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c b/compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c index 1ba672d1ea5a..6e34db6121e1 100644 --- a/compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c +++ b/compiler-rt/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/compiler-rt/lib/profile/InstrProfilingPlatformOther.c b/compiler-rt/lib/profile/InstrProfilingPlatformOther.c index 69b59254f58e..e5a5fc54a142 100644 --- a/compiler-rt/lib/profile/InstrProfilingPlatformOther.c +++ b/compiler-rt/lib/profile/InstrProfilingPlatformOther.c @@ -8,6 +8,8 @@ \*===----------------------------------------------------------------------===*/ #include "InstrProfiling.h" + +#if !defined(__APPLE__) #include 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