[Supersize] Add LTO detection using LLD .map files.
LLD-LTO flow (TODO) will be quite different from LLD flow. Supersize
will need to tell them apart (and store them using distinct linker names
in the .size file). This CL adds the functionality to detect LTO usage
from LLD .map files.
Previously linker detection (to discern Gold, and 2 versions of LLD
files) only needed to examine the first line of .map file. But for
LTO (LLD only), we'll need to look beyond this. The signal we chose is
to look for 'thinlto-cache' prefix at locations where paths usually
reside in .map files. To optimize for speed, we choose and scan one
'indicator section' (.ARM.exidx or .reloc, but easy to tweak).
Details:
- Refactor: Previously linker_map_parser.DetectLinkerNameFromMapFile()
  was called twice: to computie metadata, and in MapFileParser. Since
  the function is becoming more complex, we new call it once (for
  metadata), then pipe the information to MapFileParser to use.
- Add linker_map_parser._DetectLto() to handle most of the parsing. As
  optimization, we use ad-hoc string processing instead of Regex.
- Minor cleanup on version 0 vs. 1 difference for LLD.
After this change, the list of linker names are:
  {'gold', 'lld_v0', 'lld-lto_v0', 'lld_v1', 'lld-lto_v1'}.
Bug: 723798
Change-Id: I0498e50446be32a0335bb4781d60a6b72d7e87b5
Reviewed-on: https://chromium-review.googlesource.com/1107037
Commit-Queue: Samuel Huang <huangs@chromium.org>
Reviewed-by:  Samuel Huang <huangs@chromium.org>
Reviewed-by:
Samuel Huang <huangs@chromium.org>
Reviewed-by:  agrieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568723}
agrieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568723}
Showing
Please register or sign in to comment