1 /*===- InstrProfilingPlatformDarwin.c - Profile data on Darwin ------------===*\ 2 |* 3 |* The LLVM Compiler Infrastructure 4 |* 5 |* This file is distributed under the University of Illinois Open Source 6 |* License. See LICENSE.TXT for details. 7 |* 8 \*===----------------------------------------------------------------------===*/ 9 10 #include "InstrProfiling.h" 11 12 #if defined(__APPLE__) 13 /* Use linker magic to find the bounds of the Data section. */ 14 extern __llvm_profile_data DataStart __asm("section$start$__DATA$__llvm_prf_data"); 15 extern __llvm_profile_data DataEnd __asm("section$end$__DATA$__llvm_prf_data"); 16 extern char NamesStart __asm("section$start$__DATA$__llvm_prf_names"); 17 extern char NamesEnd __asm("section$end$__DATA$__llvm_prf_names"); 18 extern uint64_t CountersStart __asm("section$start$__DATA$__llvm_prf_cnts"); 19 extern uint64_t CountersEnd __asm("section$end$__DATA$__llvm_prf_cnts"); 20 21 const __llvm_profile_data *__llvm_profile_data_begin(void) { 22 return &DataStart; 23 } 24 const __llvm_profile_data *__llvm_profile_data_end(void) { 25 return &DataEnd; 26 } 27 const char *__llvm_profile_names_begin(void) { return &NamesStart; } 28 const char *__llvm_profile_names_end(void) { return &NamesEnd; } 29 uint64_t *__llvm_profile_counters_begin(void) { return &CountersStart; } 30 uint64_t *__llvm_profile_counters_end(void) { return &CountersEnd; } 31 #endif 32