Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 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 | __attribute__((visibility("hidden"))) |
| 15 | extern __llvm_profile_data DataStart __asm("section$start$__DATA$__llvm_prf_data"); |
| 16 | __attribute__((visibility("hidden"))) |
| 17 | extern __llvm_profile_data DataEnd __asm("section$end$__DATA$__llvm_prf_data"); |
| 18 | __attribute__((visibility("hidden"))) |
| 19 | extern char NamesStart __asm("section$start$__DATA$__llvm_prf_names"); |
| 20 | __attribute__((visibility("hidden"))) |
| 21 | extern char NamesEnd __asm("section$end$__DATA$__llvm_prf_names"); |
| 22 | __attribute__((visibility("hidden"))) |
| 23 | extern uint64_t CountersStart __asm("section$start$__DATA$__llvm_prf_cnts"); |
| 24 | __attribute__((visibility("hidden"))) |
| 25 | extern uint64_t CountersEnd __asm("section$end$__DATA$__llvm_prf_cnts"); |
| 26 | |
| 27 | __attribute__((visibility("hidden"))) |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 28 | const __llvm_profile_data *__llvm_profile_begin_data(void) { |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 29 | return &DataStart; |
| 30 | } |
| 31 | __attribute__((visibility("hidden"))) |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 32 | const __llvm_profile_data *__llvm_profile_end_data(void) { |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 33 | return &DataEnd; |
| 34 | } |
| 35 | __attribute__((visibility("hidden"))) |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 36 | const char *__llvm_profile_begin_names(void) { return &NamesStart; } |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 37 | __attribute__((visibility("hidden"))) |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 38 | const char *__llvm_profile_end_names(void) { return &NamesEnd; } |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 39 | __attribute__((visibility("hidden"))) |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 40 | uint64_t *__llvm_profile_begin_counters(void) { return &CountersStart; } |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 41 | __attribute__((visibility("hidden"))) |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 42 | uint64_t *__llvm_profile_end_counters(void) { return &CountersEnd; } |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 43 | #endif |