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 /* Use linker magic to find the bounds of the Data section. */
13 extern __llvm_profile_data DataStart __asm("section$start$__DATA$__llvm_prf_data");
14 extern __llvm_profile_data DataEnd   __asm("section$end$__DATA$__llvm_prf_data");
15 extern char NamesStart __asm("section$start$__DATA$__llvm_prf_names");
16 extern char NamesEnd   __asm("section$end$__DATA$__llvm_prf_names");
17 extern uint64_t CountersStart __asm("section$start$__DATA$__llvm_prf_cnts");
18 extern uint64_t CountersEnd   __asm("section$end$__DATA$__llvm_prf_cnts");
19 
20 const __llvm_profile_data *__llvm_profile_data_begin(void) {
21   return &DataStart;
22 }
23 const __llvm_profile_data *__llvm_profile_data_end(void) {
24   return &DataEnd;
25 }
26 const char *__llvm_profile_names_begin(void) { return &NamesStart; }
27 const char *__llvm_profile_names_end(void) { return &NamesEnd; }
28 uint64_t *__llvm_profile_counters_begin(void) { return &CountersStart; }
29 uint64_t *__llvm_profile_counters_end(void) { return &CountersEnd; }
30