blob: 02299cc4630c04c20f013284c87dd51deff79db1 [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. */
14__attribute__((visibility("hidden")))
15extern __llvm_profile_data DataStart __asm("section$start$__DATA$__llvm_prf_data");
16__attribute__((visibility("hidden")))
17extern __llvm_profile_data DataEnd __asm("section$end$__DATA$__llvm_prf_data");
18__attribute__((visibility("hidden")))
19extern char NamesStart __asm("section$start$__DATA$__llvm_prf_names");
20__attribute__((visibility("hidden")))
21extern char NamesEnd __asm("section$end$__DATA$__llvm_prf_names");
22__attribute__((visibility("hidden")))
23extern uint64_t CountersStart __asm("section$start$__DATA$__llvm_prf_cnts");
24__attribute__((visibility("hidden")))
25extern uint64_t CountersEnd __asm("section$end$__DATA$__llvm_prf_cnts");
26
27__attribute__((visibility("hidden")))
Stephen Hines6d186232014-11-26 17:56:19 -080028const __llvm_profile_data *__llvm_profile_begin_data(void) {
Stephen Hines2d1fdb22014-05-28 23:58:16 -070029 return &DataStart;
30}
31__attribute__((visibility("hidden")))
Stephen Hines6d186232014-11-26 17:56:19 -080032const __llvm_profile_data *__llvm_profile_end_data(void) {
Stephen Hines2d1fdb22014-05-28 23:58:16 -070033 return &DataEnd;
34}
35__attribute__((visibility("hidden")))
Stephen Hines6d186232014-11-26 17:56:19 -080036const char *__llvm_profile_begin_names(void) { return &NamesStart; }
Stephen Hines2d1fdb22014-05-28 23:58:16 -070037__attribute__((visibility("hidden")))
Stephen Hines6d186232014-11-26 17:56:19 -080038const char *__llvm_profile_end_names(void) { return &NamesEnd; }
Stephen Hines2d1fdb22014-05-28 23:58:16 -070039__attribute__((visibility("hidden")))
Stephen Hines6d186232014-11-26 17:56:19 -080040uint64_t *__llvm_profile_begin_counters(void) { return &CountersStart; }
Stephen Hines2d1fdb22014-05-28 23:58:16 -070041__attribute__((visibility("hidden")))
Stephen Hines6d186232014-11-26 17:56:19 -080042uint64_t *__llvm_profile_end_counters(void) { return &CountersEnd; }
Stephen Hines2d1fdb22014-05-28 23:58:16 -070043#endif