1 /*===- InstrProfilingPlatformLinux.c - Profile data Linux platform ------===*\ 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(__linux__) || defined(__FreeBSD__) 13 #include <stdlib.h> 14 15 extern __llvm_profile_data __start___llvm_prf_data 16 __attribute__((visibility("hidden"))); 17 extern __llvm_profile_data __stop___llvm_prf_data 18 __attribute__((visibility("hidden"))); 19 extern uint64_t __start___llvm_prf_cnts __attribute__((visibility("hidden"))); 20 extern uint64_t __stop___llvm_prf_cnts __attribute__((visibility("hidden"))); 21 extern char __start___llvm_prf_names __attribute__((visibility("hidden"))); 22 extern char __stop___llvm_prf_names __attribute__((visibility("hidden"))); 23 24 /* Add dummy data to ensure the section is always created. */ 25 __llvm_profile_data __llvm_prof_sect_data[0] 26 __attribute__((section("__llvm_prf_data"))); 27 uint64_t __llvm_prof_cnts_sect_data[0] 28 __attribute__((section("__llvm_prf_cnts"))); 29 char __llvm_prof_nms_sect_data[0] __attribute__((section("__llvm_prf_names"))); 30 31 __attribute__((visibility("hidden"))) const __llvm_profile_data * 32 __llvm_profile_begin_data(void) { 33 return &__start___llvm_prf_data; 34 } 35 __attribute__((visibility("hidden"))) const __llvm_profile_data * 36 __llvm_profile_end_data(void) { 37 return &__stop___llvm_prf_data; 38 } 39 __attribute__((visibility("hidden"))) const char *__llvm_profile_begin_names( 40 void) { 41 return &__start___llvm_prf_names; 42 } 43 __attribute__((visibility("hidden"))) const char *__llvm_profile_end_names( 44 void) { 45 return &__stop___llvm_prf_names; 46 } 47 __attribute__((visibility("hidden"))) uint64_t *__llvm_profile_begin_counters( 48 void) { 49 return &__start___llvm_prf_cnts; 50 } 51 __attribute__((visibility("hidden"))) uint64_t *__llvm_profile_end_counters( 52 void) { 53 return &__stop___llvm_prf_cnts; 54 } 55 #endif 56