@@ -68,6 +68,8 @@ using namespace llvm;
68
68
namespace {
69
69
namespace stats {
70
70
71
+ STATISTIC (ELFHeaderBytes, " Total size of ELF headers" );
72
+ STATISTIC (SectionHeaderBytes, " Total size of section headers table" );
71
73
STATISTIC (AllocTextBytes, " Total size of SHF_ALLOC text sections" );
72
74
STATISTIC (AllocROBytes, " Total size of SHF_ALLOC readonly sections" );
73
75
STATISTIC (AllocRWBytes, " Total size of SHF_ALLOC read-write sections" );
@@ -945,6 +947,7 @@ void ELFWriter::writeSectionHeader(uint32_t GroupSymbolIndex, uint64_t Offset,
945
947
}
946
948
947
949
void ELFWriter::writeSectionHeaders (const MCAssembler &Asm) {
950
+ uint64_t Start = W.OS .tell ();
948
951
const unsigned NumSections = SectionTable.size ();
949
952
950
953
// Null section first.
@@ -1008,6 +1011,8 @@ void ELFWriter::writeSectionHeaders(const MCAssembler &Asm) {
1008
1011
1009
1012
writeSectionHeader (GroupSymbolIndex, Offsets.first , Size, *Section);
1010
1013
}
1014
+
1015
+ stats::SectionHeaderBytes += W.OS .tell () - Start;
1011
1016
}
1012
1017
1013
1018
uint64_t ELFWriter::writeObject (MCAssembler &Asm) {
@@ -1023,6 +1028,8 @@ uint64_t ELFWriter::writeObject(MCAssembler &Asm) {
1023
1028
// Write out the ELF header ...
1024
1029
writeHeader (Asm);
1025
1030
1031
+ stats::ELFHeaderBytes += W.OS .tell () - StartOffset;
1032
+
1026
1033
// ... then the sections ...
1027
1034
SmallVector<std::pair<MCSectionELF *, SmallVector<unsigned >>, 0 > Groups;
1028
1035
// Map from group section index to group
0 commit comments