Path: blob/main/contrib/llvm-project/compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c
35233 views
/*===- InstrProfilingPlatformDarwin.c - Profile data on Darwin ------------===*\1|*2|* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3|* See https://llvm.org/LICENSE.txt for license information.4|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5|*6\*===----------------------------------------------------------------------===*/78// Note: This is linked into the Darwin kernel, and must remain compatible9// with freestanding compilation. See `darwin_add_builtin_libraries`.1011#include "InstrProfiling.h"12#include "InstrProfilingInternal.h"1314#if defined(__APPLE__)15/* Use linker magic to find the bounds of the Data section. */16COMPILER_RT_VISIBILITY17extern __llvm_profile_data18DataStart __asm("section$start$__DATA$" INSTR_PROF_DATA_SECT_NAME);19COMPILER_RT_VISIBILITY20extern __llvm_profile_data21DataEnd __asm("section$end$__DATA$" INSTR_PROF_DATA_SECT_NAME);22COMPILER_RT_VISIBILITY23extern char24NamesStart __asm("section$start$__DATA$" INSTR_PROF_NAME_SECT_NAME);25COMPILER_RT_VISIBILITY26extern char NamesEnd __asm("section$end$__DATA$" INSTR_PROF_NAME_SECT_NAME);27COMPILER_RT_VISIBILITY28extern char29CountersStart __asm("section$start$__DATA$" INSTR_PROF_CNTS_SECT_NAME);30COMPILER_RT_VISIBILITY31extern char CountersEnd __asm("section$end$__DATA$" INSTR_PROF_CNTS_SECT_NAME);32COMPILER_RT_VISIBILITY33extern char34BitmapStart __asm("section$start$__DATA$" INSTR_PROF_BITS_SECT_NAME);35COMPILER_RT_VISIBILITY36extern char BitmapEnd __asm("section$end$__DATA$" INSTR_PROF_BITS_SECT_NAME);37COMPILER_RT_VISIBILITY38extern VTableProfData39VTableProfStart __asm("section$start$__DATA$" INSTR_PROF_VTAB_SECT_NAME);40COMPILER_RT_VISIBILITY41extern VTableProfData42VTableProfEnd __asm("section$end$__DATA$" INSTR_PROF_VTAB_SECT_NAME);43COMPILER_RT_VISIBILITY44extern char45VNameStart __asm("section$start$__DATA$" INSTR_PROF_VNAME_SECT_NAME);46COMPILER_RT_VISIBILITY47extern char VNameEnd __asm("section$end$__DATA$" INSTR_PROF_VNAME_SECT_NAME);48COMPILER_RT_VISIBILITY49extern uint32_t50OrderFileStart __asm("section$start$__DATA$" INSTR_PROF_ORDERFILE_SECT_NAME);5152COMPILER_RT_VISIBILITY53extern ValueProfNode54VNodesStart __asm("section$start$__DATA$" INSTR_PROF_VNODES_SECT_NAME);55COMPILER_RT_VISIBILITY56extern ValueProfNode57VNodesEnd __asm("section$end$__DATA$" INSTR_PROF_VNODES_SECT_NAME);5859COMPILER_RT_VISIBILITY60const __llvm_profile_data *__llvm_profile_begin_data(void) {61return &DataStart;62}63COMPILER_RT_VISIBILITY64const __llvm_profile_data *__llvm_profile_end_data(void) { return &DataEnd; }65COMPILER_RT_VISIBILITY66const char *__llvm_profile_begin_names(void) { return &NamesStart; }67COMPILER_RT_VISIBILITY68const char *__llvm_profile_end_names(void) { return &NamesEnd; }69COMPILER_RT_VISIBILITY70char *__llvm_profile_begin_counters(void) { return &CountersStart; }71COMPILER_RT_VISIBILITY72char *__llvm_profile_end_counters(void) { return &CountersEnd; }73COMPILER_RT_VISIBILITY74char *__llvm_profile_begin_bitmap(void) { return &BitmapStart; }75COMPILER_RT_VISIBILITY76char *__llvm_profile_end_bitmap(void) { return &BitmapEnd; }77COMPILER_RT_VISIBILITY78const VTableProfData *__llvm_profile_begin_vtables(void) {79return &VTableProfStart;80}81COMPILER_RT_VISIBILITY82const VTableProfData *__llvm_profile_end_vtables(void) {83return &VTableProfEnd;84}85COMPILER_RT_VISIBILITY86const char *__llvm_profile_begin_vtabnames(void) { return &VNameStart; }87COMPILER_RT_VISIBILITY88const char *__llvm_profile_end_vtabnames(void) { return &VNameEnd; }89COMPILER_RT_VISIBILITY90uint32_t *__llvm_profile_begin_orderfile(void) { return &OrderFileStart; }9192COMPILER_RT_VISIBILITY93ValueProfNode *__llvm_profile_begin_vnodes(void) {94return &VNodesStart;95}96COMPILER_RT_VISIBILITY97ValueProfNode *__llvm_profile_end_vnodes(void) { return &VNodesEnd; }9899COMPILER_RT_VISIBILITY ValueProfNode *CurrentVNode = &VNodesStart;100COMPILER_RT_VISIBILITY ValueProfNode *EndVNode = &VNodesEnd;101102COMPILER_RT_VISIBILITY int __llvm_write_binary_ids(ProfDataWriter *Writer) {103return 0;104}105106#endif107108109