• Samuel Huang's avatar
    [SuperSize] Ignore LLVM promoted global names suffix (.llvm.1234). · 3828fe01
    Samuel Huang authored
    Under LLD ThinLTO, if thin_lto_enable_optimizations is enabled then
    "promoted global names" can appear. For these, mangled symbol names get
    the suffix '.llvm.1234' or '.1.llvm.1234', where '1' is a small number,
    and '1234' is a hash. When demangled, the suffix becomes ' (.llvm.1324)'
    or ' (.1.llvm.1324)' if successful; and is left alone otherwise.
    
    These suffix interferes with name comparison, leading to secondary
    problems like symbols losing path info.
    
    This CL makes SuperSize detect and strip these suffixes, to reduce
    spurious diffs from enabling ThinLTO optimization. The transformation
    is applied when parsing .map and nm output. Details:
    * Add demangle.StripLlvmPromotedGlobalNames(), which performs a
      quick-reject substring test for '.llvm.', followed by RegExp
      string substitution.
    * Print the number of promoted global names found in .map file.
    * Minor updates to comments and tests.
    
    Bug: 902723
    Change-Id: I4ca4142c891c948894c10180b31ff65b759cccfe
    Reviewed-on: https://chromium-review.googlesource.com/c/1324192
    Commit-Queue: Samuel Huang <huangs@chromium.org>
    Reviewed-by: default avatarEric Stevenson <estevenson@chromium.org>
    Reviewed-by: default avatarSamuel Huang <huangs@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#606487}
    3828fe01
demangle.py 3.45 KB