[SuperSize] Linker map parser: Add CFI support.
Previously SuperSize failed for desktop Chrome, because the linker .map
generated when CFI is enabled (desktop only) has many Level 3 entries
with sizes are equal to the containing Level 2 entries. But these
entries have advancing addresses, so overflow occurs, and the ensuing
negative gaps size triggers assert failure.
This CL implements CFI support for SuperSize to fix the issue. Details:
* linker_map_parser.py:
* Detect (Level 2) .L.cfi.jumptable entries, and extract them as
Level 2 symbol "** CFI jump table".
* This sidesteps the above overflow problem -- this appears only
for .L.cfi.jumptable entries.
* Collected and print various stats in verbose mode.
* Note: Level 3 details in .L.cfi.jumptable are discarded
(~64k symbols).
* Process CFI's __typeid_*_type_array: These are Level 3 entries that
have size = 1: So we use |span| explicitly.
* All other __typeid_ entries are found to be suppressed by the
|next_usable_address| mechanism: Print warnings if found.
* archive.py:
* _AssignNmAliasPathsAndCreatePathAliases(): Suppress
"Symbol not found" warnings for __typeid_ symbols to reduce noise.
* _AddNmAliases(): Add special case to skip "** CFI jump table"
symbols (can't skip all "*" symbols though; we still want
e.g., "** outlined functions").
* Add LinkerMapParserTest.test_ParserCfi() to handle only the new
CFI-related cases.
There is no change in SuperSize results for ChromePublicApk.apk
generated without CFI (currently the default).
Bug: 947114
Change-Id: Iaa0b7c8a779bddbd899afb88b246b978f0c41cd6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1579461
Commit-Queue: Samuel Huang <huangs@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#654460}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: d99034c8331eb4d48a6a7202e84a6af622032967
6 files changed