@@ -68,6 +68,8 @@ using namespace llvm;
6868namespace {
6969namespace stats {
7070
71+ STATISTIC (ELFHeaderBytes, " Total size of ELF headers" );
72+ STATISTIC (SectionHeaderBytes, " Total size of section headers table" );
7173STATISTIC (AllocTextBytes, " Total size of SHF_ALLOC text sections" );
7274STATISTIC (AllocROBytes, " Total size of SHF_ALLOC readonly sections" );
7375STATISTIC (AllocRWBytes, " Total size of SHF_ALLOC read-write sections" );
@@ -945,6 +947,7 @@ void ELFWriter::writeSectionHeader(uint32_t GroupSymbolIndex, uint64_t Offset,
945947}
946948
947949void ELFWriter::writeSectionHeaders (const MCAssembler &Asm) {
950+ uint64_t Start = W.OS .tell ();
948951 const unsigned NumSections = SectionTable.size ();
949952
950953 // Null section first.
@@ -1008,6 +1011,8 @@ void ELFWriter::writeSectionHeaders(const MCAssembler &Asm) {
10081011
10091012 writeSectionHeader (GroupSymbolIndex, Offsets.first , Size, *Section);
10101013 }
1014+
1015+ stats::SectionHeaderBytes += W.OS .tell () - Start;
10111016}
10121017
10131018uint64_t ELFWriter::writeObject (MCAssembler &Asm) {
@@ -1023,6 +1028,8 @@ uint64_t ELFWriter::writeObject(MCAssembler &Asm) {
10231028 // Write out the ELF header ...
10241029 writeHeader (Asm);
10251030
1031+ stats::ELFHeaderBytes += W.OS .tell () - StartOffset;
1032+
10261033 // ... then the sections ...
10271034 SmallVector<std::pair<MCSectionELF *, SmallVector<unsigned >>, 0 > Groups;
10281035 // Map from group section index to group
0 commit comments