[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
tree: 39b90dd5d03c4bcd5a8ef535c196330e25abc841
  1. accessibility/
  2. android/
  3. binary_size/
  4. bisect_repackage/
  5. cfi/
  6. check_ecs_deps/
  7. checkbins/
  8. checklicenses/
  9. checkperms/
  10. checkteamtags/
  11. chrome_extensions/
  12. chrome_proxy/
  13. clang/
  14. code_coverage/
  15. compile_test/
  16. coverity/
  17. cr/
  18. cros/
  19. cygprofile/
  20. cygprofile_win/
  21. determinism/
  22. dromaeo_benchmark_runner/
  23. dump_process_memory/
  24. emacs/
  25. find_runtime_symbols/
  26. flags/
  27. flakiness/
  28. fuchsia/
  29. gdb/
  30. generate_library_loader/
  31. generate_shim_headers/
  32. generate_stubs/
  33. git/
  34. gn/
  35. grit/
  36. gritsettings/
  37. idl_parser/
  38. imagediff/
  39. infra/
  40. ipc_fuzzer/
  41. json_comment_eater/
  42. json_schema_compiler/
  43. json_to_struct/
  44. linux/
  45. lldb/
  46. luci-go/
  47. mac/
  48. mb/
  49. md_browser/
  50. measure_page_load_time/
  51. media_engagement_preload/
  52. memory/
  53. memory_inspector/
  54. metrics/
  55. msan/
  56. oopif/
  57. origin_trials/
  58. page_cycler/
  59. perf/
  60. polymer/
  61. protoc_wrapper/
  62. python/
  63. real_world_impact/
  64. resources/
  65. security/
  66. site_compare/
  67. stats_viewer/
  68. strict_enum_value_checker/
  69. sublime/
  70. symsrc/
  71. tcmalloc/
  72. tests/
  73. traceline/
  74. traffic_annotation/
  75. translation/
  76. ubsan/
  77. usb_gadget/
  78. v8_context_snapshot/
  79. valgrind/
  80. variations/
  81. vim/
  82. vscode/
  83. web_bluetooth/
  84. web_dev_style/
  85. win/
  86. xdisplaycheck/
  87. bash-completion
  88. bisect-builds.py
  89. bisect_test.py
  90. boilerplate.py
  91. check_git_config.py
  92. check_grd_for_unused_strings.py
  93. clang-format-js
  94. DEPS
  95. diagnose-me.py
  96. gypv8sh.py
  97. include_tracer.py
  98. ipc_messages_log.py
  99. licenses.py
  100. make-gtest-filter.py
  101. multi_process_rss.py
  102. nocompile_driver.py
  103. omahaproxy.py
  104. OWNERS
  105. perry.py
  106. remove_duplicate_includes.py
  107. remove_stale_pyc_files.py
  108. roll_swiftshader.py
  109. roll_webgl_conformance.py
  110. run-swarmed.py
  111. safely-roll-deps.py
  112. sort-headers.py
  113. sort_sources.py
  114. uberblame.py
  115. unused-symbols-report.py
  116. yes_no.py