• Samuel Huang's avatar
    [SuperSize] Add support for outlining and fix arm64 flow. · cf383542
    Samuel Huang authored
    Outlining in LLD creates many symbols with names OUTLINED_FUNCTION_0,
    OUTLINED_FUNCTION_1, etc. that appear many times. Problems:
    * Unrelated symbols can share the same name. If object path information
      is available in the .map file (true for arm64 without ThinLTO), then
      SuperSize would run 10x as long because these paths get joined in an
      O(n^2) fashion.
    * In nm output, an address can have many OUTLINED_FUNCTION_* symbols,
      which adds to the bloat.
    
    This CL adds to SuperSize outlining support to solves the problems above.
    Details:
    * link_map_parser.py: (for LLD, and also Gold for testing) Detect
      OUTLINED_FUNCTION_* and reassign the name to '** outlined function'.
      The '*' prefix labels these symbols as placeholders, so these
      symbols will be ignored by nm results from .o files, and no object
      path joining occurs.
    * nm.py: For the nm call to the main ELF file, combine multiple
      OUTLINED_FUNCTION_* with the same address into a single symbol, and
      assign the name to '** outlined function * (count)'. If combination
      takes place, then "forced passing" occurs, i.e., the name will
      always be passed (rather than discarded to save space) to
      |names_by_address|.
    * archive.py: Updated to reconcile the two sources of
      '** outlined function' symbols.
    
    Outlined functions can share address with named symbols. Due to the
    combining in nm.py, this causes number of aliased symbols to decrease
    for affected named symbols (and increases PSS).
    
    '** outlined function' symbols can have object_path assigned, but the
    data are obtained from .map files only, since these symbols are ignored
    for nm results from .o files. Furthermore, if an outlined function
    symbol shares an address with any other such symbol (as found by nm
    results for the main ELF file), then it won't have object_path assigned
    (since "forced passing" above causes _AddNmAliases() to process the
    symbol, but this discards object_path data from .map files).
    
    Bug: 891061
    Change-Id: Ie0109c7fc876749c10a87b5a7673af2be49d38c4
    Reviewed-on: https://chromium-review.googlesource.com/c/1312561Reviewed-by: default avatarSamuel Huang <huangs@chromium.org>
    Reviewed-by: default avataragrieve <agrieve@chromium.org>
    Commit-Queue: Samuel Huang <huangs@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#604918}
    cf383542
test.map 10.6 KB