[llvm] [llvm][ELF] Add ELF header/section header table size statistics (PR #109345)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 23:35:32 PDT 2024


================
@@ -1008,6 +1011,8 @@ void ELFWriter::writeSectionHeaders(const MCAssembler &Asm) {
 
     writeSectionHeader(GroupSymbolIndex, Offsets.first, Size, *Section);
   }
+
+  stats::SectionHeaderBytes += W.OS.tell() - Start;
----------------
MaskRay wrote:

Add a test?

If llvm-project ever gets https://maskray.me/blog/2024-03-31-a-compact-section-header-table-for-elf (impl: 
https://github.com/MaskRay/llvm-project/tree/demo-cshdr ; which might need certain extent of agreement), this can be used to show the size difference due to -Wa,--cshdr  :)

https://github.com/llvm/llvm-project/pull/109345


More information about the llvm-commits mailing list