tools/binary_size/libsupersize/linker_map_parser.py
def _DetectLto(lines):
  """Scans LLD linker map file and returns whether LTO was used."""
  # It's assumed that the first line in |lines| was consumed to determine that
  # LLD was used. Seek 'thinlto-cache' prefix within an "indicator section" as
  # indicator for LTO.
  found_indicator_section = False
  # Potential names of "main section". Only one gets used.
  indicator_section_set = set(['.rodata', '.ARM.exidx'])
  start_pos = -1
  for line in lines:
    # Shortcut to avoid regex: The first line seen (second line in file) should
    # start a section, and start with '.', e.g.:
    #     194      194       13     1 .interp
    # Assign |start_pos| as position of '.', and trim everything before!
    if start_pos < 0:
      start_pos = line.index('.')
    if len(line) < start_pos:
      continue
    line = line[start_pos:]
    tok = line.lstrip()  # Allow whitespace at right.
    indent_size = len(line) - len(tok)
    if indent_size == 0:  # Section change.
      if found_indicator_section:  # Exit if just visited "main section".
        break
      if tok.strip() in indicator_section_set:
        found_indicator_section = True
    elif indent_size == 8:
      if found_indicator_section:
        if tok.startswith('thinlto-cache'):
          return True
  return False
Scans LLD linker map file and returns whether LTO was used.
Scans LLD linker map file and returns whether LTO was used.
Scans LLD linker map file and returns whether LTO was used .
def _DetectLto(lines):
  found_indicator_section = False
  indicator_section_set = set(['.rodata', '.ARM.exidx'])
  start_pos = -1
  for line in lines:
    if start_pos < 0:
      start_pos = line.index('.')
    if len(line) < start_pos:
      continue
    line = line[start_pos:]
    tok = line.lstrip()  
    indent_size = len(line) - len(tok)
    if indent_size == 0:  
      if found_indicator_section:  
        break
      if tok.strip() in indicator_section_set:
        found_indicator_section = True
    elif indent_size == 8:
      if found_indicator_section:
        if tok.startswith('thinlto-cache'):
          return True
  return False
def _DetectLto ( lines ) : found_indicator_section = False indicator_section_set = set ( [ '.rodata' , '.ARM.exidx' ] ) start_pos = - 1 for line in lines : if start_pos < 0 : start_pos = line . index ( '.' ) if len ( line ) < start_pos : continue line = line [ start_pos : ] tok = line . lstrip ( ) indent_size = len ( line ) - len ( tok ) if indent_size == 0 : if found_indicator_section : break if tok . strip ( ) in indicator_section_set : found_indicator_section = True elif indent_size == 8 : if found_indicator_section : if tok . startswith ( 'thinlto-cache' ) : return True return False
Scans LLD linker map file and returns whether LTO was used.
Scans LLD linker map file and returns whether LTO was used .
"""Scans LLD linker map file and returns whether LTO was used.""" # It's assumed that the first line in |lines| was consumed to determine that # LLD was used. Seek 'thinlto-cache' prefix within an "indicator section" as # indicator for LTO. # Potential names of "main section". Only one gets used. # Shortcut to avoid regex: The first line seen (second line in file) should # start a section, and start with '.', e.g.: #     194      194       13     1 .interp # Assign |start_pos| as position of '.', and trim everything before! # Allow whitespace at right. # Section change. # Exit if just visited "main section".
lines