• Samuel Huang's avatar
    [SuperSize] Fix section size accounting for ELF files. · 2a179dff
    Samuel Huang authored
    SuperSize-archive calls _AddUnattributedSectionSymbols() to create
    symbols (in .other section) to account for sections that are not covered
    by symbols. However, previously this was done only ELF files inside APK
    and not for stand-alone ELF files. Also, the accounting was off,
    resulting in Supersize-console
      Print(size_info)
    producing file sizes that are off. This CL fixes the above problems.
    Details:
    * Add models.ClassifySections() to classify sections into one of three
      groups:
      (1) Unsummed sections: These don't add to binary size. E.g., .bss.
      (2) Explicitly summed sections: These add to binary size, and have
          symbols that are extracted by the "usual method" via .map file
          parsing, nm, etc. E.g., .text.
      (3) Implicitly summed sections: These add to binary size, but needs
          to be extracted via _AddUnattributedSectionSymbols(), and counted
          as part of the .other section. E.g., .dynsym.
      * The function is used by archive.py and describe.py, to eliminate
        previous size mismatches.
      * Add BaseSizeInfo.ClassifySection() to wrap this.
    * archive.py: Change main flow so that _AddUnattributedSectionSymbols()
      get called when an ELF file is the main input (even without APK).
    * describe.py: When describing section sizes, add note to make it clear
      that a section is counted in the .other section.
    
    This CL leads to extensive .golden file changes.
    
    Bug: 1084580
    Change-Id: If663eb9acce89b32f857a0056b6f5ec39db35d8e
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2217861Reviewed-by: default avatarSamuel Huang <huangs@chromium.org>
    Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
    Commit-Queue: Samuel Huang <huangs@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#773342}
    2a179dff
Csv.golden 4.27 KB