104 lines · c
1/*===- InstrProfilingPlatformDarwin.c - Profile data on Darwin ------------===*\2|*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-exception6|*7\*===----------------------------------------------------------------------===*/8 9// Note: This is linked into the Darwin kernel, and must remain compatible10// with freestanding compilation. See `darwin_add_builtin_libraries`.11 12#include "InstrProfiling.h"13#include "InstrProfilingInternal.h"14 15#if defined(__APPLE__)16/* Use linker magic to find the bounds of the Data section. */17COMPILER_RT_VISIBILITY18extern __llvm_profile_data19 DataStart __asm("section$start$__DATA$" INSTR_PROF_DATA_SECT_NAME);20COMPILER_RT_VISIBILITY21extern __llvm_profile_data22 DataEnd __asm("section$end$__DATA$" INSTR_PROF_DATA_SECT_NAME);23COMPILER_RT_VISIBILITY24extern char25 NamesStart __asm("section$start$__DATA$" INSTR_PROF_NAME_SECT_NAME);26COMPILER_RT_VISIBILITY27extern char NamesEnd __asm("section$end$__DATA$" INSTR_PROF_NAME_SECT_NAME);28COMPILER_RT_VISIBILITY29extern char30 CountersStart __asm("section$start$__DATA$" INSTR_PROF_CNTS_SECT_NAME);31COMPILER_RT_VISIBILITY32extern char CountersEnd __asm("section$end$__DATA$" INSTR_PROF_CNTS_SECT_NAME);33COMPILER_RT_VISIBILITY34extern char35 BitmapStart __asm("section$start$__DATA$" INSTR_PROF_BITS_SECT_NAME);36COMPILER_RT_VISIBILITY37extern char BitmapEnd __asm("section$end$__DATA$" INSTR_PROF_BITS_SECT_NAME);38COMPILER_RT_VISIBILITY39extern VTableProfData40 VTableProfStart __asm("section$start$__DATA$" INSTR_PROF_VTAB_SECT_NAME);41COMPILER_RT_VISIBILITY42extern VTableProfData43 VTableProfEnd __asm("section$end$__DATA$" INSTR_PROF_VTAB_SECT_NAME);44COMPILER_RT_VISIBILITY45extern char46 VNameStart __asm("section$start$__DATA$" INSTR_PROF_VNAME_SECT_NAME);47COMPILER_RT_VISIBILITY48extern char VNameEnd __asm("section$end$__DATA$" INSTR_PROF_VNAME_SECT_NAME);49COMPILER_RT_VISIBILITY50 51COMPILER_RT_VISIBILITY52extern ValueProfNode53 VNodesStart __asm("section$start$__DATA$" INSTR_PROF_VNODES_SECT_NAME);54COMPILER_RT_VISIBILITY55extern ValueProfNode56 VNodesEnd __asm("section$end$__DATA$" INSTR_PROF_VNODES_SECT_NAME);57 58COMPILER_RT_VISIBILITY59const __llvm_profile_data *__llvm_profile_begin_data(void) {60 return &DataStart;61}62COMPILER_RT_VISIBILITY63const __llvm_profile_data *__llvm_profile_end_data(void) { return &DataEnd; }64COMPILER_RT_VISIBILITY65const char *__llvm_profile_begin_names(void) { return &NamesStart; }66COMPILER_RT_VISIBILITY67const char *__llvm_profile_end_names(void) { return &NamesEnd; }68COMPILER_RT_VISIBILITY69char *__llvm_profile_begin_counters(void) { return &CountersStart; }70COMPILER_RT_VISIBILITY71char *__llvm_profile_end_counters(void) { return &CountersEnd; }72COMPILER_RT_VISIBILITY73char *__llvm_profile_begin_bitmap(void) { return &BitmapStart; }74COMPILER_RT_VISIBILITY75char *__llvm_profile_end_bitmap(void) { return &BitmapEnd; }76COMPILER_RT_VISIBILITY77const VTableProfData *__llvm_profile_begin_vtables(void) {78 return &VTableProfStart;79}80COMPILER_RT_VISIBILITY81const VTableProfData *__llvm_profile_end_vtables(void) {82 return &VTableProfEnd;83}84COMPILER_RT_VISIBILITY85const char *__llvm_profile_begin_vtabnames(void) { return &VNameStart; }86COMPILER_RT_VISIBILITY87const char *__llvm_profile_end_vtabnames(void) { return &VNameEnd; }88 89COMPILER_RT_VISIBILITY90ValueProfNode *__llvm_profile_begin_vnodes(void) {91 return &VNodesStart;92}93COMPILER_RT_VISIBILITY94ValueProfNode *__llvm_profile_end_vnodes(void) { return &VNodesEnd; }95 96COMPILER_RT_VISIBILITY ValueProfNode *CurrentVNode = &VNodesStart;97COMPILER_RT_VISIBILITY ValueProfNode *EndVNode = &VNodesEnd;98 99COMPILER_RT_VISIBILITY int __llvm_write_binary_ids(ProfDataWriter *Writer) {100 return 0;101}102 103#endif104