Section header layouts for each extensible binary SectionLayout.
Declared in <llvm/ProfileData/SampleProfWriter.h>
std::array<SmallVector<SecHdrTableEntry, 8>, NumOfLayout> const ExtBinaryHdrLayoutTable = {
// DefaultLayout
SmallVector<SecHdrTableEntry, 8>({{SecProfSummary, 0, 0, 0, 0},
{SecNameTable, 0, 0, 0, 0},
{SecCSNameTable, 0, 0, 0, 0},
{SecFuncOffsetTable, 0, 0, 0, 0},
{SecLBRProfile, 0, 0, 0, 0},
{SecProfileSymbolList, 0, 0, 0, 0},
{SecFuncMetadata, 0, 0, 0, 0}}),
// CtxSplitLayout
SmallVector<SecHdrTableEntry, 8>(
{{SecProfSummary, 0, 0, 0, 0},
{SecNameTable, 0, 0, 0, 0},
// profile with inlined functions
// for next two sections
{SecFuncOffsetTable, 0, 0, 0, 0},
{SecLBRProfile, 0, 0, 0, 0},
// profile without inlined functions
// for next two sections
{SecFuncOffsetTable,
static_cast<uint64_t>(SecCommonFlags::SecFlagFlat), 0, 0, 0},
{SecLBRProfile, static_cast<uint64_t>(SecCommonFlags::SecFlagFlat),
0, 0, 0},
{SecProfileSymbolList, 0, 0, 0, 0},
{SecFuncMetadata, 0, 0, 0, 0}}),
};
Note that SecFuncOffsetTable section is written after SecLBRProfile in the profile, but is put before SecLBRProfile in SectionHdrLayout. This is because sample reader follows the order in SectionHdrLayout to read each section. To read function profiles on demand, sample reader need to get the offset of each function profile first.