1 /*===- InstrProfilingPlatformDarwin.c - Profile data on Darwin ------------===*\
3 |* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 |* See https://llvm.org/LICENSE.txt for license information.
5 |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 \*===----------------------------------------------------------------------===*/
9 #include "InstrProfiling.h"
11 #if defined(__APPLE__)
12 /* Use linker magic to find the bounds of the Data section. */
13 COMPILER_RT_VISIBILITY
14 extern __llvm_profile_data
15 DataStart __asm("section$start$__DATA$" INSTR_PROF_DATA_SECT_NAME);
16 COMPILER_RT_VISIBILITY
17 extern __llvm_profile_data
18 DataEnd __asm("section$end$__DATA$" INSTR_PROF_DATA_SECT_NAME);
19 COMPILER_RT_VISIBILITY
21 NamesStart __asm("section$start$__DATA$" INSTR_PROF_NAME_SECT_NAME);
22 COMPILER_RT_VISIBILITY
23 extern char NamesEnd __asm("section$end$__DATA$" INSTR_PROF_NAME_SECT_NAME);
24 COMPILER_RT_VISIBILITY
26 CountersStart __asm("section$start$__DATA$" INSTR_PROF_CNTS_SECT_NAME);
27 COMPILER_RT_VISIBILITY
29 CountersEnd __asm("section$end$__DATA$" INSTR_PROF_CNTS_SECT_NAME);
30 COMPILER_RT_VISIBILITY
32 OrderFileStart __asm("section$start$__DATA$" INSTR_PROF_ORDERFILE_SECT_NAME);
34 COMPILER_RT_VISIBILITY
36 VNodesStart __asm("section$start$__DATA$" INSTR_PROF_VNODES_SECT_NAME);
37 COMPILER_RT_VISIBILITY
39 VNodesEnd __asm("section$end$__DATA$" INSTR_PROF_VNODES_SECT_NAME);
41 COMPILER_RT_VISIBILITY
42 const __llvm_profile_data *__llvm_profile_begin_data(void) {
45 COMPILER_RT_VISIBILITY
46 const __llvm_profile_data *__llvm_profile_end_data(void) { return &DataEnd; }
47 COMPILER_RT_VISIBILITY
48 const char *__llvm_profile_begin_names(void) { return &NamesStart; }
49 COMPILER_RT_VISIBILITY
50 const char *__llvm_profile_end_names(void) { return &NamesEnd; }
51 COMPILER_RT_VISIBILITY
52 uint64_t *__llvm_profile_begin_counters(void) { return &CountersStart; }
53 COMPILER_RT_VISIBILITY
54 uint64_t *__llvm_profile_end_counters(void) { return &CountersEnd; }
55 COMPILER_RT_VISIBILITY
56 uint32_t *__llvm_profile_begin_orderfile(void) { return &OrderFileStart; }
58 COMPILER_RT_VISIBILITY
59 ValueProfNode *__llvm_profile_begin_vnodes(void) {
62 COMPILER_RT_VISIBILITY
63 ValueProfNode *__llvm_profile_end_vnodes(void) { return &VNodesEnd; }
65 COMPILER_RT_VISIBILITY ValueProfNode *CurrentVNode = &VNodesStart;
66 COMPILER_RT_VISIBILITY ValueProfNode *EndVNode = &VNodesEnd;