blob: 30ddbd2e4982af2f2deaa503271e22ec6ab7a140 [file] [log] [blame]
Stephen Hines2d1fdb22014-05-28 23:58:16 -07001/*===- 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. */
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -080014COMPILER_RT_VISIBILITY
15extern __llvm_profile_data
16 DataStart __asm("section$start$__DATA$" INSTR_PROF_DATA_SECT_NAME_STR);
17COMPILER_RT_VISIBILITY
18extern __llvm_profile_data
19 DataEnd __asm("section$end$__DATA$" INSTR_PROF_DATA_SECT_NAME_STR);
20COMPILER_RT_VISIBILITY
21extern char
22 NamesStart __asm("section$start$__DATA$" INSTR_PROF_NAME_SECT_NAME_STR);
23COMPILER_RT_VISIBILITY
24extern char NamesEnd __asm("section$end$__DATA$" INSTR_PROF_NAME_SECT_NAME_STR);
25COMPILER_RT_VISIBILITY
26extern uint64_t
27 CountersStart __asm("section$start$__DATA$" INSTR_PROF_CNTS_SECT_NAME_STR);
28COMPILER_RT_VISIBILITY
29extern uint64_t
30 CountersEnd __asm("section$end$__DATA$" INSTR_PROF_CNTS_SECT_NAME_STR);
Stephen Hines2d1fdb22014-05-28 23:58:16 -070031
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -080032COMPILER_RT_VISIBILITY
Stephen Hines6d186232014-11-26 17:56:19 -080033const __llvm_profile_data *__llvm_profile_begin_data(void) {
Stephen Hines2d1fdb22014-05-28 23:58:16 -070034 return &DataStart;
35}
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -080036COMPILER_RT_VISIBILITY
37const __llvm_profile_data *__llvm_profile_end_data(void) { return &DataEnd; }
38COMPILER_RT_VISIBILITY
Stephen Hines6d186232014-11-26 17:56:19 -080039const char *__llvm_profile_begin_names(void) { return &NamesStart; }
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -080040COMPILER_RT_VISIBILITY
Stephen Hines6d186232014-11-26 17:56:19 -080041const char *__llvm_profile_end_names(void) { return &NamesEnd; }
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -080042COMPILER_RT_VISIBILITY
Stephen Hines6d186232014-11-26 17:56:19 -080043uint64_t *__llvm_profile_begin_counters(void) { return &CountersStart; }
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -080044COMPILER_RT_VISIBILITY
Stephen Hines6d186232014-11-26 17:56:19 -080045uint64_t *__llvm_profile_end_counters(void) { return &CountersEnd; }
Stephen Hines2d1fdb22014-05-28 23:58:16 -070046#endif