tools/binary_size/libsupersize/file_format.py
def CalculatePadding(raw_symbols):
  """Populates the |padding| field based on symbol addresses. """
  logging.info('Calculating padding')

  seen_container_and_sections = set()
  for i, symbol in enumerate(raw_symbols[1:]):
    prev_symbol = raw_symbols[i]
    if symbol.IsOverhead():
      # Overhead symbols are not actionable so should be padding-only.
      symbol.padding = symbol.size
    if (prev_symbol.container.name != symbol.container.name
        or prev_symbol.section_name != symbol.section_name):
      container_and_section = (symbol.container.name, symbol.section_name)
      assert container_and_section not in seen_container_and_sections, """\
Input symbols must be sorted by container, section, then address.
Found: {}
Then: {}
""".format(prev_symbol, symbol)
      seen_container_and_sections.add(container_and_section)
      continue
    if (symbol.address <= 0 or prev_symbol.address <= 0
        or not symbol.IsNative() or not prev_symbol.IsNative()):
      continue

    if symbol.address == prev_symbol.address:
      if symbol.aliases and symbol.aliases is prev_symbol.aliases:
        symbol.padding = prev_symbol.padding
        symbol.size = prev_symbol.size
        continue
      # Padding-only symbols happen for ** symbol gaps.
      assert prev_symbol.size_without_padding == 0, (
          'Found duplicate symbols:\n%r\n%r' % (prev_symbol, symbol))

    padding = symbol.address - prev_symbol.end_address
    symbol.padding = padding
    symbol.size += padding
    assert symbol.size >= 0, (
        'Symbol has negative size (likely not sorted propertly): '
        '%r\nprev symbol: %r' % (symbol, prev_symbol))
Populates the |padding| field based on symbol addresses. 
Populates the |padding| field based on symbol addresses.
Populates the |padding| field based on symbol addresses .
def CalculatePadding(raw_symbols):
  logging.info('Calculating padding')
  seen_container_and_sections = set()
  for i, symbol in enumerate(raw_symbols[1:]):
    prev_symbol = raw_symbols[i]
    if symbol.IsOverhead():
      symbol.padding = symbol.size
    if (prev_symbol.container.name != symbol.container.name
        or prev_symbol.section_name != symbol.section_name):
      container_and_section = (symbol.container.name, symbol.section_name)
      assert container_and_section not in seen_container_and_sections, """\
Input symbols must be sorted by container, section, then address.
Found: {}
Then: {}
""".format(prev_symbol, symbol)
      seen_container_and_sections.add(container_and_section)
      continue
    if (symbol.address <= 0 or prev_symbol.address <= 0
        or not symbol.IsNative() or not prev_symbol.IsNative()):
      continue
    if symbol.address == prev_symbol.address:
      if symbol.aliases and symbol.aliases is prev_symbol.aliases:
        symbol.padding = prev_symbol.padding
        symbol.size = prev_symbol.size
        continue
      assert prev_symbol.size_without_padding == 0, (
          'Found duplicate symbols:\n%r\n%r' % (prev_symbol, symbol))
    padding = symbol.address - prev_symbol.end_address
    symbol.padding = padding
    symbol.size += padding
    assert symbol.size >= 0, (
        'Symbol has negative size (likely not sorted propertly): '
        '%r\nprev symbol: %r' % (symbol, prev_symbol))
def CalculatePadding ( raw_symbols ) : logging . info ( 'Calculating padding' ) seen_container_and_sections = set ( ) for i , symbol in enumerate ( raw_symbols [ 1 : ] ) : prev_symbol = raw_symbols [ i ] if symbol . IsOverhead ( ) : symbol . padding = symbol . size if ( prev_symbol . container . name != symbol . container . name or prev_symbol . section_name != symbol . section_name ) : container_and_section = ( symbol . container . name , symbol . section_name ) assert container_and_section not in seen_container_and_sections , """\
Input symbols must be sorted by container, section, then address.
Found: {}
Then: {}
""" . format ( prev_symbol , symbol ) seen_container_and_sections . add ( container_and_section ) continue if ( symbol . address <= 0 or prev_symbol . address <= 0 or not symbol . IsNative ( ) or not prev_symbol . IsNative ( ) ) : continue if symbol . address == prev_symbol . address : if symbol . aliases and symbol . aliases is prev_symbol . aliases : symbol . padding = prev_symbol . padding symbol . size = prev_symbol . size continue assert prev_symbol . size_without_padding == 0 , ( 'Found duplicate symbols:\n%r\n%r' % ( prev_symbol , symbol ) ) padding = symbol . address - prev_symbol . end_address symbol . padding = padding symbol . size += padding assert symbol . size >= 0 , ( 'Symbol has negative size (likely not sorted propertly): ' '%r\nprev symbol: %r' % ( symbol , prev_symbol ) )
Populates the |padding| field based on symbol addresses.
Populates the |padding| field based on symbol addresses .
"""Populates the |padding| field based on symbol addresses. """ # Overhead symbols are not actionable so should be padding-only. # Padding-only symbols happen for ** symbol gaps.
raw_symbols